langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
changeset 21010 5ffe0d8a5e24
parent 19941 8b91e8eb2d20
child 21021 04429d0cb744
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Oct 10 13:55:41 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Oct 10 20:12:08 2013 -0400
@@ -104,6 +104,8 @@
      */
     private LVTRanges lvtRanges;
 
+    private final boolean typeAnnoAsserts;
+
     protected Gen(Context context) {
         context.put(genKey, this);
 
@@ -140,6 +142,7 @@
         debugCode = options.isSet("debugcode");
         allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
         pool = new Pool(types);
+        typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
 
         generateIproxies =
             target.requiresIproxy() ||
@@ -562,9 +565,13 @@
         ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
         ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
         for (TypeCompound ta : tas) {
-            if (ta.position.type == TargetType.FIELD) {
+            if (ta.getPosition().type == TargetType.FIELD) {
                 fieldTAs.add(ta);
             } else {
+                if (typeAnnoAsserts) {
+                    Assert.error("Type annotation does not have a valid positior");
+                }
+
                 nonfieldTAs.add(ta);
             }
         }