src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java

changeset 310
7c154fdc3547
parent 309
664edca41e34
child 323
14b1a8ede954
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Fri Jun 26 19:12:41 2009 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Fri Jun 26 19:47:12 2009 -0700
     1.3 @@ -45,6 +45,7 @@
     1.4      public int pos = -1;
     1.5  
     1.6      // For typecasts, type tests, new (and locals, as start_pc).
     1.7 +    public boolean isValidOffset = false;
     1.8      public int offset = -1;
     1.9  
    1.10      // For locals. arrays same length
    1.11 @@ -177,4 +178,17 @@
    1.12          sb.append(']');
    1.13          return sb.toString();
    1.14      }
    1.15 +
    1.16 +    /**
    1.17 +     * Indicates whether the target tree of the annotation has been optimized
    1.18 +     * away from classfile or not.
    1.19 +     * @return true if the target has not been optimized away
    1.20 +     */
    1.21 +    public boolean emitToClassfile() {
    1.22 +        if (type == TargetType.WILDCARD_BOUND
    1.23 +            || type == TargetType.WILDCARD_BOUND_GENERIC_OR_ARRAY)
    1.24 +            return wildcard_position.isValidOffset;
    1.25 +        else
    1.26 +            return !type.isLocal() || isValidOffset;
    1.27 +    }
    1.28  }

mercurial