changeset 3350:9c2c24a6785d

8035763: Error parsing binary type annotations data in javac Summary: Fix accidental reversal of read order from a previous change Reviewed-by: jjg
author emc
date Fri, 09 May 2014 22:27:07 -0400
parents c1c2a5f9ba0c
children 4525f3a38730
files src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
diffstat 1 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri May 09 18:50:12 2014 -0700
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri May 09 22:27:07 2014 -0400
@@ -1540,35 +1540,41 @@
         // local variable
         case LOCAL_VARIABLE: {
             final int table_length = nextChar();
-            final TypeAnnotationPosition position =
-                TypeAnnotationPosition.localVariable(readTypePath());
-
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
+            final int[] newLvarOffset = new int[table_length];
+            final int[] newLvarLength = new int[table_length];
+            final int[] newLvarIndex = new int[table_length];
 
             for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = nextChar();
-                position.lvarLength[i] = nextChar();
-                position.lvarIndex[i] = nextChar();
+                newLvarOffset[i] = nextChar();
+                newLvarLength[i] = nextChar();
+                newLvarIndex[i] = nextChar();
             }
+
+            final TypeAnnotationPosition position =
+                    TypeAnnotationPosition.localVariable(readTypePath());
+            position.lvarOffset = newLvarOffset;
+            position.lvarLength = newLvarLength;
+            position.lvarIndex = newLvarIndex;
             return position;
         }
         // resource variable
         case RESOURCE_VARIABLE: {
             final int table_length = nextChar();
-            final TypeAnnotationPosition position =
-                TypeAnnotationPosition.resourceVariable(readTypePath());
-
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
+            final int[] newLvarOffset = new int[table_length];
+            final int[] newLvarLength = new int[table_length];
+            final int[] newLvarIndex = new int[table_length];
 
             for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = nextChar();
-                position.lvarLength[i] = nextChar();
-                position.lvarIndex[i] = nextChar();
+                newLvarOffset[i] = nextChar();
+                newLvarLength[i] = nextChar();
+                newLvarIndex[i] = nextChar();
             }
+
+            final TypeAnnotationPosition position =
+                    TypeAnnotationPosition.resourceVariable(readTypePath());
+            position.lvarOffset = newLvarOffset;
+            position.lvarLength = newLvarLength;
+            position.lvarIndex = newLvarIndex;
             return position;
         }
         // exception parameter