8032587: Change silent failure in Attr.java to assertion
authoremc
Fri, 24 Jan 2014 08:47:32 -0500
changeset 22691 ea96f68e3d9a
parent 22690 86dd707d616a
child 22692 51651a2a3443
8032587: Change silent failure in Attr.java to assertion Summary: Change silent failure in Attr.fromAttributes into a non-null assertion Reviewed-by: jfranck
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 27 12:45:03 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 24 08:47:32 2014 -0500
@@ -4093,18 +4093,8 @@
 
         ListBuffer<Attribute.TypeCompound> buf = new ListBuffer<>();
         for (JCAnnotation anno : annotations) {
-            if (anno.attribute != null) {
-                // TODO: this null-check is only needed for an obscure
-                // ordering issue, where annotate.flush is called when
-                // the attribute is not set yet. For an example failure
-                // try the referenceinfos/NestedTypes.java test.
-                // Any better solutions?
-                buf.append((Attribute.TypeCompound) anno.attribute);
-            }
-            // Eventually we will want to throw an exception here, but
-            // we can't do that just yet, because it gets triggered
-            // when attempting to attach an annotation that isn't
-            // defined.
+            Assert.checkNonNull(anno.attribute);
+            buf.append((Attribute.TypeCompound) anno.attribute);
         }
         return buf.toList();
     }