Community
Participate
Working Groups
The ModelObject class in the attached file ModelObject.java throws "java.lang.VerifyError: (class: jatva/lang/ModelObject, method: <init> signature: (Ljatva/lang/ModelObject;)V) Illegal target of jump or branch" exception when compiled by JDT compiler (of 3.0-M8). The same class compiled by Sun JDK compiler does not cause this exception (compiled and run with Sun j2sdk 1.4.2_04). Both class files are attached here (named ModelObject.class.by-eclipse and ModelObject.class.by-sun). The class files disassembled with javap are enclosed too (named ModelObject.dis.by-eclipse and ModelObject.dis.by-sun). It seems that the problem is in line "45: goto 99" which jumps to non-existing label (see disassembled code of the public jatva.lang.ModelObject(jatva.lang.ModelObject); method).
Created attachment 9999 [details] Source code
Created attachment 10000 [details] Classfile compiled by JDT (3.0-M8)
Created attachment 10001 [details] Classfile compiled by Sun J2SE 1.4.2_04
Created attachment 10002 [details] Disassembled classfile created by JDT
Created attachment 10003 [details] Disassembled classfile created by Sun JDK
Offending line of code is: while ((line = licenseReader.readLine()) != null) { as a workaround for now, try to rewrite this line of source differently. We will try to fix it asap.
Alexei: what are your compiler settings ? I wasn't able to reproduce your problem with latest build.
Reproduced on reduced test case: import java.io.*; public class X { { String licenseFileName = "C:/Program Files/Jatt/bin/license.key"; File licenseFile = new File(licenseFileName); try { BufferedReader licenseReader = new BufferedReader( new FileReader(licenseFile)); StringBuffer buf = new StringBuffer(); String line = null; while ((line = licenseReader.readLine()) != null) { char[] chars = line.toCharArray(); for (int i = 0; i < line.length(); i++) { if (!Character.isSpace(line.charAt(i))) { buf.append(line.charAt(i)); } } } } catch (FileNotFoundException e) { throw new Error("License file not found", e); } catch (IOException e) { throw new Error("License file cannot be read", e); } } public X() { } public X(X r) { } }
Code generated in 1.3 compliant mode // Compiled from X.java (version 1.1 : 45.3, super bit) public class X extends java.lang.Object { // Method descriptor #6 ()V // Stack: 5, Locals: 8 public X(); 0 aload_0 1 invokespecial #9 <Method java/lang/Object.<init>()V> 4 ldc #11 <String "C:/Program Files/Jatt/bin/license.key"> 6 astore_1 7 new #13 java/io/File 10 dup 11 aload_1 12 invokespecial #16 <Method java/io/File.<init>(Ljava/lang/String;)V> 15 astore_2 16 new #18 java/io/BufferedReader 19 dup 20 new #20 java/io/FileReader 23 dup 24 aload_2 25 invokespecial #23 <Method java/io/FileReader.<init>(Ljava/io/File;)V> 28 invokespecial #26 <Method java/io/BufferedReader.<init> (Ljava/io/Reader;)V> 31 astore_3 32 new #28 java/lang/StringBuffer 35 dup 36 invokespecial #29 <Method java/lang/StringBuffer.<init>()V> 39 astore 4 41 aconst_null 42 astore 5 44 goto 99 47 aload 5 49 invokevirtual #35 <Method java/lang/String.toCharArray()[C> 52 astore 6 54 iconst_0 55 istore 7 57 goto 89 60 aload 5 62 iload 7 64 invokevirtual #39 <Method java/lang/String.charAt(I)C> 67 invokestatic #45 <Method java/lang/Character.isSpace(C)Z> 70 ifne 86 73 aload 4 75 aload 5 77 iload 7 79 invokevirtual #39 <Method java/lang/String.charAt(I)C> 82 invokevirtual #49 <Method java/lang/StringBuffer.append(C) Ljava/lang/StringBuffer;> 85 pop 86 iinc 7 1 89 iload 7 91 aload 5 93 invokevirtual #53 <Method java/lang/String.length()I> 96 if_icmplt 60 99 aload_3 100 invokevirtual #57 <Method java/io/BufferedReader.readLine() Ljava/lang/String;> 103 dup 104 astore 5 106 ifnonnull 47 109 goto 136 112 astore_3 113 new #59 java/lang/Error 116 dup 117 ldc #61 <String "License file not found"> 119 aload_3 120 invokespecial #64 <Method java/lang/Error.<init> (Ljava/lang/String;Ljava/lang/Throwable;)V> 123 athrow 124 astore_3 125 new #59 java/lang/Error 128 dup 129 ldc #66 <String "License file cannot be read"> 131 aload_3 132 invokespecial #64 <Method java/lang/Error.<init> (Ljava/lang/String;Ljava/lang/Throwable;)V> 135 athrow 136 return Exception Table: [pc: 16, pc: 112] -> 112 when : java.io.FileNotFoundException [pc: 16, pc: 112] -> 124 when : java.io.IOException Line numbers: [pc: 0, line: 27] [pc: 4, line: 5] [pc: 7, line: 6] [pc: 16, line: 8] [pc: 20, line: 9] [pc: 28, line: 8] [pc: 32, line: 10] [pc: 41, line: 11] [pc: 44, line: 12] [pc: 47, line: 13] [pc: 54, line: 14] [pc: 60, line: 15] [pc: 73, line: 16] [pc: 86, line: 14] [pc: 99, line: 12] [pc: 112, line: 21] [pc: 113, line: 22] [pc: 124, line: 23] [pc: 125, line: 24] [pc: 136, line: 29] Local variable table: [pc: 0, pc: 137] local: this index: 0 type: LX; [pc: 7, pc: 136] local: licenseFileName index: 1 type: Ljava/lang/String; [pc: 16, pc: 136] local: licenseFile index: 2 type: Ljava/io/File; [pc: 32, pc: 112] local: licenseReader index: 3 type: Ljava/io/BufferedReader; [pc: 41, pc: 112] local: buf index: 4 type: Ljava/lang/StringBuffer; [pc: 44, pc: 112] local: line index: 5 type: Ljava/lang/String; [pc: 54, pc: 99] local: chars index: 6 type: [C [pc: 57, pc: 99] local: i index: 7 type: I [pc: 113, pc: 124] local: e index: 3 type: Ljava/io/FileNotFoundException; [pc: 125, pc: 136] local: e index: 3 type: Ljava/io/IOException; // Method descriptor #91 (LX;)V // Stack: 5, Locals: 9 public X(X r); 0 aload_0 1 invokespecial #9 <Method java/lang/Object.<init>()V> 4 ldc #11 <String "C:/Program Files/Jatt/bin/license.key"> 6 astore_2 7 new #13 java/io/File 10 dup 11 aload_2 12 invokespecial #16 <Method java/io/File.<init>(Ljava/lang/String;)V> 15 astore_3 16 new #18 java/io/BufferedReader 19 dup 20 new #20 java/io/FileReader 23 dup 24 aload_3 25 invokespecial #23 <Method java/io/FileReader.<init>(Ljava/io/File;)V> 28 invokespecial #26 <Method java/io/BufferedReader.<init> (Ljava/io/Reader;)V> 31 astore 4 33 new #28 java/lang/StringBuffer 36 dup 37 invokespecial #29 <Method java/lang/StringBuffer.<init>()V> 40 astore 5 42 aconst_null 43 astore 6 45 goto 99 48 aload 6 50 invokevirtual #35 <Method java/lang/String.toCharArray()[C> 53 astore 7 55 iconst_0 56 istore 8 58 goto 90 61 aload 6 63 iload 8 65 invokevirtual #39 <Method java/lang/String.charAt(I)C> 68 invokestatic #45 <Method java/lang/Character.isSpace(C)Z> 71 ifne 87 74 aload 5 76 aload 6 78 iload 8 80 invokevirtual #39 <Method java/lang/String.charAt(I)C> 83 invokevirtual #49 <Method java/lang/StringBuffer.append(C) Ljava/lang/StringBuffer;> 86 pop 87 iinc 8 1 90 iload 8 92 aload 6 94 invokevirtual #53 <Method java/lang/String.length()I> 97 if_icmplt 61 100 aload 4 102 invokevirtual #57 <Method java/io/BufferedReader.readLine() Ljava/lang/String;> 105 dup 106 astore 6 108 ifnonnull 48 111 goto 142 114 astore 4 116 new #59 java/lang/Error 119 dup 120 ldc #61 <String "License file not found"> 122 aload 4 124 invokespecial #64 <Method java/lang/Error.<init> (Ljava/lang/String;Ljava/lang/Throwable;)V> 127 athrow 128 astore 4 130 new #59 java/lang/Error 133 dup 134 ldc #66 <String "License file cannot be read"> 136 aload 4 138 invokespecial #64 <Method java/lang/Error.<init> (Ljava/lang/String;Ljava/lang/Throwable;)V> 141 athrow 142 return Exception Table: [pc: 16, pc: 114] -> 114 when : java.io.FileNotFoundException [pc: 16, pc: 114] -> 128 when : java.io.IOException Line numbers: [pc: 0, line: 31] [pc: 4, line: 5] [pc: 7, line: 6] [pc: 16, line: 8] [pc: 20, line: 9] [pc: 28, line: 8] [pc: 33, line: 10] [pc: 42, line: 11] [pc: 45, line: 12] [pc: 48, line: 13] [pc: 55, line: 14] [pc: 61, line: 15] [pc: 74, line: 16] [pc: 87, line: 14] [pc: 100, line: 12] [pc: 114, line: 21] [pc: 116, line: 22] [pc: 128, line: 23] [pc: 130, line: 24] [pc: 142, line: 33] Local variable table: [pc: 0, pc: 143] local: this index: 0 type: LX; [pc: 0, pc: 143] local: r index: 1 type: LX; [pc: 7, pc: 142] local: licenseFileName index: 2 type: Ljava/lang/String; [pc: 16, pc: 142] local: licenseFile index: 3 type: Ljava/io/File; [pc: 33, pc: 114] local: licenseReader index: 4 type: Ljava/io/BufferedReader; [pc: 42, pc: 114] local: buf index: 5 type: Ljava/lang/StringBuffer; [pc: 45, pc: 114] local: line index: 6 type: Ljava/lang/String; [pc: 55, pc: 100] local: chars index: 7 type: [C [pc: 58, pc: 100] local: i index: 8 type: I [pc: 116, pc: 128] local: e index: 4 type: Ljava/io/FileNotFoundException; [pc: 130, pc: 142] local: e index: 4 type: Ljava/io/IOException; }
Problem is indeed in reuse of shared labels (associated to control-flow statements). We do not reinitialize them properly when redoing their codegen for multiple constructors. Olivier - I have the fix for it. I basically reset shared labels during codegen. Wouldn't this obsolete the need for resetting labels when redoing codegen (wide mode?) ?
I had a fix also resetting the labels prior to the initializer code generation. If we garantee that the labels are reinitialized in case we restart in wide mode, then yes, this would be obsolete.
Could you please release your fix?
Fix released.
Added regression test TryStatementTest#test025
fixed
Released changes to remove the need to reset labels when the code generation restarts in wide mode.
Verified in 200405180816