int length = this.acceptedConstructors.size();
if(length == 0) return;
HashtableOfObject onDemandFound = new HashtableOfObject();
ArrayList deferredProposals = null;
if (DEFER_QUALIFIED_PROPOSALS) {
deferredProposals = new ArrayList();
}
try {
next : for (int i = 0; i < length; i++) {
// does not check cancellation for every types to avoid performance loss
if ((i % CHECK_CANCEL_FREQUENCY) == 0) checkCancel();
AcceptedConstructor acceptedConstructor = (AcceptedConstructor)this.acceptedConstructors.elementAt(i);
final int typeModifiers = acceptedConstructor.typeModifiers;
final char[] packageName = acceptedConstructor.packageName;
final char[] simpleTypeName = acceptedConstructor.simpleTypeName;
final int modifiers = acceptedConstructor.modifiers;
final int parameterCount = acceptedConstructor.parameterCount;
final char[] signature = acceptedConstructor.signature;
final char[][] parameterTypes = acceptedConstructor.parameterTypes;
final char[][] parameterNames = acceptedConstructor.parameterNames;
final int extraFlags = acceptedConstructor.extraFlags;
final int accessibility = acceptedConstructor.accessibility;
boolean proposeType = hasArrayTypeAsExpectedSuperTypes() || (extraFlags & ExtraFlags.HasNonPrivateStaticMemberTypes) != 0;
char[] fullyQualifiedName = CharOperation.concat(packageName, simpleTypeName, '.');
Object knownTypeKind = this.knownTypes.get(fullyQualifiedName);
if (knownTypeKind != null) {
if (knownTypeKind == KNOWN_TYPE_WITH_KNOWN_CONSTRUCTORS) {
// the type and its constructors are already accepted
continue next;
}
// this type is already accepted
proposeType = false;
} else {
this.knownTypes.put(fullyQualifiedName, KNOWN_TYPE_WITH_UNKNOWN_CONSTRUCTORS);
}
boolean proposeConstructor = true;
if (this.options.checkVisibility) {
if((modifiers & ClassFileConstants.AccPublic) == 0) {
if((modifiers & ClassFileConstants.AccPrivate) != 0) {
if (!proposeType) continue next;
proposeConstructor = false;
} else {
if (this.currentPackageName == null) {
initializePackageCache();
}
if(!CharOperation.equals(packageName, this.currentPackageName)) {
if((typeModifiers & ClassFileConstants.AccAbstract) == 0 ||
(modifiers & ClassFileConstants.AccProtected) == 0) {
if (!proposeType) continue next;
proposeConstructor = false;
}
}
}
}
}
acceptedConstructor.fullyQualifiedName = fullyQualifiedName;
acceptedConstructor.proposeType = proposeType;
acceptedConstructor.proposeConstructor = proposeConstructor;
if(!this.importCachesInitialized) {
initializeImportCaches();
}
for (int j = 0; j < this.importCacheCount; j++) {
char[][] importName = this.importsCache[j];
if(CharOperation.equals(simpleTypeName, importName[0])) {
if (proposeType) {
proposeType(
packageName,
simpleTypeName,
typeModifiers,
accessibility,
simpleTypeName,
fullyQualifiedName,
!CharOperation.equals(fullyQualifiedName, importName[1]),
scope);
}
if (proposeConstructor && !Flags.isEnum(typeModifiers)) {
boolean isQualified = !CharOperation.equals(fullyQualifiedName, importName[1]);
if (!isQualified) {
proposeConstructor(
simpleTypeName,
parameterCount,
signature,
parameterTypes,
parameterNames,
modifiers,
packageName,
typeModifiers,
accessibility,
simpleTypeName,
fullyQualifiedName,
isQualified,
scope,
extraFlags);
} else {
acceptedConstructor.mustBeQualified = true;
if (DEFER_QUALIFIED_PROPOSALS) {
deferredProposals.add(acceptedConstructor);
} else {
proposeConstructor(acceptedConstructor, scope);
}
}
}
continue next;
}
}
if (CharOperation.equals(this.currentPackageName, packageName)) {
if (proposeType) {
proposeType(
packageName,
simpleTypeName,
typeModifiers,
accessibility,
simpleTypeName,
fullyQualifiedName,
false,
scope);
}
if (proposeConstructor && !Flags.isEnum(typeModifiers)) {
proposeConstructor(
simpleTypeName,
parameterCount,
signature,
parameterTypes,
parameterNames,
modifiers,
packageName,
typeModifiers,
accessibility,
simpleTypeName,
fullyQualifiedName,
false,
scope,
extraFlags);
}
continue next;
} else {
char[] fullyQualifiedEnclosingTypeOrPackageName = null;
AcceptedConstructor foundConstructor = null;
if((foundConstructor = (AcceptedConstructor)onDemandFound.get(simpleTypeName)) == null) {
for (int j = 0; j < this.onDemandImportCacheCount; j++) {
ImportBinding importBinding = this.onDemandImportsCache[j];
char[][] importName = importBinding.compoundName;
char[] importFlatName = CharOperation.concatWith(importName, '.');
if(fullyQualifiedEnclosingTypeOrPackageName == null) {
fullyQualifiedEnclosingTypeOrPackageName = packageName;
}
if(CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName, importFlatName)) {
if(importBinding.isStatic()) {
if((typeModifiers & ClassFileConstants.AccStatic) != 0) {
onDemandFound.put(
simpleTypeName,
acceptedConstructor);
continue next;
}
} else {
onDemandFound.put(
simpleTypeName,
acceptedConstructor);
continue next;
}
}