6918127: improve handling of TypeAnnotationPosition fields

Wed, 20 Jan 2010 16:12:26 -0800

author
jjg
date
Wed, 20 Jan 2010 16:12:26 -0800
changeset 478
0eaf89e08564
parent 477
f23b985beb78
child 479
da0e3e2dd3ef

6918127: improve handling of TypeAnnotationPosition fields
Reviewed-by: jjg, darcy
Contributed-by: mali@csail.mit.edu, mernst@cs.washington.edu

src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/Code.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/Gen.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Tue Jan 19 14:28:45 2010 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Wed Jan 20 16:12:26 2010 -0800
     1.3 @@ -264,18 +264,18 @@
     1.4          public int offset = -1;
     1.5  
     1.6          // For locals.
     1.7 -        public int[] lvarOffset = new int[] { -1 };
     1.8 -        public int[] lvarLength = new int[] { -1 };
     1.9 -        public int[] lvarIndex = new int[] { -1 };
    1.10 +        public int[] lvarOffset = null;
    1.11 +        public int[] lvarLength = null;
    1.12 +        public int[] lvarIndex = null;
    1.13  
    1.14          // For type parameter bound
    1.15 -        public int bound_index = -1;
    1.16 +        public int bound_index = Integer.MIN_VALUE;
    1.17  
    1.18          // For type parameter and method parameter
    1.19 -        public int parameter_index = -1;
    1.20 +        public int parameter_index = Integer.MIN_VALUE;
    1.21  
    1.22          // For class extends, implements, and throws classes
    1.23 -        public int type_index = -2;
    1.24 +        public int type_index = Integer.MIN_VALUE;
    1.25  
    1.26          // For wildcards
    1.27          public Position wildcard_position = null;
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Tue Jan 19 14:28:45 2010 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Wed Jan 20 16:12:26 2010 -0800
     2.3 @@ -49,18 +49,18 @@
     2.4      public int offset = -1;
     2.5  
     2.6      // For locals. arrays same length
     2.7 -    public int[] lvarOffset = new int[] { -1 };
     2.8 -    public int[] lvarLength = new int[] { -1 };
     2.9 -    public int[] lvarIndex = new int[] { -1 };
    2.10 +    public int[] lvarOffset = null;
    2.11 +    public int[] lvarLength = null;
    2.12 +    public int[] lvarIndex = null;
    2.13  
    2.14      // For type parameter bound
    2.15 -    public int bound_index = -1;
    2.16 +    public int bound_index = Integer.MIN_VALUE;
    2.17  
    2.18      // For type parameter and method parameter
    2.19 -    public int parameter_index = -1;
    2.20 +    public int parameter_index = Integer.MIN_VALUE;
    2.21  
    2.22      // For class extends, implements, and throws classes
    2.23 -    public int type_index = -2;
    2.24 +    public int type_index = Integer.MIN_VALUE;
    2.25  
    2.26      // For wildcards
    2.27      public TypeAnnotationPosition wildcard_position = null;
     3.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Tue Jan 19 14:28:45 2010 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jan 20 16:12:26 2010 -0800
     3.3 @@ -1926,9 +1926,9 @@
     3.4          for (Attribute.TypeCompound ta : lv.sym.typeAnnotations) {
     3.5              TypeAnnotationPosition p = ta.position;
     3.6              while (p != null) {
     3.7 -                p.lvarOffset[0] = (int)lv.start_pc;
     3.8 -                p.lvarLength[0] = (int)lv.length;
     3.9 -                p.lvarIndex[0] = (int)lv.reg;
    3.10 +                p.lvarOffset = new int[] { (int)lv.start_pc };
    3.11 +                p.lvarLength = new int[] { (int)lv.length };
    3.12 +                p.lvarIndex = new int[] { (int)lv.reg };
    3.13                  p.isValidOffset = true;
    3.14                  p = p.wildcard_position;
    3.15              }
     4.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Jan 19 14:28:45 2010 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jan 20 16:12:26 2010 -0800
     4.3 @@ -1714,7 +1714,7 @@
     4.4          for (Attribute.TypeCompound ta : meth.typeAnnotations) {
     4.5              if (ta.position.pos == treePos) {
     4.6                  ta.position.offset = code.cp;
     4.7 -                ta.position.lvarOffset[0] = code.cp;
     4.8 +                ta.position.lvarOffset = new int[] { code.cp };
     4.9                  ta.position.isValidOffset = true;
    4.10              }
    4.11          }
    4.12 @@ -1726,7 +1726,7 @@
    4.13          for (Attribute.TypeCompound ta : meth.owner.typeAnnotations) {
    4.14              if (ta.position.pos == treePos) {
    4.15                  ta.position.offset = code.cp;
    4.16 -                ta.position.lvarOffset[0] = code.cp;
    4.17 +                ta.position.lvarOffset = new int[] { code.cp };
    4.18                  ta.position.isValidOffset = true;
    4.19              }
    4.20          }
    4.21 @@ -1738,7 +1738,7 @@
    4.22              for (Attribute.TypeCompound ta : s.typeAnnotations) {
    4.23                  if (ta.position.pos == treePos) {
    4.24                      ta.position.offset = code.cp;
    4.25 -                    ta.position.lvarOffset[0] = code.cp;
    4.26 +                    ta.position.lvarOffset = new int[] { code.cp };
    4.27                      ta.position.isValidOffset = true;
    4.28                  }
    4.29              }

mercurial