### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java,v retrieving revision 1.86 diff -u -r1.86 ClassFileReader.java --- compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java 27 Jun 2008 16:04:13 -0000 1.86 +++ compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java 23 Dec 2008 17:13:27 -0000 @@ -806,6 +806,9 @@ // meta-annotations if ((getTagBits() & OnlyStructuralTagBits) != (newClassFile.getTagBits() & OnlyStructuralTagBits)) return true; + // annotations + if (hasStructuralAnnotationChanges(getAnnotations(), newClassFile.getAnnotations())) + return true; // generic signature if (!CharOperation.equals(getGenericSignature(), newClassFile.getGenericSignature())) @@ -923,6 +926,33 @@ } } +private boolean hasStructuralAnnotationChanges(IBinaryAnnotation[] currentAnnotations, IBinaryAnnotation[] otherAnnotations) { + if (currentAnnotations == otherAnnotations) + return false; + + int currentAnnotationsLength = currentAnnotations == null ? 0 : currentAnnotations.length; + int otherAnnotationsLength = otherAnnotations == null ? 0 : otherAnnotations.length; + if (currentAnnotationsLength != otherAnnotationsLength) + return true; + for (int i = 0; i < currentAnnotationsLength; i++) { + if (!CharOperation.equals(currentAnnotations[i].getTypeName(), otherAnnotations[i].getTypeName())) + return true; + IBinaryElementValuePair[] currentPairs = currentAnnotations[i].getElementValuePairs(); + IBinaryElementValuePair[] otherPairs = otherAnnotations[i].getElementValuePairs(); + int currentPairsLength = currentPairs == null ? 0 : currentPairs.length; + int otherPairsLength = otherPairs == null ? 0 : otherPairs.length; + if (currentPairsLength != otherPairsLength) + return true; + for (int j = 0; j < currentPairsLength; j++) { + if (!CharOperation.equals(currentPairs[j].getName(), otherPairs[j].getName())) + return true; + if (!currentPairs[j].getValue().equals(otherPairs[j].getValue())) + return true; + } + } + return false; +} + private boolean hasStructuralFieldChanges(FieldInfo currentFieldInfo, FieldInfo otherFieldInfo) { // generic signature if (!CharOperation.equals(currentFieldInfo.getGenericSignature(), otherFieldInfo.getGenericSignature())) @@ -931,6 +961,8 @@ return true; if ((currentFieldInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherFieldInfo.getTagBits() & TagBits.AnnotationDeprecated)) return true; + if (hasStructuralAnnotationChanges(currentFieldInfo.getAnnotations(), otherFieldInfo.getAnnotations())) + return true; if (!CharOperation.equals(currentFieldInfo.getName(), otherFieldInfo.getName())) return true; if (!CharOperation.equals(currentFieldInfo.getTypeName(), otherFieldInfo.getTypeName())) @@ -976,6 +1008,8 @@ return true; if ((currentMethodInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherMethodInfo.getTagBits() & TagBits.AnnotationDeprecated)) return true; + if (hasStructuralAnnotationChanges(currentMethodInfo.getAnnotations(), otherMethodInfo.getAnnotations())) + return true; if (!CharOperation.equals(currentMethodInfo.getSelector(), otherMethodInfo.getSelector())) return true; if (!CharOperation.equals(currentMethodInfo.getMethodDescriptor(), otherMethodInfo.getMethodDescriptor()))