]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 128618 (from helen) - message handling.
authoraclement <aclement>
Tue, 21 Feb 2006 16:07:04 +0000 (16:07 +0000)
committeraclement <aclement>
Tue, 21 Feb 2006 16:07:04 +0000 (16:07 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java
tests/multiIncremental/PR128618_1/base/ras/FFDC.aj [new file with mode: 0644]
tests/multiIncremental/PR128618_2/base/mainpackage/MainClass.java [new file with mode: 0644]
tests/multiIncremental/PR128618_2/base/ras/concrete/SubFFDCAspect.aj [new file with mode: 0644]
tests/multiIncremental/PR128618_2/inc1/mainpackage/MainClass.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index d44ce2ed6785c53bec5ace439c22992974d45b71..8b9a9eeff0c1954eab107d8901fbc2826a200afe 100644 (file)
@@ -18,6 +18,7 @@ import org.aspectj.bridge.AbortException;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.IMessageHandler;
 import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.SourceLocation;
 import org.aspectj.bridge.IMessage.Kind;
 import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
 import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -62,6 +63,17 @@ public class WeaverMessageHandler implements IMessageHandler {
                          //  throw new RuntimeException("Primary source location must match the file we are currently processing!");
                        }
                }
+               // bug 128618 - want to do a similar thing as in bug 62073 above, however
+               // we're not an EclipseSourceLocation we're a SourceLocation.
+               if (sLoc instanceof SourceLocation) {
+                       SourceLocation sl = (SourceLocation)sLoc;
+                       if (currentlyWeaving != null && sl.getSourceFile() != null) {
+                               if (!String.valueOf(currentlyWeaving.getFileName()).equals( sl.getSourceFile().getAbsolutePath())) {
+                                       return sink.handleMessage(message);
+                                       //throw new RuntimeException("Primary source location must match the file we are currently processing!");
+                               }
+                       }
+               }
                
                CompilationResult problemSource = currentlyWeaving;
                if (problemSource == null) {
diff --git a/tests/multiIncremental/PR128618_1/base/ras/FFDC.aj b/tests/multiIncremental/PR128618_1/base/ras/FFDC.aj
new file mode 100644 (file)
index 0000000..03d2486
--- /dev/null
@@ -0,0 +1,11 @@
+package ras;
+
+public abstract aspect FFDC {
+
+       protected abstract pointcut ffdcScope ();
+       
+       before() : ffdcScope() {
+               
+       }
+       
+}
diff --git a/tests/multiIncremental/PR128618_2/base/mainpackage/MainClass.java b/tests/multiIncremental/PR128618_2/base/mainpackage/MainClass.java
new file mode 100644 (file)
index 0000000..c5f4c96
--- /dev/null
@@ -0,0 +1,8 @@
+package mainpackage;
+
+public class MainClass {
+
+       public void amethod() {
+       }
+            
+}
diff --git a/tests/multiIncremental/PR128618_2/base/ras/concrete/SubFFDCAspect.aj b/tests/multiIncremental/PR128618_2/base/ras/concrete/SubFFDCAspect.aj
new file mode 100644 (file)
index 0000000..33f702e
--- /dev/null
@@ -0,0 +1,9 @@
+package ras.concrete;
+
+import ras.FFDC;
+
+public aspect SubFFDCAspect extends FFDC {
+
+       protected pointcut ffdcScope() : execution(* somemethod(..));
+
+}
diff --git a/tests/multiIncremental/PR128618_2/inc1/mainpackage/MainClass.java b/tests/multiIncremental/PR128618_2/inc1/mainpackage/MainClass.java
new file mode 100644 (file)
index 0000000..c4d6215
--- /dev/null
@@ -0,0 +1,11 @@
+package mainpackage;
+
+public class MainClass {
+
+       public void amethod() {
+       }
+            
+       public void anotherMethod() {
+               
+       }
+}
index 7a13abed55272c34e7740a0a7da9825cdbe3d784..5427987c5244e6979766151736f0b273c5889360 100644 (file)
@@ -314,6 +314,24 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                assertTrue("Should be no errors, but got "+MyTaskListManager.getErrorMessages(),MyTaskListManager.getErrorMessages().size()==0);                
        }
        
+       public void testPr128618() {
+               initialiseProject("PR128618_1");
+               initialiseProject("PR128618_2");
+               configureNewProjectDependency("PR128618_2","PR128618_1");
+               assertTrue("there should be no warning messages before we start",
+                               MyTaskListManager.getWarningMessages().isEmpty());
+               build("PR128618_1");
+               build("PR128618_2");
+               IMessage msg = (IMessage)(MyTaskListManager.getWarningMessages().get(0));
+               assertEquals("warning should be against the FFDC.aj resource","FFDC.aj",msg.getSourceLocation().getSourceFile().getName());
+               alter("PR128618_2","inc1");
+               build("PR128618_2");
+               checkWasntFullBuild();
+               IMessage msg2 = (IMessage)(MyTaskListManager.getWarningMessages().get(0));
+               assertEquals("warning should be against the FFDC.aj resource","FFDC.aj",msg2.getSourceLocation().getSourceFile().getName());
+               assertFalse("a new warning message should have been generated", msg.equals(msg2));
+       }
+       
        public void testPr92837() {
                initialiseProject("PR92837");
                build("PR92837");