From 89d66dc89110db0f89538a7b78308db61e5539cc Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 21 Feb 2006 16:07:04 +0000 Subject: [PATCH] test and fix for 128618 (from helen) - message handling. --- .../compiler/WeaverMessageHandler.java | 12 ++++++++++++ .../PR128618_1/base/ras/FFDC.aj | 11 +++++++++++ .../PR128618_2/base/mainpackage/MainClass.java | 8 ++++++++ .../base/ras/concrete/SubFFDCAspect.aj | 9 +++++++++ .../PR128618_2/inc1/mainpackage/MainClass.java | 11 +++++++++++ .../tools/MultiProjectIncrementalTests.java | 18 ++++++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 tests/multiIncremental/PR128618_1/base/ras/FFDC.aj create mode 100644 tests/multiIncremental/PR128618_2/base/mainpackage/MainClass.java create mode 100644 tests/multiIncremental/PR128618_2/base/ras/concrete/SubFFDCAspect.aj create mode 100644 tests/multiIncremental/PR128618_2/inc1/mainpackage/MainClass.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java index d44ce2ed6..8b9a9eeff 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java @@ -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 index 000000000..03d2486e7 --- /dev/null +++ b/tests/multiIncremental/PR128618_1/base/ras/FFDC.aj @@ -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 index 000000000..c5f4c962c --- /dev/null +++ b/tests/multiIncremental/PR128618_2/base/mainpackage/MainClass.java @@ -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 index 000000000..33f702efb --- /dev/null +++ b/tests/multiIncremental/PR128618_2/base/ras/concrete/SubFFDCAspect.aj @@ -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 index 000000000..c4d6215aa --- /dev/null +++ b/tests/multiIncremental/PR128618_2/inc1/mainpackage/MainClass.java @@ -0,0 +1,11 @@ +package mainpackage; + +public class MainClass { + + public void amethod() { + } + + public void anotherMethod() { + + } +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 7a13abed5..5427987c5 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -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"); -- 2.39.5