src/share/classes/com/sun/tools/javac/jvm/Gen.java

changeset 2103
b1b4a6dcc282
parent 2027
4932bb04c4b8
child 2114
09a414673570
     1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Oct 10 13:55:41 2013 -0400
     1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Oct 10 20:12:08 2013 -0400
     1.3 @@ -104,6 +104,8 @@
     1.4       */
     1.5      private LVTRanges lvtRanges;
     1.6  
     1.7 +    private final boolean typeAnnoAsserts;
     1.8 +
     1.9      protected Gen(Context context) {
    1.10          context.put(genKey, this);
    1.11  
    1.12 @@ -140,6 +142,7 @@
    1.13          debugCode = options.isSet("debugcode");
    1.14          allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
    1.15          pool = new Pool(types);
    1.16 +        typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
    1.17  
    1.18          generateIproxies =
    1.19              target.requiresIproxy() ||
    1.20 @@ -562,9 +565,13 @@
    1.21          ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
    1.22          ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
    1.23          for (TypeCompound ta : tas) {
    1.24 -            if (ta.position.type == TargetType.FIELD) {
    1.25 +            if (ta.getPosition().type == TargetType.FIELD) {
    1.26                  fieldTAs.add(ta);
    1.27              } else {
    1.28 +                if (typeAnnoAsserts) {
    1.29 +                    Assert.error("Type annotation does not have a valid positior");
    1.30 +                }
    1.31 +
    1.32                  nonfieldTAs.add(ta);
    1.33              }
    1.34          }

mercurial