Browse Source

test and initial patches for 141556

tags/pre_pr_153572
aclement 18 years ago
parent
commit
b7ccac980f

+ 4
- 0
ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java View File

@@ -257,6 +257,10 @@ public class AspectJBuildManager implements BuildManager {
public void setBuildModelMode(boolean b) {
buildModelMode = b;
}
public CompilerAdapter getCompilerAdapter() {
return compilerAdapter;
}

}


+ 4
- 0
ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java View File

@@ -646,6 +646,10 @@ public class CompilerAdapter {
buildManager.setState(buildState);
buildManager.setStructureModel(buildState.getStructureModel());
}
public IMessageHandler getMessageHandler() {
return messageHandler;
}

public boolean wasFullBuild() {
return buildManager.wasFullBuild();

+ 11
- 0
tests/multiIncremental/PR141556/base/pkg/A.aj View File

@@ -0,0 +1,11 @@
package pkg;

public aspect A {

pointcut p() : execution(* C.method1());
before(): p() {
System.out.println(thisJoinPoint);
}

}

+ 8
- 0
tests/multiIncremental/PR141556/base/pkg/C.java View File

@@ -0,0 +1,8 @@
package pkg;

public class C {

public void method1() {
}

}

+ 11
- 0
tests/multiIncremental/PR141556/inc1/pkg/A.aj View File

@@ -0,0 +1,11 @@
package pkg;

public aspect A {

point cut p() : execution(* C.method1());
before(): p() {
System.out.println(thisJoinPoint);
}
}

+ 11
- 0
tests/multiIncremental/PR141556/inc2/pkg/A.aj View File

@@ -0,0 +1,11 @@
package pkg;

public aspect A {

pointcut p() : execution(* C.method1());
before(): p() {
System.out.println(thisJoinPoint);
}
}

+ 11
- 0
tests/multiIncremental/PR141556/inc3/pkg/A.aj View File

@@ -0,0 +1,11 @@
package pkg;

public aspect A {

pointcut p() : execution(* C.method1());
before(): p() {
System.out.println(thisJoinPoint);
}
}

+ 1
- 0
tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java View File

@@ -27,6 +27,7 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends
super.tearDown();
AjState.FORCE_INCREMENTAL_DURING_TESTING = false;
configureBuildStructureModel(false);
MyBuildOptionsAdapter.reset();
}

public void build(String projectName) {

+ 10
- 0
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java View File

@@ -28,11 +28,13 @@ import org.aspectj.ajde.ErrorHandler;
import org.aspectj.ajde.OutputLocationManager;
import org.aspectj.ajde.ProjectPropertiesAdapter;
import org.aspectj.ajde.TaskListManager;
import org.aspectj.ajde.internal.AspectJBuildManager;
import org.aspectj.ajdt.internal.core.builder.AbstractStateListener;
import org.aspectj.ajdt.internal.core.builder.AjState;
import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager;
import org.aspectj.asm.AsmManager;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.tools.ajc.Ajc;
@@ -222,6 +224,14 @@ public class AjdeInteractionTestbed extends TestCase {
} catch (InterruptedException ie) {}
}
public static void setMessageHandler(IMessageHandler handler) {
Ajde.getDefault().setMessageHandler(handler);
}
public static IMessageHandler getMessageHandler() {
AspectJBuildManager buildManager = (AspectJBuildManager) Ajde.getDefault().getBuildManager();
return buildManager.getCompilerAdapter().getMessageHandler();
}
// public static boolean lastCompileDefaultedToBatch() {
// return MyTaskListManager.defaultedToBatch();
// }

+ 49
- 0
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java View File

@@ -33,7 +33,10 @@ import org.aspectj.asm.IRelationshipMap;
import org.aspectj.asm.internal.JDTLikeHandleProvider;
import org.aspectj.asm.internal.Relationship;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.IMessageHolder;
import org.aspectj.tools.ajc.Ajc;
import org.aspectj.weaver.Lint.LintMessage;

