]> source.dussan.org Git - aspectj.git/commitdiff
246281: test and fix
authoraclement <aclement>
Thu, 4 Sep 2008 21:06:16 +0000 (21:06 +0000)
committeraclement <aclement>
Thu, 4 Sep 2008 21:06:16 +0000 (21:06 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java

index f2c639bf8eecfc78048e2ba5bdb9588bc89b6fee..a5ad9ed6d41db5a2e42e97524163bb1bb2f53b94 100644 (file)
@@ -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();