开发者

Internal compiler error ArrayIndexOutOfBoundsException: -1 ... generateUnboxingConversion

开发者 https://www.devze.com 2022-12-14 01:13 出处:网络
I got some weird exception when trying to compile this: Byte b = 2; if (b < new Integer(5)) { ... } Is it开发者_如何学C a valid check (unboxing-implicit cast - unboxing)?If there is a bug in you

I got some weird exception when trying to compile this:

  Byte b = 2;
  if (b < new Integer(5)) {
     ...
  }

Is it开发者_如何学C a valid check (unboxing-implicit cast - unboxing)?


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.


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).


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?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消