/**
* The superclass knows all about talking through Ajde to the compiler.
@@ -1423,6 +1426,52 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
configureBuildStructureModel(false);
}
// public void testDontLoseXlintWarnings_pr141556() {
// configureNonStandardCompileOptions("-Xlint:warning");
// initialiseProject("PR141556");
// build("PR141556");
// checkWasFullBuild();
// String warningMessage = "can not build thisJoinPoint " +
// "lazily for this advice since it has no suitable guard " +
// "[Xlint:noGuardForLazyTjp]";
// assertEquals("warning message should be '" + warningMessage + "'",
// warningMessage,
// ((IMessage)MyTaskListManager.getWarningMessages().get(0))
// .getMessage());
//
// // add a space to the Aspect but dont do a build
// alter("PR141556","inc1");
// // remove the space so that the Aspect is exactly as it was
// alter("PR141556","inc2");
// // build the project and we should not have lost the xlint warning
// build("PR141556");
// checkWasntFullBuild();
// assertTrue("there should still be a warning message ",
// !MyTaskListManager.getWarningMessages().isEmpty());
// assertEquals("warning message should be '" + warningMessage + "'",
// warningMessage,
// ((IMessage)MyTaskListManager.getWarningMessages().get(0))
// .getMessage());
// }

public void testLintMessage_pr141564() {
configureNonStandardCompileOptions("-Xlint:warning");
initialiseProject("PR141556");
build("PR141556");
IMessageHandler handler = AjdeManager.getMessageHandler();
assertTrue("expected the handler to be an IMessageHolder but wasn't ",
handler instanceof IMessageHolder);
IMessage[] msgs = ((IMessageHolder)AjdeManager.getMessageHandler()).getMessages(null,true);
IMessage msg = msgs[msgs.length-1];
assertTrue("expected message to be a LintMessage but wasn't",
msg instanceof LintMessage);
assertTrue("expected message to be noGuardForLazyTjp xlint message but" +
" instead was " + ((LintMessage)msg).getKind().toString(),
((LintMessage)msg).isNoGuardForLazyTjp());
assertTrue("expected message to be against file in project 'PR141556' but wasn't",
msg.getSourceLocation().getSourceFile().getAbsolutePath().indexOf("PR141556") != -1);
}
public void testAdviceDidNotMatch_pr152589() {
initialiseProject("PR152589");
build("PR152589");

+ 34
- 2
weaver/src/org/aspectj/weaver/Lint.java View File

@@ -283,7 +283,8 @@ public class Lint {
String text = MessageFormat.format(message, new Object[] {info} );
text += " [Xlint:" + name + "]";
world.getMessageHandler().handleMessage(new Message(text, kind, null, location));
world.getMessageHandler().handleMessage(
new LintMessage(text, kind, location,null,getLintKind(name)));
}

public void signal(String[] infos, ISourceLocation location, ISourceLocation[] extraLocations) {
@@ -292,7 +293,38 @@ public class Lint {
String text = MessageFormat.format(message, infos );
text += " [Xlint:" + name + "]";
world.getMessageHandler().handleMessage(
new Message(text, "", kind, location, null, extraLocations));
new LintMessage(text, kind, location,extraLocations,getLintKind(name)));
}
}
public class LintMessage extends Message {
private Lint.Kind lintKind;
public LintMessage(
String message,
IMessage.Kind messageKind,
ISourceLocation location,
ISourceLocation[] extraLocations,
Lint.Kind lintKind) {
super(message,"",messageKind,location,null,extraLocations);
this.lintKind = lintKind;
}
/**
* @return Returns the Lint kind of this message
*/
public Lint.Kind getLintKind() {
return lintKind;
}
/**
* @return true if this message is a noGuardForLazyTjp xlint
* message and false otherwise
*/
public boolean isNoGuardForLazyTjp() {
return lintKind.equals(noGuardForLazyTjp);
}
}
}

Loading…
Cancel
Save