8032932: Add assertion to fix silent failure in Gen.getAndRemoveNonFieldTAs
authoremc
Tue, 28 Jan 2014 17:52:30 -0500
changeset 22697 2a39af0e7d34
parent 22696 0a916fd27b8b
child 22698 818555741cd5
8032932: Add assertion to fix silent failure in Gen.getAndRemoveNonFieldTAs Summary: Turn silent failure if type annotation position type is UNKNOWN into assertion failure. Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Jan 28 17:51:28 2014 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Jan 28 17:52:30 2014 -0500
@@ -103,8 +103,6 @@
      */
     private LVTRanges lvtRanges;
 
-    private final boolean typeAnnoAsserts;
-
     protected Gen(Context context) {
         context.put(genKey, this);
 
@@ -141,7 +139,6 @@
         debugCode = options.isSet("debugcode");
         allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
         pool = new Pool(types);
-        typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
 
         generateIproxies =
             target.requiresIproxy() ||
@@ -564,13 +561,10 @@
         ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<>();
         ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<>();
         for (TypeCompound ta : tas) {
+            Assert.check(ta.getPosition().type != TargetType.UNKNOWN);
             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);
             }
         }