public static void main(String args[]) { test t=new test(); t+=null; }
ErroR when COMPILING An exception has occurred in the compiler (1.5.0_11). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.ArrayIndexOutOfBoundsException: 277 at com.sun.tools.javac.jvm.Code.mnem(Code.java:1791) at com.sun.tools.javac.jvm.Code.emitop0(Code.java:804) at com.sun.tools.javac.jvm.Gen.completeBinop(Gen.java:1977) at com.sun.tools.javac.jvm.Gen.visitAssignop(Gen.java:1752) at com.sun.tools.javac.tree.Tree$Assignop.accept(Tree.java:897) at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:806) at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1556) at com.sun.tools.javac.tree.Tree$Exec.accept(Tree.java:728) at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:653) at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:688) at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:674) at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:725) at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:971) at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535) at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:653) at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:688) at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:910) at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:846) at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:478) at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:653) at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2146) at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:347) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:499) at com.sun.tools.javac.main.Main.compile(Main.java:592) at com.sun.tools.javac.main.Main.compile(Main.java:544) at com.sun.tools.javac.Main.compile(Main.java:67) at com.sun.tools.javac.Main.main(Main.java:52)
My guess is that object with null reference cant give a Compiler error. Is anything wrong with the statement if SO please explain why is the compiler halting Thank You.
First of all, you should do what the message is telling you, which is to file a bug report with Sun about this bug in the javac compiler that you have found.
The problem is likely the "t += null" statement. The "+=" operator is defined for very types, namely numerical types and strings. Using it with any other types (like you are doing here) won't work.