8032932: Add assertion to fix silent failure in Gen.getAndRemoveNonFieldTAs

Turn silent failure if type annotation position type is UNKNOWN into assertion failure.

Reviewed-by: jjg
This commit is contained in:
Eric McCorkle 2014-01-28 17:52:30 -05:00
parent 07998a6335
commit 77feb9302c

View File

@ -103,8 +103,6 @@ public class Gen extends JCTree.Visitor {
*/
private LVTRanges lvtRanges;
private final boolean typeAnnoAsserts;
protected Gen(Context context) {
context.put(genKey, this);
@ -141,7 +139,6 @@ public class Gen extends JCTree.Visitor {
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 @@ public class Gen extends JCTree.Visitor {
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);
}
}