Robert
Robert

Reputation: 81

Internal compiler error ArrayIndexOutOfBoundsException: -1 ... generateUnboxingConversion

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

Answers (5)

Nurlan
Nurlan

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

Tom Hawtin - tackline
Tom Hawtin - tackline

Reputation: 147164

If there is a bug in your compiler, here's what you do:

  • Make sure you are using an up to date version of the compiler.
  • If the vendor has a public bug database, check that (hint: use actual text copy-and-pasted from the exception trace).
  • If it's a known bug, up vote it, raise an escalation, whatever.
  • If you can't find a copy of the bug, submit a bug report with a concise, compilable (or not!) test case.

In general, it's not useful to post about random bugs in software products on Q&A sites.

Upvotes: 3

Robert
Robert

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

ZoogieZork
ZoogieZork

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

Stefan Kendall
Stefan Kendall

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

Related Questions