import org.aspectj.tools.ajc.AjcTests;
import org.aspectj.util.FileUtil;
+import org.aspectj.util.LangUtil;
/**
* Test implementation of ICompilerConfiguration. Allows users to configure the settings via setter methods. By default returns null
}
public String getClasspath() {
- return projectPath + File.pathSeparator + System.getProperty("sun.boot.class.path") + File.pathSeparator
- + AjcTests.aspectjrtClasspath();
+ StringBuilder classpath = new StringBuilder();
+ classpath.append(projectPath);
+ if (LangUtil.is19VMOrGreater()) {
+ classpath.append(File.pathSeparator).append(LangUtil.getJrtFsFilePath());
+ } else {
+ classpath.append(File.pathSeparator).append(System.getProperty("sun.boot.class.path"));
+ }
+ classpath.append(File.pathSeparator).append(AjcTests.aspectjrtClasspath());
+ return classpath.toString();
}
public Set<File> getInpath() {
import junit.framework.TestCase;
import org.aspectj.tools.ajc.Ajc;
+import org.aspectj.util.LangUtil;
/**
* This class is the super class of all Ajdoc tests. It creates a sandbox directory and provides utility methods for copying over
args[1] = "-source";
args[2] = sourceLevel;
args[3] = "-classpath";
- args[4] = AjdocTests.ASPECTJRT_PATH.getPath();
+ StringBuilder classpath = new StringBuilder();
+ if (LangUtil.is19VMOrGreater()) {
+ classpath.append(LangUtil.getJrtFsFilePath()).append(File.pathSeparator);
+ }
+ classpath.append(AjdocTests.ASPECTJRT_PATH.getPath());
+ args[4] = classpath.toString();
args[5] = "-d";
args[6] = getAbsolutePathOutdir();
// args[7] = "-Xset:minimalModel=false";
import org.aspectj.bridge.ICommand;
//import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageHandler;
+import org.aspectj.util.LangUtil;
/**
* @author hugunin
public void testThisAndModifiers() {
checkCompile("src1/ThisAndModifiers.java", NO_ERRORS);
}
+
public void testDeclares() {
checkCompile("src1/Declares.java", new int[] {2});
}
args.add(getSandboxName());
args.add("-classpath");
- args.add(getRuntimeClasspath() + File.pathSeparator +\r "../lib/junit/junit.jar;../testing-client/bin");
+ StringBuilder classpath = new StringBuilder();
+ classpath.append(getRuntimeClasspath());
+ classpath.append(File.pathSeparator).append("../lib/junit/junit.jar;../testing-client/bin");
+ args.add(classpath.toString());
args.add("-Xlint:error");
args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/Xlint.java");
import org.aspectj.testing.util.TestUtil;
import org.aspectj.tools.ajc.Ajc;
import org.aspectj.tools.ajc.AjcTests;
+import org.aspectj.util.LangUtil;
import org.aspectj.weaver.bcel.LazyClassGen;
public abstract class CommandTestCase extends TestCase {
/** get the location of the org.aspectj.lang & runtime classes */
protected static String getRuntimeClasspath() {
- return AjcTests.aspectjrtClasspath();
+ StringBuilder classpath = new StringBuilder();
+ if (LangUtil.is19VMOrGreater()) {
+ classpath.append(LangUtil.getJrtFsFilePath()).append(File.pathSeparator);
+ }
+ classpath.append(AjcTests.aspectjrtClasspath());
+ return classpath.toString();
}
protected String getSandboxName() {
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.testing.util.TestUtil;
+import org.aspectj.util.LangUtil;
/**
* A TestCase class that acts as the superclass for all test cases wishing to drive the ajc compiler.
getAnyJars(ajc.getSandboxDirectory(), cp);
URLClassLoader sandboxLoader;
- URLClassLoader testLoader = (URLClassLoader) getClass().getClassLoader();
- ClassLoader parentLoader = testLoader.getParent();
-
-
+ ClassLoader parentLoader = getClass().getClassLoader().getParent();
/* Sandbox -> AspectJ -> Extension -> Bootstrap */
if ( !useFullLTW && useLTW) {
+ URLClassLoader testLoader = (URLClassLoader) getClass().getClassLoader();
/*
* Create a new AspectJ class loader using the existing test CLASSPATH and any missing Java 5 projects
*/
* @param args the String[] args to fix up
* @return the String[] args to use
*/
- protected String[] fixupArgs(String[] args) {
- if (null == args) {
- return null;
- }
- int cpIndex = -1;
- boolean hasruntime = false;
- for (int i = 0; i < args.length - 1; i++) {
- args[i] = adaptToPlatform(args[i]);
- if ("-classpath".equals(args[i])) {
- cpIndex = i;
- args[i + 1] = substituteSandbox(args[i + 1]);
- String next = args[i + 1];
- hasruntime = ((null != next) && (-1 != next.indexOf("aspectjrt.jar")));
- }
- }
- if (-1 == cpIndex) {
- String[] newargs = new String[args.length + 2];
- newargs[0] = "-classpath";
- newargs[1] = TestUtil.aspectjrtPath().getPath();
- System.arraycopy(args, 0, newargs, 2, args.length);
- args = newargs;
- } else {
- if (!hasruntime) {
- cpIndex++;
- String[] newargs = new String[args.length];
- System.arraycopy(args, 0, newargs, 0, args.length);
- newargs[cpIndex] = args[cpIndex] + File.pathSeparator + TestUtil.aspectjrtPath().getPath();
- args = newargs;
- }
- }
- return args;
- }
+ protected String[] fixupArgs(String[] args) {
+ if (null == args) {
+ return null;
+ }
+ int cpIndex = -1;
+ boolean hasruntime = false;
+ for (int i = 0; i < args.length - 1; i++) {
+ args[i] = adaptToPlatform(args[i]);
+ if ("-classpath".equals(args[i])) {
+ cpIndex = i;
+ args[i + 1] = substituteSandbox(args[i + 1]);
+ String next = args[i + 1];
+ hasruntime = ((null != next) && (-1 != next.indexOf("aspectjrt.jar")));
+ }
+ }
+ if (-1 == cpIndex) {
+ String[] newargs = new String[args.length + 2];
+ newargs[0] = "-classpath";
+ newargs[1] = TestUtil.aspectjrtPath().getPath();
+ System.arraycopy(args, 0, newargs, 2, args.length);
+ args = newargs;
+ cpIndex = 1;
+ } else {
+ if (!hasruntime) {
+ cpIndex++;
+ String[] newargs = new String[args.length];
+ System.arraycopy(args, 0, newargs, 0, args.length);
+ newargs[cpIndex] = args[cpIndex] + File.pathSeparator + TestUtil.aspectjrtPath().getPath();
+ args = newargs;
+ }
+ }
+ boolean needsJRTFS = LangUtil.is19VMOrGreater();
+ if (needsJRTFS) {
+ if (args[cpIndex].indexOf(LangUtil.JRT_FS) == -1) {
+ String jrtfsPath = LangUtil.getJrtFsFilePath();
+ args[cpIndex] = jrtfsPath + File.pathSeparator + args[cpIndex];
+ }
+ }
+ return args;
+}
private String adaptToPlatform(String s) {
String ret = s.replace(';', File.pathSeparatorChar);
import org.aspectj.bridge.MessageUtil;
import org.aspectj.testing.harness.bridge.AbstractRunSpec;
import org.aspectj.testing.harness.bridge.AjcTest;
+import org.aspectj.testing.harness.bridge.IRunSpec;
import org.aspectj.testing.run.IRunStatus;
import org.aspectj.testing.run.RunValidator;
import org.aspectj.testing.util.BridgeUtil;
runtime.setOptions(options);
AjcTest.Suite.Spec spec = getSpec(suiteFile);
assertNotNull(spec);
- ArrayList kids = spec.getChildren();
+ ArrayList<IRunSpec> kids = spec.getChildren();
assertNotNull(kids);
if ((suiteFile == SELECT) && (17 != kids.size())) {
assertTrue("expected 17 kids, got " + kids.size(), false);
list.add("-d");
list.add(getClassesDir().getAbsolutePath());
list.add("-classpath");
- list.add(Globals.F_aspectjrt_jar.getAbsolutePath());
+ StringBuilder classpath = new StringBuilder();
+ classpath.append(Globals.F_aspectjrt_jar.getAbsolutePath());
+ if (LangUtil.is19VMOrGreater()) {
+ classpath.append(File.pathSeparator).append(LangUtil.getJrtFsFilePath());
+ }
+ list.add(classpath.toString());
}
static boolean doWait(IMessageHolder holder, int seconds, int timeout) {