Reputation: 81
I got some weird exception when trying to compile this:
Byte b = 2;
if (b < new Integer(5)) {
...
}
Is it a valid check (unboxing-implicit cast - unboxing)?
Upvotes: 2
Views: 1367
Reputation: 813
I had this error too, but no one(1.6 and 1.8) javac didn't got right. There were more than two libs(*.jar files), which is different versions of duplicated libs. Removing duplicates resolved comlie error
Upvotes: 0
Reputation: 147164
If there is a bug in your compiler, here's what you do:
In general, it's not useful to post about random bugs in software products on Q&A sites.
Upvotes: 3
Reputation: 81
My compiler version used is: 1.6.0_16-b01 for 6.0 compliant It looks like the problem disappears if I switch to 5.0 compliant code.
Upvotes: 0
Reputation: 11279
If you're getting an Internal Compiler Error (ICE), it's a bug in the Java compiler itself, not necessarily anything wrong with your code.
Your code snippet compiles fine on a recent OpenJDK. What Java compiler are you using?
Upvotes: 1
Reputation: 67832
public class test
{
public static void main( String[] args )
{
Byte b = 2;
if( b < new Integer(5) )
{
System.out.println( "Working." );
}
}
}
Works for me. (Java 1.6.0_17).
Upvotes: 1