import org.aspectj.ajde.core.AjCompiler;
import org.aspectj.ajde.core.ICompilerConfiguration;
import org.aspectj.ajde.core.IOutputLocationManager;
-import org.aspectj.ajde.core.JavaOptions;
import org.aspectj.ajdt.ajc.AjdtCommand;
import org.aspectj.ajdt.ajc.BuildArgParser;
import org.aspectj.ajdt.ajc.ConfigParser;
handleMessage(new Message(getFormattedOptionsString(),IMessage.INFO,null,null));
CompilationAndWeavingContext.reset();
+
AjBuildConfig buildConfig = genAjBuildConfig();
if (buildConfig == null) return;
-
+
+ if (buildFresh) {
+ ajBuildManager.batchBuild(buildConfig,msgHandlerAdapter);
+ } else {
+ ajBuildManager.incrementalBuild(buildConfig,msgHandlerAdapter);
+ }
+/*
if (buildFresh) {
+ AjBuildConfig buildConfig = genAjBuildConfig();
+ if (buildConfig == null) return;
ajBuildManager.batchBuild(buildConfig,msgHandlerAdapter);
} else {
+ AjBuildConfig buildConfig = ajBuildManager.getState().getBuildConfig();
+
ajBuildManager.incrementalBuild(buildConfig,msgHandlerAdapter);
}
+*/
IncrementalStateManager.recordSuccessfulBuild(compiler.getId(),ajBuildManager.getState());
} catch (ConfigParser.ParseException pe) {
} else {
handleMessage(new Message(message.getMessage() + "\n"
+ CompilationAndWeavingContext.getCurrentContext(),IMessage.ERROR,e,null));
- };
+ }
} catch (Throwable t) {
handleMessage(new Message("Compile error: " + LangUtil.unqualifiedClassName(t) + " thrown: " +
"" + t.getMessage(),IMessage.ABORT,t,null));
return config;
}
- /**
- * Check that the user hasn't specified Java 6 for the compliance, source and
- * target levels. If they have then an error is thrown.
- */
- private void checkNotAskedForJava6Compliance() {
- // bug 164384 - Throwing an IMessage.ERRROR rather than an IMessage.ABORT
- // means that we'll continue to try to compile the code. This means that
- // the user may see other errors (for example, if they're using annotations
- // then they'll get errors saying that they require 5.0 compliance).
- // Throwing IMessage.ABORT would prevent this, however, 'abort' is really
- // for compiler exceptions.
- Map javaOptions = compiler.getCompilerConfiguration().getJavaOptionsMap();
- if (javaOptions != null){
- String version = (String)javaOptions.get(CompilerOptions.OPTION_Compliance);
- String sourceVersion = (String)javaOptions.get(CompilerOptions.OPTION_Source);
- String targetVersion = (String)javaOptions.get(CompilerOptions.OPTION_TargetPlatform);
- if (version!=null && version.equals(JavaOptions.VERSION_16)) {
- String msg = "Java 6.0 compliance level is unsupported";
- IMessage m = new Message(msg, IMessage.ERROR, null, null);
- compiler.getMessageHandler().handleMessage(m);
- } else if (sourceVersion!=null && sourceVersion.equals(JavaOptions.VERSION_16)) {
- String msg = "Java 6.0 source level is unsupported";
- IMessage m = new Message(msg, IMessage.ERROR, null, null);
- compiler.getMessageHandler().handleMessage(m);
- } else if (targetVersion!=null && targetVersion.equals(JavaOptions.VERSION_16)) {
- String msg = "Java 6.0 target level is unsupported";
- IMessage m = new Message(msg, IMessage.ERROR, null, null);
- compiler.getMessageHandler().handleMessage(m);
- }
- }
- }
-
/**
* Configure the given AjBuildConfig with the options found in the
* ICompilerConfiguration implementation associated with the AjCompiler
public void testDeclareMessageContents() {
List msgs = handler.getMessages();
- IMessage msg = (IMessage)((TestMessageHandler.TestMessage)msgs.get(1)).getContainedMessage();
+ IMessage msg = ((TestMessageHandler.TestMessage)msgs.get(1)).getContainedMessage();
assertEquals( "Please don't call setters" , msg.getMessage());
assertEquals("field-set(int apackage.SomeClass.x)", msg.getDetails());
}
private TestMessageHandler handler;
private TestCompilerConfiguration compilerConfig;
- private String testProps;
private String[] config1 = new String[] {
"src" + File.separator + "Main.java",
handler = (TestMessageHandler) getCompiler().getMessageHandler();
compilerConfig = (TestCompilerConfiguration) getCompiler()
.getCompilerConfiguration();
- testProps = getAbsoluteProjectDir() + File.separator + "src" + File.separator + "testsrc" + File.separator + "test.props";
}
protected void tearDown() throws Exception {
import org.aspectj.ajde.core.AjdeCoreTestCase;
import org.aspectj.ajde.core.TestCompilerConfiguration;
-import org.aspectj.ajde.core.TestMessageHandler;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
"pkg" + File.separator + "InPackage.java"
};
- private TestMessageHandler handler;
private TestCompilerConfiguration compilerConfig;
protected void setUp() throws Exception {
super.setUp();
initialiseProject("coverage");
- handler = (TestMessageHandler) getCompiler().getMessageHandler();
compilerConfig = (TestCompilerConfiguration) getCompiler()
.getCompilerConfiguration();
compilerConfig.setProjectSourceFiles(getSourceFileList(files));
protected void tearDown() throws Exception {
super.tearDown();
- handler = null;
compilerConfig = null;
model = null;
}
public void testRoot() {
- IProgramElement root = (IProgramElement)model.getRoot();
+ IProgramElement root = model.getRoot();
assertNotNull(root);
assertEquals("Expected root to be named 'coverage' but found "
+ root.toLabelString(), root.toLabelString(), "coverage");
}
public void testInterTypeMemberDeclares() {
- IProgramElement node = (IProgramElement)model.getRoot();
+ IProgramElement node = model.getRoot();
assertNotNull(node);
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "InterTypeDecCoverage");
}
public void testPointcuts() {
- IProgramElement node = (IProgramElement)model.getRoot();
+ IProgramElement node = model.getRoot();
assertNotNull(node);
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "AdviceNamingCoverage");
}
public void testAbstract() {
- IProgramElement node = (IProgramElement)model.getRoot();
+ IProgramElement node = model.getRoot();
assertNotNull(node);
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "AbstractAspect");
}
public void testAdvice() {
- IProgramElement node = (IProgramElement)model.getRoot();
+ IProgramElement node = model.getRoot();
assertNotNull(node);
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "AdviceNamingCoverage");
import org.aspectj.ajde.core.AjdeCoreTestCase;
import org.aspectj.ajde.core.TestCompilerConfiguration;
-import org.aspectj.ajde.core.TestMessageHandler;
import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
"pkg" + File.separator + "InPackage.java"
};
- private TestMessageHandler handler;
private TestCompilerConfiguration compilerConfig;
protected void setUp() throws Exception {
super.setUp();
initialiseProject("coverage");
- handler = (TestMessageHandler) getCompiler().getMessageHandler();
compilerConfig = (TestCompilerConfiguration) getCompiler()
.getCompilerConfiguration();
compilerConfig.setProjectSourceFiles(getSourceFileList(files));
protected void tearDown() throws Exception {
super.tearDown();
- handler = null;
compilerConfig = null;
manager = null;
}
import org.aspectj.ajde.core.AjdeCoreTestCase;
import org.aspectj.ajde.core.TestCompilerConfiguration;
-import org.aspectj.ajde.core.TestMessageHandler;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.HierarchyWalker;
import org.aspectj.asm.IHierarchy;
"figures" + File.separator + "primitives" + File.separator + "solid" + File.separator + "SolidPoint.java"
};
- private TestMessageHandler handler;
private TestCompilerConfiguration compilerConfig;
protected void setUp() throws Exception {
super.setUp();
initialiseProject("figures-coverage");
- handler = (TestMessageHandler) getCompiler().getMessageHandler();
compilerConfig = (TestCompilerConfiguration) getCompiler()
.getCompilerConfiguration();
compilerConfig.setProjectSourceFiles(getSourceFileList(files));
protected void tearDown() throws Exception {
super.tearDown();
- handler = null;
compilerConfig = null;
manager = null;
}
IProgramElement node = manager.getHierarchy().findElementForSourceFile(
testFile.getAbsolutePath());
assertTrue("find result", node != null) ;
- IProgramElement pNode = (IProgramElement)node;
- String child = ((IProgramElement)pNode.getChildren().get(1)).getName();
+ String child = ((IProgramElement)node.getChildren().get(1)).getName();
assertTrue("expected Figure got child " + child, child.equals("Figure"));
}
IProgramElement node = manager.getHierarchy().findElementForSourceFile(
testFile.getAbsolutePath());
assertTrue("find result", node != null) ;
- IProgramElement pNode = (IProgramElement)((IProgramElement)node).getChildren().get(2);
+ IProgramElement pNode = (IProgramElement)(node).getChildren().get(2);
IProgramElement pointcut = (IProgramElement)pNode.getChildren().get(0);
assertTrue("kind", pointcut.getKind().equals(IProgramElement.Kind.POINTCUT));
assertTrue("found node: " + pointcut.getName(), pointcut.toLabelString().equals("testptct()"));
testFile.getAbsolutePath(), 1);
assertTrue("find result", node != null) ;
assertEquals("find result has children", 3, node.getChildren().size()) ;
- IProgramElement pNode = (IProgramElement)node;
- assertTrue("found node: " + pNode.getName(), pNode.getKind().equals(IProgramElement.Kind.FILE_JAVA));
+ assertTrue("found node: " + node.getName(), node.getKind().equals(IProgramElement.Kind.FILE_JAVA));
}
/**
File testFile = openFile("figures" + File.separator + "Main.java");
IProgramElement node = model.findElementForSourceLine(testFile.getAbsolutePath(), 11);
assertTrue("find result", node != null);
- IProgramElement pNode = (IProgramElement)((IProgramElement)node).getParent();
+ IProgramElement pNode = node.getParent();
if (null == pNode) {
assertTrue("null parent of " + node, false);
}