wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Compiler Bug Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Compiler Bug" Watch "Compiler Bug" New topic

Compiler Bug

saravana.T kumar

Joined: Jul 13, 2007
Posts: 23
public static void main(String args[])
test t=new test();

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.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41601
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.

Ping & DNS - my free Android networking tools app
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
With java 5.0 update 8, There is a compiler error
The operator += is undefined for the argument type(s) Test, null

It is sorta covered in the JavaRanch Style Guide.
subject: Compiler Bug