@@ -1,4 +1,5 @@ | |||
*/bin | |||
*/pom.xml.versionsBackup | |||
log.txt | |||
.vscode | |||
.DS_Store |
@@ -0,0 +1,18 @@ | |||
/* ******************************************************************* | |||
* Copyright (c) 2019 Contributors. | |||
* All rights reserved. | |||
* This program and the accompanying materials are made available | |||
* under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* ******************************************************************/ | |||
package org.aspectj.tools.ajdoc; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class AJDocConstants { | |||
public final static String VERSION = "1.7"; | |||
} |
@@ -69,7 +69,7 @@ public class BugTest extends AjdocTestCase { | |||
initialiseProject("pr148906"); | |||
File[] files = {new File(getAbsoluteProjectDir() + "/C.java")}; | |||
String[] ajOptions = {new String("-aspectpath"), new String(getAbsoluteProjectDir() + File.separator + "simple.jar")}; | |||
runAjdoc(files,"1.6",ajOptions); | |||
runAjdoc(files,AJDocConstants.VERSION,ajOptions); | |||
assertFalse("expected clean build of project but found that build aborted",Main.hasAborted()); | |||
File html = new File(getAbsolutePathOutdir() + File.separator + "C.html"); | |||
if (!html.exists()) { | |||
@@ -90,7 +90,7 @@ public class BugTest extends AjdocTestCase { | |||
initialiseProject("pr148906"); | |||
File[] files = {new File(getAbsoluteProjectDir() + "/C.java")}; | |||
String[] ajOptions = {new String("-outxml"),new String("-aspectpath"), new String(getAbsoluteProjectDir() + File.separator + "simple.jar")}; | |||
runAjdoc(files,"1.6",ajOptions); | |||
runAjdoc(files,AJDocConstants.VERSION,ajOptions); | |||
assertFalse("expected clean build of project but found that build aborted",Main.hasAborted()); | |||
File html = new File(getAbsolutePathOutdir() + File.separator + "C.html"); | |||
if (!html.exists()) { |
@@ -87,7 +87,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAJdocHasAspectTitle() throws Exception { | |||
File[] files = {new File(getAbsoluteProjectDir() + "/pkg/A.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/A.html"); | |||
if (!htmlFile.exists()) { | |||
fail("couldn't find " + htmlFile.getAbsolutePath()+ " - were there compilation errors?"); | |||
@@ -101,7 +101,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAJdocHasClassTitle() throws Exception { | |||
File[] files = {new File(getAbsoluteProjectDir() + "/pkg/C.java")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/C.html"); | |||
if (!htmlFile.exists()) { | |||
fail("couldn't find " + htmlFile.getAbsolutePath()+ " - were there compilation errors?"); | |||
@@ -117,7 +117,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testInnerAspect() throws Exception { | |||
File[] files = {file1, file2}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/ClassA.InnerAspect.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -205,7 +205,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdviceNamingCoverage() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/AdviceNamingCoverage.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -237,7 +237,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisesRelationshipCoverage() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/AdvisesRelationshipCoverage.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -290,7 +290,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByMethodExecution() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -321,7 +321,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByConstructorExecution() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -358,7 +358,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByMethodCall() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -389,7 +389,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByConstructorCall() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -420,7 +420,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByGet() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -451,7 +451,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedBySet() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -500,7 +500,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByInitialization() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -532,7 +532,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByStaticInitialization() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -553,7 +553,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByHandler() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -591,7 +591,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testTwoBeforeAdvice() throws Exception { | |||
File[] files = {new File(getAbsoluteProjectDir() + "/pkg/A2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/C2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -637,7 +637,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testNoSpuriousAdvisedByRels() throws Exception { | |||
File[] files = {file4}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/AdvisesRelationshipCoverage.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -666,7 +666,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testNestedAspect() throws Exception { | |||
File[] files = {file9}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/PkgVisibleClass.NestedAspect.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -748,7 +748,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testNestedAspectWithSimilarName() throws Exception { | |||
File[] files = {new File(getAbsoluteProjectDir() + "/pkg/ClassWithNestedAspect.java")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.NestedAspect.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -829,7 +829,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdviceInNestedAspect() throws Exception { | |||
File[] files = {new File(getAbsoluteProjectDir() + "/pkg/ClassWithNestedAspect.java")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.NestedAspect.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -860,7 +860,7 @@ public class CoverageTestCase extends AjdocTestCase { | |||
*/ | |||
public void testAdvisedByInNestedAspect() throws Exception { | |||
File[] files = {new File(getAbsoluteProjectDir() + "/pkg/ClassWithNestedAspect.java")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.html"); | |||
if (!htmlFile.exists()) { |
@@ -49,7 +49,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testDeclareStatments() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -84,7 +84,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testDeclareWarning() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -116,7 +116,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testMatchesDeclareCall() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Main2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -148,7 +148,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testMatchesDeclareExecution() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -181,7 +181,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testDeclareParents() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -212,7 +212,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testAspectDeclarations() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -235,7 +235,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testDeclareSoft() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -266,7 +266,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testSoftenedBy() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Main2.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -305,7 +305,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testDeclareAnnotation() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtType.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
// Aspect AnnotationTest should contain within it's declare | |||
// detail and summary the declare annotation statement. | |||
@@ -351,7 +351,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testMethodAnnotatedBy() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtMethod.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -384,7 +384,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testConstructorAnnotatedBy() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtConstructor.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -418,7 +418,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testFieldAnnotatedBy() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtField.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -452,7 +452,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testTypeAnnotatedBy() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtType.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -475,7 +475,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testMatchesDeclareAndAdvisedBy() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "A.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html"); | |||
if (!htmlFile.exists()) { | |||
@@ -521,7 +521,7 @@ public class DeclareFormsTest extends AjdocTestCase { | |||
public void testTwoDeclareParents() throws Exception { | |||
initialiseProject("declareForms"); | |||
File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareParents.aj")}; | |||
runAjdoc("private","1.6",files); | |||
runAjdoc("private",AJDocConstants.VERSION,files); | |||
File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareParents.html"); | |||
if (!htmlFile.exists()) { |
@@ -86,6 +86,11 @@ public interface Constants { | |||
public final static short MINOR_10 = 0; | |||
public final static short MAJOR_11 = 55; | |||
public final static short MINOR_11 = 0; | |||
public final static short MAJOR_12 = 56; | |||
public final static short MINOR_12 = 0; | |||
public final static int PREVIEW_MINOR_VERSION = 65535; | |||
// Defaults | |||
public final static short MAJOR = MAJOR_1_1; | |||
public final static short MINOR = MINOR_1_1; |
@@ -226,7 +226,8 @@ public class ClassPath implements Serializable { | |||
} | |||
// On Java9 the sun.boot.class.path won't be set. System classes accessible through JRT filesystem | |||
if (vm_version.startsWith("9") || vm_version.startsWith("10") || vm_version.startsWith("11")) { | |||
if (vm_version.startsWith("9") || vm_version.startsWith("10") | |||
|| vm_version.startsWith("11") || vm_version.startsWith("12")) { | |||
buf.insert(0, File.pathSeparatorChar); | |||
buf.insert(0, System.getProperty("java.home") + File.separator + "lib" + File.separator + JRT_FS); | |||
} |
@@ -20,6 +20,72 @@ All rights reserved. | |||
<p>The full list of resolved issues in 1.9.3 is available | |||
<a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&f0=OP&f1=OP&f3=CP&f4=CP&j1=OR&list_id=16866879&product=AspectJ&query_format=advanced&target_milestone=1.9.3">here</a></h2>.</p> | |||
<p>AspectJ 1.9.3 supports Java12. Java12 introduces the new switch expression syntax, but you must activate support for that via | |||
an <tt>--enable-preview</tt> flag when using the compiler and attempting to run the resultant classes: | |||
Here is <tt>Switch3.java</tt>: | |||
<pre><code> | |||
=========8<========= | |||
public class Switch3 { | |||
public static void main(String[] argv) { | |||
System.out.println(one(Color.R)); | |||
System.out.println(one(Color.G)); | |||
System.out.println(one(Color.B)); | |||
System.out.println(one(Color.Y)); | |||
} | |||
public static int one(Color color) { | |||
int result = switch(color) { | |||
case R -> foo(0); | |||
case G -> foo(1); | |||
case B -> foo(2); | |||
default -> foo(3); | |||
}; | |||
return result; | |||
} | |||
public static final int foo(int i) { | |||
return i+1; | |||
} | |||
} | |||
enum Color { | |||
R, G, B, Y; | |||
} | |||
aspect X { | |||
int around(): call(* foo(..)) { | |||
return proceed()*3; | |||
} | |||
} | |||
=========8<========= | |||
</code></pre> | |||
Compile it with: | |||
<pre><code> | |||
$ ajc --enable-preview -showWeaveInfo -12 Switch3.java | |||
Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:12) advised by around advice from 'X' (Switch3.java:30) | |||
Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:13) advised by around advice from 'X' (Switch3.java:30) | |||
Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:14) advised by around advice from 'X' (Switch3.java:30) | |||
Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:15) advised by around advice from 'X' (Switch3.java:30) | |||
</code></pre> | |||
Now run it: | |||
<pre><code> | |||
$ java --enable-preview Switch3 | |||
3 | |||
6 | |||
9 | |||
12 | |||
</code></pre> | |||
<p>Available: 1.9.3.RC1 available 7-Mar-2019</p> | |||
<br><br> |
@@ -5,7 +5,7 @@ | |||
org/aspectj/weaver/XlintDefault.properties for the default behavior and a template to copy. | |||
### AspectJ-specific messages | |||
compiler.name = AspectJ Compiler | |||
compiler.version = Eclipse Compiler #6373b82afa49b(1-Oct-2018), 3.16 | |||
compiler.version = Eclipse Compiler #a9ab0710a01b2b(28-Mar-2019), 3.18 | |||
compiler.copyright = | |||
@@ -57,18 +57,17 @@ public class AjBuildManagerTest extends TestCase { | |||
super(name); | |||
} | |||
public void testSimpleStructure() throws IOException /* , CoreException */{ | |||
public void testSimpleStructure() throws IOException { | |||
AjBuildManager manager = new AjBuildManager(messageWriter); | |||
BuildArgParser parser = new BuildArgParser(messageWriter); | |||
String javaClassPath = System.getProperty("java.class.path"); | |||
System.out.println(javaClassPath); | |||
String sandboxName = TestUtil.createEmptySandbox().getAbsolutePath(); | |||
AjBuildConfig buildConfig = parser.genBuildConfig(new String[] { "-d", sandboxName, "-1.4", "-classpath", javaClassPath, | |||
Constants.TESTDATA_PATH + "/src1/A.java", | |||
// EajcModuleTests.TESTDATA_PATH + "/src1/Hello.java", | |||
}); | |||
String err = parser.getOtherMessages(true); | |||
assertTrue(err, null == err); | |||
assertTrue(err, null == err || err.startsWith("incorrect classpath") && err.endsWith("run-all-junit-tests/target/classes")); | |||
// manager.setStructureModel(AsmManager.getDefault().getHierarchy()); | |||
MessageHandler handler = new MessageHandler(); | |||
manager.batchBuild(buildConfig, handler); |
@@ -687,7 +687,7 @@ public abstract class AjcTestCase extends TestCase { | |||
e.printStackTrace(); | |||
} | |||
return lastRunResult; | |||
} else if (vmargs!=null && (vmargs.contains("--add-modules") || vmargs.contains("--limit-modules") || vmargs.contains("--add-reads"))) { | |||
} else if (vmargs!=null && (vmargs.contains("--enable-preview") || vmargs.contains("--add-modules") || vmargs.contains("--limit-modules") || vmargs.contains("--add-reads"))) { | |||
// If --add-modules supplied, need to fork the test | |||
try { | |||
// if (mp.indexOf("$runtime") != -1) { |
@@ -254,9 +254,9 @@ public class AjcTask extends MatchingTask { | |||
public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR"; | |||
static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11" }; | |||
static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11"}; | |||
static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11" }; | |||
static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12" }; | |||
static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12" }; | |||
static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11", "-12" }; | |||
private static final ICommandEditor COMMAND_EDITOR; | |||
@@ -1,5 +1,5 @@ | |||
/* ******************************************************************* | |||
* Copyright (c) 2004,2018 IBM Corporation, contributors | |||
* Copyright (c) 2004,2019 IBM Corporation, contributors | |||
* All rights reserved. | |||
* This program and the accompanying materials are made available | |||
* under the terms of the Eclipse Public License v1.0 | |||
@@ -29,6 +29,7 @@ public class AjcTest { | |||
private static boolean is19VMOrGreater = false; | |||
private static boolean is10VMOrGreater = false; | |||
private static boolean is11VMOrGreater = false; | |||
private static boolean is12VMOrGreater = false; | |||
static { // matching logic is also in org.aspectj.util.LangUtil | |||
is14VMOrGreater = LangUtil.is14VMOrGreater(); | |||
@@ -39,6 +40,7 @@ public class AjcTest { | |||
is19VMOrGreater = LangUtil.is19VMOrGreater(); | |||
is10VMOrGreater = LangUtil.is10VMOrGreater(); | |||
is11VMOrGreater = LangUtil.is11VMOrGreater(); | |||
is12VMOrGreater = LangUtil.is12VMOrGreater(); | |||
} | |||
private List<ITestStep> testSteps = new ArrayList<ITestStep>(); | |||
@@ -84,6 +86,7 @@ public class AjcTest { | |||
if (vmLevel.equals("1.9")) canRun = is19VMOrGreater; | |||
if (vmLevel.equals("10")) canRun = is10VMOrGreater; | |||
if (vmLevel.equals("11")) canRun = is11VMOrGreater; | |||
if (vmLevel.equals("12")) canRun = is12VMOrGreater; | |||
if (!canRun) { | |||
System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel() | |||
+ ", currently running on " + System.getProperty("java.vm.version")); |
@@ -207,7 +207,7 @@ public class AntSpec implements ITestStep { | |||
} | |||
if (m_stdErrSpec != null) { | |||
String stderr2 = stderr.toString(); | |||
// Working around this rediculous message that still comes out of Java7 builds: | |||
// Working around this ridiculous message that still comes out of Java7 builds: | |||
if (stderr2.indexOf("Class JavaLaunchHelper is implemented in both")!=-1 && stderr2.indexOf('\n')!=-1) { | |||
stderr2 = stderr2.replaceAll("objc\\[[0-9]*\\]: Class JavaLaunchHelper is implemented in both [^\n]*\n",""); | |||
} | |||
@@ -225,7 +225,11 @@ public class AntSpec implements ITestStep { | |||
stderr2 = stderr2.replaceAll("WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\n",""); | |||
stderr2 = stderr2.replaceAll("WARNING: All illegal access operations will be denied in a future release\n",""); | |||
} | |||
// J12 | |||
String msg = "Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = \"org.aspectj.weaver.loadtime.WeavingURLClassLoader\"). To use archived non-system classes, this property must not be set"; | |||
if (stderr2.contains(msg)) { | |||
stderr2 = stderr2.replace(msg+"\n",""); | |||
} | |||
m_stdErrSpec.matchAgainst(stderr2); | |||
} | |||
} |
@@ -208,6 +208,21 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { | |||
return result; | |||
} | |||
protected void checkVersion(String classname, int major, int minor) { | |||
JavaClass jc; | |||
try { | |||
jc = getClassFrom(ajc.getSandboxDirectory(), classname); | |||
} catch (ClassNotFoundException e) { | |||
throw new IllegalStateException("Cannot find class "+classname,e); | |||
} | |||
if (jc.getMajor() != major) { | |||
fail("Expected major version to be " + major + " but was " + jc.getMajor()); | |||
} | |||
if (jc.getMinor() != minor) { | |||
fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); | |||
} | |||
} | |||
/* | |||
* The rules for parsing a suite spec file. The Digester using bean properties to match attributes in the XML document to | |||
* properties in the associated classes, so this simple implementation should be very easy to maintain and extend should you |
@@ -11,6 +11,8 @@ | |||
* ******************************************************************/ | |||
package org.aspectj.testing; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* Makes sure tests are running on the right level of JDK. | |||
* | |||
@@ -20,9 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTes | |||
@Override | |||
public void runTest(String title) { | |||
// Check we are on Java11 | |||
String property = System.getProperty("java.version"); | |||
if (!property.startsWith("11")) { | |||
if (!LangUtil.is11VMOrGreater()) { | |||
throw new IllegalStateException("These tests should be run on Java 11 or later"); | |||
} | |||
super.runTest(title); |
@@ -0,0 +1,31 @@ | |||
/* ******************************************************************* | |||
* Copyright (c) 2018 Contributors | |||
* All rights reserved. | |||
* This program and the accompanying materials are made available | |||
* under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* Andy Clement | |||
* ******************************************************************/ | |||
package org.aspectj.testing; | |||
import org.aspectj.util.LangUtil; | |||
/** | |||
* Ensure sure tests are running on the right level of JDK. | |||
* | |||
* @author Andy Clement | |||
*/ | |||
public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTestCase { | |||
@Override | |||
public void runTest(String title) { | |||
if (!LangUtil.is12VMOrGreater()) { | |||
throw new IllegalStateException("These tests should be run on Java 12 or later"); | |||
} | |||
super.runTest(title); | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
public class Switch1 { | |||
public static void main(String[] argv) { | |||
System.out.println(one(Color.R)); | |||
System.out.println(one(Color.G)); | |||
System.out.println(one(Color.B)); | |||
System.out.println(one(Color.Y)); | |||
} | |||
public static int one(Color color) { | |||
int result = switch(color) { | |||
case R -> 0; | |||
case G -> 1; | |||
case B -> 2; | |||
default -> 3; | |||
}; | |||
return result; | |||
} | |||
} | |||
enum Color { | |||
R, G, B, Y; | |||
} |
@@ -0,0 +1,28 @@ | |||
public class Switch2 { | |||
public static void main(String[] argv) { | |||
System.out.println(one(Color.R)); | |||
System.out.println(one(Color.G)); | |||
System.out.println(one(Color.B)); | |||
System.out.println(one(Color.Y)); | |||
} | |||
public static int one(Color color) { | |||
int result = switch(color) { | |||
case R -> 0; | |||
case G -> 1; | |||
case B -> 2; | |||
default -> 3; | |||
}; | |||
return result; | |||
} | |||
} | |||
enum Color { | |||
R, G, B, Y; | |||
} | |||
aspect X { | |||
int around(): call(* one(..)) { | |||
return proceed()*2; | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
public class Switch3 { | |||
public static void main(String[] argv) { | |||
System.out.println(one(Color.R)); | |||
System.out.println(one(Color.G)); | |||
System.out.println(one(Color.B)); | |||
System.out.println(one(Color.Y)); | |||
} | |||
public static int one(Color color) { | |||
int result = switch(color) { | |||
case R -> foo(0); | |||
case G -> foo(1); | |||
case B -> foo(2); | |||
default -> foo(3); | |||
}; | |||
return result; | |||
} | |||
public static final int foo(int i) { | |||
return i+1; | |||
} | |||
} | |||
enum Color { | |||
R, G, B, Y; | |||
} | |||
aspect X { | |||
int around(): call(* foo(..)) { | |||
return proceed()*3; | |||
} | |||
} |
@@ -10,7 +10,7 @@ | |||
<target name="compile:javac"> | |||
<!-- compile only javac compilable stuff, exclude the one that needs other dependencies --> | |||
<javac source="1.6" target="1.6" destdir="${aj.sandbox}" classpathref="aj.path" | |||
<javac source="1.7" target="1.7" destdir="${aj.sandbox}" classpathref="aj.path" | |||
srcdir="${basedir}" | |||
includes="ataspectj/*" | |||
excludes="ataspectj/UnweavableTest.java" | |||
@@ -75,7 +75,7 @@ | |||
<target name="ltw.Aspect2MainTest"> | |||
<!-- javac Aspect2 --> | |||
<javac source="1.6" target="1.6" destdir="${aj.sandbox}" classpathref="aj.path" | |||
<javac source="1.7" target="1.7" destdir="${aj.sandbox}" classpathref="aj.path" | |||
srcdir="${basedir}" | |||
includes="ataspectj/ltwreweavable/Aspect2.java" | |||
debug="true"> | |||
@@ -125,7 +125,7 @@ | |||
</target> | |||
<target name="ltw.Unweavable"> | |||
<javac source="1.6" target="1.6" destdir="${aj.sandbox}" | |||
<javac source="1.7" target="1.7" destdir="${aj.sandbox}" | |||
srcdir="${basedir}" | |||
includes="ataspectj/UnweavableTest.java, ataspectj/TestHelper.java" | |||
debug="true"> | |||
@@ -171,7 +171,7 @@ | |||
<target name="ltw.Decp2"> | |||
<!-- javac compile the 2nd aspect --> | |||
<javac source="1.6" target="1.6" destdir="${aj.sandbox}" | |||
<javac source="1.7" target="1.7" destdir="${aj.sandbox}" | |||
srcdir="${basedir}" | |||
includes="ataspectj/DeclareParentsImplementsReweavableTestAspect.java" | |||
debug="true"> |
@@ -10,16 +10,14 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc160; | |||
import java.io.File; | |||
import junit.framework.Test; | |||
import org.aspectj.apache.bcel.classfile.Attribute; | |||
import org.aspectj.apache.bcel.classfile.Code; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.apache.bcel.classfile.Method; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import junit.framework.Test; | |||
/* | |||
* Some very trivial tests that help verify things are OK. | |||
* Followed by some Java6 specific checks to ensure the class files are well formed. | |||
@@ -136,16 +134,6 @@ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
return false; | |||
} | |||
private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { | |||
JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); | |||
if (jc.getMajor() != major) { | |||
fail("Expected major version to be " + major + " but was " + jc.getMajor()); | |||
} | |||
if (jc.getMinor() != minor) { | |||
fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); | |||
} | |||
} | |||
// Check the stackmap stuff is removed when a method gets woven (for now...) | |||
// public void testStackMapAttributesDeletedInWovenCode() { | |||
// fail("Not implemented"); |
@@ -149,16 +149,6 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { | |||
return false; | |||
} | |||
private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { | |||
JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); | |||
if (jc.getMajor() != major) { | |||
fail("Expected major version to be " + major + " but was " + jc.getMajor()); | |||
} | |||
if (jc.getMinor() != minor) { | |||
fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); | |||
} | |||
} | |||
// Check the stackmap stuff is removed when a method gets woven (for now...) | |||
// public void testStackMapAttributesDeletedInWovenCode() { | |||
// fail("Not implemented"); |
@@ -10,7 +10,6 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc190; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import junit.framework.Test; | |||
@@ -124,16 +123,6 @@ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
// return false; | |||
// } | |||
private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { | |||
JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); | |||
if (jc.getMajor() != major) { | |||
fail("Expected major version to be " + major + " but was " + jc.getMajor()); | |||
} | |||
if (jc.getMinor() != minor) { | |||
fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); | |||
} | |||
} | |||
// Check the stackmap stuff is removed when a method gets woven (for now...) | |||
// public void testStackMapAttributesDeletedInWovenCode() { | |||
// fail("Not implemented"); |
@@ -7,7 +7,6 @@ | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc191; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import junit.framework.Test; | |||
@@ -73,16 +72,6 @@ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
checkVersion("A", 49, 0); | |||
} | |||
private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { | |||
JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); | |||
if (jc.getMajor() != major) { | |||
fail("Expected major version to be " + major + " but was " + jc.getMajor()); | |||
} | |||
if (jc.getMinor() != minor) { | |||
fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); | |||
} | |||
} | |||
// /////////////////////////////////////// | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(SanityTestsJava10.class); |
@@ -74,15 +74,6 @@ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { | |||
checkVersion("A", 49, 0); | |||
} | |||
private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { | |||
JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); | |||
if (jc.getMajor() != major) { | |||
fail("Expected major version to be " + major + " but was " + jc.getMajor()); | |||
} | |||
if (jc.getMinor() != minor) { | |||
fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); | |||
} | |||
} | |||
// /////////////////////////////////////// | |||
public static Test suite() { |
@@ -1,5 +1,5 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2018 Contributors | |||
* Copyright (c) 2018-2019 Contributors | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
@@ -17,9 +17,8 @@ public class AllTestsAspectJ193 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.9.3 tests"); | |||
// $JUnit-BEGIN$ | |||
suite.addTest(Ajc193Tests.suite()); | |||
// $JUnit-END$ | |||
suite.addTest(Java12Tests.suite()); | |||
return suite; | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2019 Contributors | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc193; | |||
import org.aspectj.apache.bcel.Constants; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
import org.aspectj.testing.XMLBasedAjcTestCaseForJava12OrLater; | |||
import junit.framework.Test; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Java12Tests extends XMLBasedAjcTestCaseForJava12OrLater { | |||
public void testSwitch1() { | |||
runTest("switch 1"); | |||
checkVersion("Switch1", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); | |||
} | |||
public void testSwitch2() { | |||
runTest("switch 2"); | |||
checkVersion("Switch2", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); | |||
} | |||
public void testSwitch3() { | |||
runTest("switch 3"); | |||
checkVersion("Switch3", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); | |||
} | |||
// --- | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(Java12Tests.class); | |||
} | |||
@Override | |||
protected java.net.URL getSpecFile() { | |||
return getClassResource("ajc193.xml"); | |||
} | |||
} |
@@ -111,8 +111,12 @@ | |||
<!-- this fails because if you start working with modules you commit to the modules story and classpath | |||
becomes irrelevant --> | |||
<compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="module.jar" classpath="foo.jar"> | |||
<message kind="error" text="The import ddd cannot be resolved"/> | |||
<message kind="error" text="The type ddd.D is not accessible"/> | |||
<message kind="error" text="D cannot be resolved"/> | |||
<!-- | |||
<message kind="error" text="The import ddd cannot be resolved"/> | |||
<message kind="error" text="package ddd is not visible"/> | |||
--> | |||
</compile> | |||
</ajc-test> | |||
@@ -51,6 +51,45 @@ Method call | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="features193" vm="12" title="switch 1"> | |||
<compile files="Switch1.java" options="-12 --enable-preview"> | |||
</compile> | |||
<run class="Switch1" vmargs="--enable-preview"> | |||
<stdout> | |||
<line text="0"/> | |||
<line text="1"/> | |||
<line text="2"/> | |||
<line text="3"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="features193" vm="12" title="switch 2"> | |||
<compile files="Switch2.java" options="--enable-preview -source 12"> | |||
</compile> | |||
<run class="Switch2" vmargs="--enable-preview"> | |||
<stdout> | |||
<line text="0"/> | |||
<line text="2"/> | |||
<line text="4"/> | |||
<line text="6"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="features193" vm="12" title="switch 3"> | |||
<compile files="Switch3.java" options="--enable-preview -source 12"> | |||
</compile> | |||
<run class="Switch3" vmargs="--enable-preview"> | |||
<stdout> | |||
<line text="3"/> | |||
<line text="6"/> | |||
<line text="9"/> | |||
<line text="12"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - reweaving"> | |||
<compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8" outjar="one.jar"> | |||
<message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> |
@@ -161,6 +161,10 @@ public class LangUtil { | |||
return 11 <= vmVersion; | |||
} | |||
public static boolean is12VMOrGreater() { | |||
return 12 <= vmVersion; | |||
} | |||
/** | |||
* Shorthand for "if null, throw IllegalArgumentException" | |||
* |
@@ -13,11 +13,14 @@ package org.aspectj.weaver.bcel; | |||
import junit.framework.TestCase; | |||
import java.util.Arrays; | |||
import org.aspectj.apache.bcel.Repository; | |||
import org.aspectj.apache.bcel.classfile.JavaClass; | |||
import org.aspectj.apache.bcel.classfile.Signature; | |||
import org.aspectj.util.GenericSignature; | |||
import org.aspectj.util.GenericSignatureParser; | |||
import org.aspectj.util.LangUtil; | |||
import org.aspectj.util.GenericSignature.ClassSignature; | |||
import org.aspectj.weaver.UnresolvedType; | |||
@@ -44,12 +47,19 @@ public class BcelGenericSignatureToTypeXTestCase extends TestCase { | |||
UnresolvedType superclass = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superclassSignature, | |||
cSig.formalTypeParameters, world); | |||
assertEquals("Ljava/lang/Object;", superclass.getSignature()); | |||
assertEquals("2 superinterfaces", 2, cSig.superInterfaceSignatures.length); | |||
UnresolvedType comparable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[0], | |||
System.out.println(Arrays.toString(cSig.superInterfaceSignatures)); | |||
if (LangUtil.is12VMOrGreater()) { | |||
// [Ljava/lang/constant/Constable;, Ljava/lang/Comparable<TE;>;, Ljava/io/Serializable;] | |||
assertEquals("3 superinterfaces but "+Arrays.toString(cSig.superInterfaceSignatures), 3, cSig.superInterfaceSignatures.length); | |||
} else { | |||
assertEquals("2 superinterfaces", 2, cSig.superInterfaceSignatures.length); | |||
} | |||
int idx = LangUtil.is12VMOrGreater()?1:0; | |||
UnresolvedType comparable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[idx++], | |||
cSig.formalTypeParameters, world); | |||
assertEquals("Pjava/lang/Comparable<TE;>;", comparable.getSignature()); | |||
UnresolvedType serializable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX( | |||
cSig.superInterfaceSignatures[1], cSig.formalTypeParameters, world); | |||
cSig.superInterfaceSignatures[idx++], cSig.formalTypeParameters, world); | |||
assertEquals("Ljava/io/Serializable;", serializable.getSignature()); | |||
} | |||