From 988458bbc0c8f2b06bd18c56075f153b24d93f9b Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 4 Sep 2008 21:06:16 +0000 Subject: [PATCH] 246281: test and fix --- .../ajdt/internal/core/builder/AjState.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java index f2c639bf8..a5ad9ed6d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -41,6 +41,7 @@ import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation; import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; +import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryField; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryMethod; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType; @@ -1341,6 +1342,27 @@ public class AjState implements CompilerConfigurationChangeFlags { return true; } + // have annotations changed on the type? + IBinaryAnnotation[] newAnnos = reader.getAnnotations(); + if (newAnnos == null || newAnnos.length == 0) { + if (existingType.annotations != null && existingType.annotations.length != 0) { + return true; + } + } else { + IBinaryAnnotation[] existingAnnos = existingType.annotations; + if (existingAnnos == null || existingAnnos.length != newAnnos.length) { + return true; + } + // Does not allow for an order switch + // Does not cope with a change in values set on the annotation (hard to create a testcase where this is a problem tho) + for (int i = 0; i < newAnnos.length; i++) { + if (!CharOperation.equals(newAnnos[i].getTypeName(), existingAnnos[i].getTypeName())) { + return true; + } + } + + } + // interfaces char[][] existingIfs = existingType.interfaces; char[][] newIfsAsChars = reader.getInterfaceNames(); -- 2.39.5