IBinaryField[] existingFs = existingType.binFields;
if (newFields.length != existingFs.length) {
return true;
}
new_field_loop: for (int i = 0; i < newFields.length; i++) {
IBinaryField field = newFields[i];
char[] fieldName = field.getName();
for (int j = 0; j < existingFs.length; j++) {
if (CharOperation.equals(existingFs[j].getName(), fieldName)) {
IBinaryField existing = existingFs[j];
if (!modifiersEqual(field.getModifiers(), existing.getModifiers())) {
return true;
}
if (!CharOperation.equals(existing.getTypeName(), field.getTypeName())) {
return true;
}
char[] existingGSig = existing.getGenericSignature();
char[] fieldGSig = field.getGenericSignature();
if ((existingGSig == null && fieldGSig != null) || (existingGSig != null && fieldGSig == null)) {
return true;
}
if (existingGSig != null) {
if (!CharOperation.equals(existingGSig, fieldGSig)) {
return true;
}
}
continue new_field_loop;
}
}
return true;
}
// methods
// CompactMemberStructureRepresentation[] existingMethods = existingType.methods;
IBinaryMethod[] newMethods = reader.getMethods();
if (newMethods == null) {
newMethods = CompactTypeStructureRepresentation.NoMethod;
}
// all redundant for now ... could be an optimization at some point...
// Ctors in a non-static inner type have an 'extra parameter' of the enclosing type.
// If skippableDescriptorPrefix gets set here then it is set to the descriptor portion
// for this 'extra parameter'. For an inner class of pkg.Foo the skippable descriptor
// prefix will be '(Lpkg/Foo;' - so later when comparing <init> methods we know what to
// compare.
// IF THIS CODE NEEDS TO GET MORE COMPLICATED, I THINK ITS WORTH RIPPING IT ALL OUT AND
// CREATING THE STRUCTURAL CHANGES OBJECT BASED ON CLASSREADER OUTPUT RATHER THAN
// THE RESOLVEDTYPE - THEN THERE WOULD BE NO NEED TO TREAT SOME METHODS IN A PECULIAR
// WAY.
// char[] skippableDescriptorPrefix = null;
// char[] enclosingTypeName = reader.getEnclosingTypeName();
// boolean isStaticType = Modifier.isStatic(reader.getModifiers());
// if (!isStaticType && enclosingTypeName!=null) {
// StringBuffer sb = new StringBuffer();
// sb.append("(L").append(new String(enclosingTypeName)).append(";");
// skippableDescriptorPrefix = sb.toString().toCharArray();
// }
//
//
// // remove the aspectOf, hasAspect, clinit and ajc$XXX methods
// // from those we compare with the existing methods - bug 129163
// List nonGenMethods = new ArrayList();
// for (int i = 0; i < newMethods.length; i++) {
// IBinaryMethod method = newMethods[i];
// // if ((method.getModifiers() & 0x1000)!=0) continue; // 0x1000 => synthetic - will cause us to skip access$0 - is this
// always safe?
// char[] methodName = method.getSelector();
// // if (!CharOperation.equals(methodName,NameMangler.METHOD_ASPECTOF) &&
// // !CharOperation.equals(methodName,NameMangler.METHOD_HASASPECT) &&
// // !CharOperation.equals(methodName,NameMangler.STATIC_INITIALIZER) &&
// // !CharOperation.prefixEquals(NameMangler.AJC_DOLLAR_PREFIX,methodName) &&
// // !CharOperation.prefixEquals(NameMangler.CLINIT,methodName)) {
// nonGenMethods.add(method);
// // }
// }
IBinaryMethod[] existingMs = existingType.binMethods;
if (newMethods.length != existingMs.length) {
return true;
}
new_method_loop: for (int i = 0; i < newMethods.length; i++) {
IBinaryMethod method = newMethods[i];
char[] methodName = method.getSelector();
for (int j = 0; j < existingMs.length; j++) {
if (CharOperation.equals(existingMs[j].getSelector(), methodName)) {
// candidate match
if (!CharOperation.equals(method.getMethodDescriptor(), existingMs[j].getMethodDescriptor())) {
// ok, the descriptors don't match, but is this a funky ctor on a non-static inner
// type?
// boolean mightBeOK =
// skippableDescriptorPrefix!=null && // set for inner types
// CharOperation.equals(methodName,NameMangler.INIT) && // ctor
// CharOperation.prefixEquals(skippableDescriptorPrefix,method.getMethodDescriptor()); // checking for
// prefix on the descriptor
// if (mightBeOK) {
// // OK, so the descriptor starts something like '(Lpkg/Foo;' - we now may need to look at the rest of the
// // descriptor if it takes >1 parameter.
// // eg. could be (Lpkg/C;Ljava/lang/String;) where the skippablePrefix is (Lpkg/C;
// char [] md = method.getMethodDescriptor();
// char[] remainder = CharOperation.subarray(md, skippableDescriptorPrefix.length, md.length);
// if (CharOperation.equals(remainder,BRACKET_V)) continue new_method_loop; // no other parameters to worry
// about
// char[] comparableSig = CharOperation.subarray(existingMethods[j].signature, 1,
// existingMethods[j].signature.length);
// boolean match = CharOperation.equals(comparableSig, remainder);
// if (match) continue new_method_loop;
// }
continue; // might be overloading
} else {
// matching sigs
IBinaryMethod existing = existingMs[j];
if (!modifiersEqual(method.getModifiers(), existing.getModifiers())) {
return true;
}
if (exceptionClausesDiffer(existing, method)) {
return true;
}
char[] existingGSig = existing.getGenericSignature();
char[] methodGSig = method.getGenericSignature();
if ((existingGSig == null && methodGSig != null) || (existingGSig != null && methodGSig == null)) {
return true;
}
if (existingGSig != null) {