View | Details | Raw Unified | Return to bug 149768 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java (+34 lines)
Lines 806-811 Link Here
806
		// meta-annotations
806
		// meta-annotations
807
		if ((getTagBits() & OnlyStructuralTagBits) != (newClassFile.getTagBits() & OnlyStructuralTagBits))
807
		if ((getTagBits() & OnlyStructuralTagBits) != (newClassFile.getTagBits() & OnlyStructuralTagBits))
808
			return true;
808
			return true;
809
		// annotations
810
		if (hasStructuralAnnotationChanges(getAnnotations(), newClassFile.getAnnotations()))
811
			return true;
809
812
810
		// generic signature
813
		// generic signature
811
		if (!CharOperation.equals(getGenericSignature(), newClassFile.getGenericSignature()))
814
		if (!CharOperation.equals(getGenericSignature(), newClassFile.getGenericSignature()))
Lines 923-928 Link Here
923
	}
926
	}
924
}
927
}
925
928
929
private boolean hasStructuralAnnotationChanges(IBinaryAnnotation[] currentAnnotations, IBinaryAnnotation[] otherAnnotations) {
930
	if (currentAnnotations == otherAnnotations)
931
		return false;
932
933
	int currentAnnotationsLength = currentAnnotations == null ? 0 : currentAnnotations.length;
934
	int otherAnnotationsLength = otherAnnotations == null ? 0 : otherAnnotations.length;
935
	if (currentAnnotationsLength != otherAnnotationsLength)
936
		return true;
937
	for (int i = 0; i < currentAnnotationsLength; i++) {
938
		if (!CharOperation.equals(currentAnnotations[i].getTypeName(), otherAnnotations[i].getTypeName()))
939
			return true;
940
		IBinaryElementValuePair[] currentPairs = currentAnnotations[i].getElementValuePairs();
941
		IBinaryElementValuePair[] otherPairs = otherAnnotations[i].getElementValuePairs();
942
		int currentPairsLength = currentPairs == null ? 0 : currentPairs.length;
943
		int otherPairsLength = otherPairs == null ? 0 : otherPairs.length;
944
		if (currentPairsLength != otherPairsLength)
945
			return true;
946
		for (int j = 0; j < currentPairsLength; j++) {
947
			if (!CharOperation.equals(currentPairs[j].getName(), otherPairs[j].getName()))
948
				return true;
949
			if (!currentPairs[j].getValue().equals(otherPairs[j].getValue()))
950
				return true;
951
		}
952
	}
953
	return false;
954
}
955
926
private boolean hasStructuralFieldChanges(FieldInfo currentFieldInfo, FieldInfo otherFieldInfo) {
956
private boolean hasStructuralFieldChanges(FieldInfo currentFieldInfo, FieldInfo otherFieldInfo) {
927
	// generic signature
957
	// generic signature
928
	if (!CharOperation.equals(currentFieldInfo.getGenericSignature(), otherFieldInfo.getGenericSignature()))
958
	if (!CharOperation.equals(currentFieldInfo.getGenericSignature(), otherFieldInfo.getGenericSignature()))
Lines 931-936 Link Here
931
		return true;
961
		return true;
932
	if ((currentFieldInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherFieldInfo.getTagBits() & TagBits.AnnotationDeprecated))
962
	if ((currentFieldInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherFieldInfo.getTagBits() & TagBits.AnnotationDeprecated))
933
		return true;
963
		return true;
964
	if (hasStructuralAnnotationChanges(currentFieldInfo.getAnnotations(), otherFieldInfo.getAnnotations()))
965
		return true;
934
	if (!CharOperation.equals(currentFieldInfo.getName(), otherFieldInfo.getName()))
966
	if (!CharOperation.equals(currentFieldInfo.getName(), otherFieldInfo.getName()))
935
		return true;
967
		return true;
936
	if (!CharOperation.equals(currentFieldInfo.getTypeName(), otherFieldInfo.getTypeName()))
968
	if (!CharOperation.equals(currentFieldInfo.getTypeName(), otherFieldInfo.getTypeName()))
Lines 976-981 Link Here
976
		return true;
1008
		return true;
977
	if ((currentMethodInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherMethodInfo.getTagBits() & TagBits.AnnotationDeprecated))
1009
	if ((currentMethodInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherMethodInfo.getTagBits() & TagBits.AnnotationDeprecated))
978
		return true;
1010
		return true;
1011
	if (hasStructuralAnnotationChanges(currentMethodInfo.getAnnotations(), otherMethodInfo.getAnnotations()))
1012
		return true;
979
	if (!CharOperation.equals(currentMethodInfo.getSelector(), otherMethodInfo.getSelector()))
1013
	if (!CharOperation.equals(currentMethodInfo.getSelector(), otherMethodInfo.getSelector()))
980
		return true;
1014
		return true;
981
	if (!CharOperation.equals(currentMethodInfo.getMethodDescriptor(), otherMethodInfo.getMethodDescriptor()))
1015
	if (!CharOperation.equals(currentMethodInfo.getMethodDescriptor(), otherMethodInfo.getMethodDescriptor()))

Return to bug 149768