102 |
102 |
103 /** LVTRanges info. |
103 /** LVTRanges info. |
104 */ |
104 */ |
105 private LVTRanges lvtRanges; |
105 private LVTRanges lvtRanges; |
106 |
106 |
|
107 private final boolean typeAnnoAsserts; |
|
108 |
107 protected Gen(Context context) { |
109 protected Gen(Context context) { |
108 context.put(genKey, this); |
110 context.put(genKey, this); |
109 |
111 |
110 names = Names.instance(context); |
112 names = Names.instance(context); |
111 log = Log.instance(context); |
113 log = Log.instance(context); |
138 } |
140 } |
139 genCrt = options.isSet(XJCOV); |
141 genCrt = options.isSet(XJCOV); |
140 debugCode = options.isSet("debugcode"); |
142 debugCode = options.isSet("debugcode"); |
141 allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic"); |
143 allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic"); |
142 pool = new Pool(types); |
144 pool = new Pool(types); |
|
145 typeAnnoAsserts = options.isSet("TypeAnnotationAsserts"); |
143 |
146 |
144 generateIproxies = |
147 generateIproxies = |
145 target.requiresIproxy() || |
148 target.requiresIproxy() || |
146 options.isSet("miranda"); |
149 options.isSet("miranda"); |
147 |
150 |
560 private List<Attribute.TypeCompound> getAndRemoveNonFieldTAs(VarSymbol sym) { |
563 private List<Attribute.TypeCompound> getAndRemoveNonFieldTAs(VarSymbol sym) { |
561 List<TypeCompound> tas = sym.getRawTypeAttributes(); |
564 List<TypeCompound> tas = sym.getRawTypeAttributes(); |
562 ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>(); |
565 ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>(); |
563 ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>(); |
566 ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>(); |
564 for (TypeCompound ta : tas) { |
567 for (TypeCompound ta : tas) { |
565 if (ta.position.type == TargetType.FIELD) { |
568 if (ta.getPosition().type == TargetType.FIELD) { |
566 fieldTAs.add(ta); |
569 fieldTAs.add(ta); |
567 } else { |
570 } else { |
|
571 if (typeAnnoAsserts) { |
|
572 Assert.error("Type annotation does not have a valid positior"); |
|
573 } |
|
574 |
568 nonfieldTAs.add(ta); |
575 nonfieldTAs.add(ta); |
569 } |
576 } |
570 } |
577 } |
571 sym.setTypeAttributes(fieldTAs.toList()); |
578 sym.setTypeAttributes(fieldTAs.toList()); |
572 return nonfieldTAs.toList(); |
579 return nonfieldTAs.toList(); |