Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Found a Bug In JDK 1.3.

 
Prasad Ballari
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,
(Hope such questions will not be asked in the exam.)
Its unbelivable for me to accept this, that i have found out one Bug in JDK 1.3.
What i tried to do is,I wanted to access the static data field residing inside the static inner class.That time it popped up as Bug & asked me report to Sun.(I did that).
Following is code.

Now i am bit confused about this static concept.Paul has really taken hard efforts to explain me this. I think some percentage i have understood.Any way sooner i will be able ,make one exhaustive notes & examples on this Static inner classes.I request paul to go through my notes, & advice me if would any mistakes.

Pls test this on ur m/c and tell me whether same result it pops up
The result i got is--
An exception has occurred in the compiler (1.3.0). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your program and the following diagnostic in your report. Thank you. java.lang.NullPointerException at com.sun.tools.javac.v8.comp.TransInner.access(TransInner.java:722) at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1558) at com.sun.tools.javac.v8.tree.Tree$Select.visit(Tree.java:963) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1552) at com.sun.tools.javac.v8.tree.Tree$Select.visit(Tree.java:963) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:47) at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1461) at com.sun.tools.javac.v8.tree.Tree$Apply.visit(Tree.java:785) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:179) at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:699) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:47) at com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:111) at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:100) at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1418) at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1355) at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:402) at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:35) at com.sun.tools.javac.v8.comp.TransInner.translate(TransInner.java:1317) at com.sun.tools.javac.v8.comp.TransInner.translateTopLevelClass(TransInner.java:1583) at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:397) at com.sun.tools.javac.v8.Main.compile(Main.java:247) at com.sun.tools.javac.Main.main(Main.java:16)
Regards
Prasad

------------------

[This message has been edited by Prasad Ballari (edited October 24, 2000).]
And Mapraputa added UBB code here.
[This message has been edited by Mapraputa Is (edited October 24, 2000).]
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prasad,
I tried your code on JDK1.2.2 and got compiler error message: No variable InnerII defined in class OuterII
But both

compile and run fine.
 
Prasad Ballari
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mapraputa ,
Thanks for concern.
Regards
Prasad
 
Viji Bharat
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prasad:
I think you get the error because you have the declaration and initialization as
new OuterII().InnerII.i
Well, I tried this in 1.3 too and I got the same error you have posted. However, I haven't tried it in 1.2 though.
However, I think the correct declaration should be new OuterII.InnerII().i. This compiles and works fine.
[This message has been edited by Viji Bharat (edited October 25, 2000).]
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3713
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prasad, where are your notes???
-Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus
 
Prasad Ballari
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Sorry for the delay. I am still preparing..I will post it with in 2 days.

Thanks for your greate interest.
Regards
Prasad
 
Sahir Shibley
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<HTML>
Hi,
The correct way to refer to the variable is


<PRE>
public class Outer{
public static class Inner{
public static int i = 1;
}
public static void main(String[] args)
{
System.out.println(Outer.Inner.i);
}
}
</PRE>
Normally the compiler should report an error. But it caused a dump becuse of a bug in the compiler. Dont worry about it. Its bug with minimal or no impact on the user.
Just dont do that sort of thing again.
Rgds - Sahir
</HTML>
[This message has been edited by Sahir Shibley (edited October 25, 2000).]
 
Jonathan Jeban
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Initially , when I started to learn about inner class , I too
run into similiar problems . One such problem I posted in
Beginner's section is this..I used JDK 1.2
Jeban
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just found out that this bug has already been reported. Read more about it in the Bug Prade.
Ajith
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic