this.elements = prevElements;
appendLiteralArgument(t, (CollectionLiteralAnnotationTerm)this.term);
}
private CollectionLiteralAnnotationTerm startCollection(Tree.Term t) {
Unit unit = t.getUnit();
// Continue the visit to collect the elements
ProducedType iteratedType = unit.getIteratedType(parameter().getType());
TypeDeclaration declaration = iteratedType.getDeclaration();
LiteralAnnotationTerm factory;
if (unit.getStringDeclaration().equals(declaration)) {
factory = StringLiteralAnnotationTerm.FACTORY;
} else if (unit.getIntegerDeclaration().equals(declaration)) {
factory = IntegerLiteralAnnotationTerm.FACTORY;
} else if (unit.getCharacterDeclaration().equals(declaration)) {
factory = CharacterLiteralAnnotationTerm.FACTORY;
} else if (unit.getBooleanDeclaration().equals(declaration)) {
factory = BooleanLiteralAnnotationTerm.FACTORY;
} else if (unit.getFloatDeclaration().equals(declaration)) {
factory = FloatLiteralAnnotationTerm.FACTORY;
} else if (Decl.isEnumeratedTypeWithAnonCases(iteratedType)) {
factory = ObjectLiteralAnnotationTerm.FACTORY;
} else if (Decl.isAnnotationClass(declaration)) {
t.addError("compiler bug: iterables of annotation classes or annotation constructors not supported as literal " + (checkingDefaults ? "defaulted parameters" : "arguments"));
return null;
} else if (iteratedType.isSubtypeOf(((TypeDeclaration)unit.getLanguageModuleDeclarationDeclaration("Declaration")).getType())) {
factory = DeclarationLiteralAnnotationTerm.FACTORY;
} else {
throw new RuntimeException();
}
CollectionLiteralAnnotationTerm result = this.elements;