LocalTypeBinding anonymousType = buildLocalType(enclosingType, enclosingType.fPackage);
anonymousType.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; // tag all anonymous types as used locally
if (supertype.isInterface()) {
anonymousType.superclass = getJavaLangObject();
anonymousType.superInterfaces = new ReferenceBinding[] { supertype };
TypeReference typeReference = this.referenceContext.allocation.type;
if (typeReference != null) {
if ((supertype.tagBits & TagBits.HasDirectWildcard) != 0) {
problemReporter().superTypeCannotUseWildcard(anonymousType, typeReference, supertype);
anonymousType.tagBits |= TagBits.HierarchyHasProblems;
anonymousType.superInterfaces = Binding.NO_SUPERINTERFACES;
}
}
} else {
anonymousType.superclass = supertype;
anonymousType.superInterfaces = Binding.NO_SUPERINTERFACES;
TypeReference typeReference = this.referenceContext.allocation.type;
if (typeReference != null) { // no check for enum constant body
if (supertype.erasure().id == TypeIds.T_JavaLangEnum) {
problemReporter().cannotExtendEnum(anonymousType, typeReference, supertype);
anonymousType.tagBits |= TagBits.HierarchyHasProblems;
anonymousType.superclass = getJavaLangObject();