// runTest("anno copying"); | // runTest("anno copying"); | ||||
// } | // } | ||||
// public void testDoubleITDF() throws Exception { | |||||
// runTest("double itdf"); | |||||
// } | |||||
public void testThisAspectInstance_239649_1() throws Exception { | |||||
// simple case | |||||
runTest("thisAspectInstance - 1"); | |||||
} | |||||
public void testThisAspectInstance_239649_2() throws Exception { | |||||
// before advice toggling on/off through if called method | |||||
runTest("thisAspectInstance - 2"); | |||||
} | |||||
public void testThisAspectInstance_239649_3() throws Exception { | |||||
// after advice toggling on/off through if called method | |||||
runTest("thisAspectInstance - 3"); | |||||
} | |||||
public void testThisAspectInstance_239649_4() throws Exception { | |||||
// before advice, also using thisJoinPointStaticPart | |||||
runTest("thisAspectInstance - 4"); | |||||
} | |||||
public void testThisAspectInstance_239649_5() throws Exception { | |||||
// before advice, also using thisJoinPoint | |||||
runTest("thisAspectInstance - 5"); | |||||
} | |||||
public void testThisAspectInstance_239649_6() throws Exception { | |||||
// before advice, also using thisEnclosingJoinPointStaticPart | |||||
runTest("thisAspectInstance - 6"); | |||||
} | |||||
public void testThisAspectInstance_239649_7() throws Exception { | |||||
// before advice, also using thisJoinPoint and thisJoinPointStaticPart | |||||
runTest("thisAspectInstance - 7"); | |||||
} | |||||
public void testThisAspectInstance_239649_8() throws Exception { | |||||
// before advice, also using abstract aspects | |||||
runTest("thisAspectInstance - 8"); | |||||
} | |||||
public void testThisAspectInstance_239649_9() throws Exception { | |||||
// before advice, also using abstract aspects 2 | |||||
runTest("thisAspectInstance - 9"); | |||||
} | |||||
public void testThisAspectInstance_239649_10() throws Exception { | |||||
// aspects in a package | |||||
runTest("thisAspectInstance - 10"); | |||||
} | |||||
public void testThisAspectInstance_239649_11() throws Exception { | |||||
// non-singleton aspect - should be an error for now | |||||
runTest("thisAspectInstance - 11"); | |||||
} | |||||
public void testThisAspectInstance_239649_12() throws Exception { | |||||
// arg binding and tjpsp | |||||
runTest("thisAspectInstance - 12"); | |||||
} | |||||
public void testThisAspectInstance_239649_13() throws Exception { | |||||
// pass instance | |||||
runTest("thisAspectInstance - 13"); | |||||
} | |||||
public void testThisAspectInstance_239649_14() throws Exception { | |||||
// multiple ifs | |||||
runTest("thisAspectInstance - 14"); | |||||
} | |||||
public void testThisAspectInstance_239649_15() throws Exception { | |||||
// abstract aspects | |||||
runTest("thisAspectInstance - 15"); | |||||
} | |||||
public void testVerifyPerthis() throws Exception { | |||||
runTest("verify perthis"); | |||||
} | |||||
public void testRangeForLocalVariables_353936() throws ClassNotFoundException { | public void testRangeForLocalVariables_353936() throws ClassNotFoundException { | ||||
runTest("local variable tables"); | runTest("local variable tables"); | ||||
JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); | JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); |
<suite> | <suite> | ||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 1"> | |||||
<compile files="One.java" options="-1.5"/> | |||||
<run class="One"> | |||||
<stdout> | |||||
<line text="In instance check method doit()"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 2"> | |||||
<compile files="Two.java" options="-1.5"/> | |||||
<run class="Two"> | |||||
<stdout> | |||||
<line text="In instance check method, count=1 so doit returns false"/> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=2 so doit returns true"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=3 so doit returns false"/> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=4 so doit returns true"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 3"> | |||||
<compile files="Three.java" options="-1.5"/> | |||||
<run class="Three"> | |||||
<stdout> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=1 so doit returns false"/> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=2 so doit returns true"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=3 so doit returns false"/> | |||||
<line text="Method m() running"/> | |||||
<line text="In instance check method, count=4 so doit returns true"/> | |||||
<line text="In advice()"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 4"> | |||||
<compile files="Four.java" options="-1.5"/> | |||||
<run class="Four"> | |||||
<stdout> | |||||
<line text="In instance check method doit()"/> | |||||
<line text="In advice() execution(void Four.m())"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 5"> | |||||
<compile files="Five.java" options="-1.5"/> | |||||
<run class="Five"> | |||||
<stdout> | |||||
<line text="In instance check method doit()"/> | |||||
<line text="In advice() arg0=abc"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 6"> | |||||
<compile files="Six.java" options="-1.5"/> | |||||
<run class="Six"> | |||||
<stdout> | |||||
<line text="In instance check method doit()"/> | |||||
<line text="In advice() execution(void Six.main(String[]))"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 7"> | |||||
<compile files="Seven.java" options="-1.5"/> | |||||
<run class="Seven"> | |||||
<stdout> | |||||
<line text="In instance check method doit()"/> | |||||
<line text="In advice() call(void Seven.m()) execution(void Seven.main(String[]))"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 8"> | |||||
<compile files="Eight.java" options="-1.5"/> | |||||
<run class="Eight"> | |||||
<stdout> | |||||
<line text="in doit(): class=X"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 9"> | |||||
<compile files="Nine.java" options="-1.5"/> | |||||
<run class="Nine"> | |||||
<stdout> | |||||
<line text="in doit(): class=X"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 10"> | |||||
<compile files="Ten.java" options="-1.5"/> | |||||
<run class="com.foo.bar.Ten"> | |||||
<stdout> | |||||
<line text="In instance check method doit() class=com.foo.bar.X"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 11"> | |||||
<compile files="Eleven.java" options="-1.5"> | |||||
<message kind="error" text="thisAspectInstance can only be used inside an if() clause for singleton aspects (compiler limitation)"/> | |||||
</compile> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 12"> | |||||
<compile files="Twelve.java" options="-1.5"/> | |||||
<run class="Twelve"> | |||||
<stdout> | |||||
<line text="In instance check method doit()"/> | |||||
<line text="In advice() arg=abc tjpsp=execution(void Twelve.m(String))"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 13"> | |||||
<compile files="Thirteen.java" options="-1.5"/> | |||||
<run class="Thirteen"> | |||||
<stdout> | |||||
<line text="instance is X"/> | |||||
<line text="In advice() arg=abc tjpsp=execution(void Thirteen.m(String))"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 14"> | |||||
<compile files="Fourteen.java" options="-1.5"/> | |||||
<run class="Fourteen"> | |||||
<stdout> | |||||
<line text="instance is X"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 15"> | |||||
<compile files="Fifteen.java" options="-1.5"/> | |||||
<run class="Fifteen"> | |||||
<stdout> | |||||
<line text="in doit(): class=X"/> | |||||
<line text="In advice()"/> | |||||
<line text="Method m() running"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/doubleITDF" title="double itdf"> | |||||
<compile files="A.java" options="-1.7"/> | |||||
<run class="A"> | |||||
<stdout> | |||||
<line text="AA"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/verify" title="verify perthis"> | |||||
<compile files="Runner.aj" inpath="code.jar" classpath="groovy-1.8.0.jar;asm-3.2.jar" options="-1.6 -Xset:generateStackMaps=true"/> | |||||
<run class="Runner"> | |||||
<stdout> | |||||
<line text="AA"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs1612/pr353936" title="local variable tables"> | <ajc-test dir="bugs1612/pr353936" title="local variable tables"> | ||||
<compile files="Code.java" options="-1.5"/> | <compile files="Code.java" options="-1.5"/> | ||||
</ajc-test> | </ajc-test> |
private void addXmlConfigFilesToBuild(String pname, AjCompiler compiler) { | private void addXmlConfigFilesToBuild(String pname, AjCompiler compiler) { | ||||
File projectBase = new File(sandboxDir, pname); | File projectBase = new File(sandboxDir, pname); | ||||
ICompilerConfiguration icc = compiler.getCompilerConfiguration(); | ICompilerConfiguration icc = compiler.getCompilerConfiguration(); | ||||
List currentXmlFiles = icc.getProjectXmlConfigFiles(); | |||||
List collector = new ArrayList(); | |||||
List<String> currentXmlFiles = icc.getProjectXmlConfigFiles(); | |||||
List<String> collector = new ArrayList<String>(); | |||||
collectUpXmlFiles(projectBase, projectBase, collector); | collectUpXmlFiles(projectBase, projectBase, collector); | ||||
boolean changed = false; | boolean changed = false; | ||||
for (int i = 0; i < collector.size(); i++) { | for (int i = 0; i < collector.size(); i++) { | ||||
} | } | ||||
} | } | ||||
private void collectUpFiles(File location, File base, List collectionPoint) { | |||||
private void collectUpFiles(File location, File base, List<String> collectionPoint) { | |||||
String contents[] = location.list(); | String contents[] = location.list(); | ||||
if (contents == null) { | if (contents == null) { | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
private void collectUpXmlFiles(File location, File base, List collectionPoint) { | |||||
private void collectUpXmlFiles(File location, File base, List<String> collectionPoint) { | |||||
String contents[] = location.list(); | String contents[] = location.list(); | ||||
if (contents == null) { | if (contents == null) { | ||||
return; | return; | ||||
public void printBuildReport(String projectName) { | public void printBuildReport(String projectName) { | ||||
System.out.println("\n====== BUILD REPORT (Project " + projectName + ") ==========="); | System.out.println("\n====== BUILD REPORT (Project " + projectName + ") ==========="); | ||||
System.out.println("Build took: " + getTimeTakenForBuild(projectName) + "ms"); | System.out.println("Build took: " + getTimeTakenForBuild(projectName) + "ms"); | ||||
List compiled = getCompiledFiles(projectName); | |||||
List<String> compiled = getCompiledFiles(projectName); | |||||
System.out.println("Compiled: " + compiled.size() + " files"); | System.out.println("Compiled: " + compiled.size() + " files"); | ||||
for (Iterator iter = compiled.iterator(); iter.hasNext();) { | |||||
for (Iterator<String> iter = compiled.iterator(); iter.hasNext();) { | |||||
System.out.println(" :" + iter.next()); | System.out.println(" :" + iter.next()); | ||||
} | } | ||||
List woven = getWovenClasses(projectName); | |||||
List<String> woven = getWovenClasses(projectName); | |||||
System.out.println("Wove: " + woven.size() + " files"); | System.out.println("Wove: " + woven.size() + " files"); | ||||
for (Iterator iter = woven.iterator(); iter.hasNext();) { | |||||
for (Iterator<String> iter = woven.iterator(); iter.hasNext();) { | |||||
System.out.println(" :" + iter.next()); | System.out.println(" :" + iter.next()); | ||||
} | } | ||||
if (wasFullBuild()) { | if (wasFullBuild()) { | ||||
public static boolean informedAboutKindOfBuild; | public static boolean informedAboutKindOfBuild; | ||||
public static boolean fullBuildOccurred; | public static boolean fullBuildOccurred; | ||||
public static List detectedDeletions = new ArrayList(); | |||||
public static List<String> detectedDeletions = new ArrayList<String>(); | |||||
public static StringBuffer decisions = new StringBuffer(); | public static StringBuffer decisions = new StringBuffer(); | ||||
public static void reset() { | public static void reset() { |
private IOutputLocationManager outputLocationManager = null; | private IOutputLocationManager outputLocationManager = null; | ||||
private List dependants; | private List dependants; | ||||
private Map javaOptionsMap; | private Map javaOptionsMap; | ||||
private Set inpath; | |||||
private Set<File> inpath; | |||||
private String encoding = null; | private String encoding = null; | ||||
private String outjar; | private String outjar; | ||||
private String nonstandardoptions; | private String nonstandardoptions; | ||||
return cp; | return cp; | ||||
} | } | ||||
public Set getInpath() { | |||||
public Set<File> getInpath() { | |||||
log("ICompilerConfiguration.getInPath()"); | log("ICompilerConfiguration.getInPath()"); | ||||
return inpath; | return inpath; | ||||
} | } | ||||
public Map getJavaOptionsMap() { | |||||
public Map<String, String> getJavaOptionsMap() { | |||||
log("ICompilerConfiguration.getJavaOptionsMap()"); | log("ICompilerConfiguration.getJavaOptionsMap()"); | ||||
if (javaOptionsMap != null && !javaOptionsMap.isEmpty()) | if (javaOptionsMap != null && !javaOptionsMap.isEmpty()) | ||||
return javaOptionsMap; | return javaOptionsMap; | ||||
Hashtable ht = new Hashtable(); | |||||
Hashtable<String, String> ht = new Hashtable<String, String>(); | |||||
ht.put("org.eclipse.jdt.core.compiler.compliance", "1.5"); | ht.put("org.eclipse.jdt.core.compiler.compliance", "1.5"); | ||||
ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); | ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); | ||||
ht.put("org.eclipse.jdt.core.compiler.source", "1.5"); | ht.put("org.eclipse.jdt.core.compiler.source", "1.5"); | ||||
this.changed |= ICompilerConfiguration.ASPECTPATH_CHANGED; | this.changed |= ICompilerConfiguration.ASPECTPATH_CHANGED; | ||||
} | } | ||||
public void setInpath(Set inpath) { | |||||
public void setInpath(Set<File> inpath) { | |||||
this.inpath = inpath; | this.inpath = inpath; | ||||
this.changed |= ICompilerConfiguration.INPATH_CHANGED; | this.changed |= ICompilerConfiguration.INPATH_CHANGED; | ||||
} | } |
return weavingMessages; | return weavingMessages; | ||||
} | } | ||||
public List/* IMessage */getCompilerErrors() { | |||||
public List<IMessage> getCompilerErrors() { | |||||
return compilerErrors; | return compilerErrors; | ||||
} | } | ||||