• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Compiler Bug

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With java 5.0 update 8, There is a compiler error
The operator += is undefined for the argument type(s) Test, null
Thanks
Deepak
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic