if (this.anonymousTypes != null) {
if(this.fieldDeclaration.initialization == null) {
for (int i = 0; i < this.anonymousTypeCount; i++){
RecoveredType recoveredType = this.anonymousTypes[i];
TypeDeclaration typeDeclaration = recoveredType.typeDeclaration;
if(typeDeclaration.declarationSourceEnd == 0) {
typeDeclaration.declarationSourceEnd = this.fieldDeclaration.declarationSourceEnd;
typeDeclaration.bodyEnd = this.fieldDeclaration.declarationSourceEnd;
}
if (recoveredType.preserveContent){
TypeDeclaration anonymousType = recoveredType.updatedTypeDeclaration(depth + 1, knownTypes);
if (anonymousType != null) {
this.fieldDeclaration.initialization = anonymousType.allocation;
int end = anonymousType.declarationSourceEnd;
if (end > this.fieldDeclaration.declarationSourceEnd) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=307337
this.fieldDeclaration.declarationSourceEnd = end;
this.fieldDeclaration.declarationEnd = end;
}
}
}
}
if (this.anonymousTypeCount > 0) this.fieldDeclaration.bits |= ASTNode.HasLocalType;
} else if(this.fieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
// fieldDeclaration is an enum constant
for (int i = 0; i < this.anonymousTypeCount; i++){
RecoveredType recoveredType = this.anonymousTypes[i];
TypeDeclaration typeDeclaration = recoveredType.typeDeclaration;
if(typeDeclaration.declarationSourceEnd == 0) {
typeDeclaration.declarationSourceEnd = this.fieldDeclaration.declarationSourceEnd;
typeDeclaration.bodyEnd = this.fieldDeclaration.declarationSourceEnd;
}
// if the enum is recovered then enum constants must be recovered too.