Browse Source

Updates to better cope with future JDKs

The version handling in LangUtil has been overhauled
to cope better with post 1.8 releases (JDK9 and JDK10 or 18.3
or whatever they call it). As part of this moved
to treating JDK9 as '9' rather than '1.9'. Also removed
duplicate version processing logic and had that defer to
the one place in LangUtil where we now deal with it.

Includes some generics tidyup in ajdoc. More ajdoc work
is necessary for Java10 because it removes the standard doclet
(old style). However trying to invoke the internal Javadoc
handler in Java10 is failing due to module visibility rules.
tags/V1_9_0_RC3
Andy Clement 6 years ago
parent
commit
d92319c43f

+ 15
- 15
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java View File

private static final String ITD_FIELD_SUMMARY = "Inter-Type Field Summary"; private static final String ITD_FIELD_SUMMARY = "Inter-Type Field Summary";
private static final String ITD_CONSTRUCTOR_SUMMARY = "Inter-Type Constructor Summary"; private static final String ITD_CONSTRUCTOR_SUMMARY = "Inter-Type Constructor Summary";


static List visibleFileList = new ArrayList();
static List<String> visibleFileList = new ArrayList<String>();
static Hashtable declIDTable = null; static Hashtable declIDTable = null;
static File rootDir = null; static File rootDir = null;
static String docVisibilityModifier; static String docVisibilityModifier;
} }


static void addAspectDocumentation(IProgramElement node, StringBuffer fileBuffer, int index) { static void addAspectDocumentation(IProgramElement node, StringBuffer fileBuffer, int index) {
List pointcuts = new ArrayList();
List advice = new ArrayList();
List declares = new ArrayList();
List methodsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_METHOD);
List<IProgramElement> pointcuts = new ArrayList<IProgramElement>();
List<IProgramElement> advice = new ArrayList<IProgramElement>();
List<IProgramElement> declares = new ArrayList<IProgramElement>();
List<IProgramElement> methodsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_METHOD);
if (methodsDeclaredOn != null && !methodsDeclaredOn.isEmpty()) { if (methodsDeclaredOn != null && !methodsDeclaredOn.isEmpty()) {
insertDeclarationsSummary(fileBuffer, methodsDeclaredOn, ITD_METHOD_SUMMARY, index); insertDeclarationsSummary(fileBuffer, methodsDeclaredOn, ITD_METHOD_SUMMARY, index);
} }
List fieldsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_FIELD);
List<IProgramElement> fieldsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_FIELD);
if (fieldsDeclaredOn != null && !fieldsDeclaredOn.isEmpty()) { if (fieldsDeclaredOn != null && !fieldsDeclaredOn.isEmpty()) {
insertDeclarationsSummary(fileBuffer, fieldsDeclaredOn, ITD_FIELD_SUMMARY, index); insertDeclarationsSummary(fileBuffer, fieldsDeclaredOn, ITD_FIELD_SUMMARY, index);
} }
List constDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR);
List<IProgramElement> constDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR);
if (fieldsDeclaredOn != null && !constDeclaredOn.isEmpty()) { if (fieldsDeclaredOn != null && !constDeclaredOn.isEmpty()) {
insertDeclarationsSummary(fileBuffer, constDeclaredOn, ITD_CONSTRUCTOR_SUMMARY, index); insertDeclarationsSummary(fileBuffer, constDeclaredOn, ITD_CONSTRUCTOR_SUMMARY, index);
} }
for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
for (Iterator<IProgramElement> it = node.getChildren().iterator(); it.hasNext();) {
IProgramElement member = (IProgramElement) it.next(); IProgramElement member = (IProgramElement) it.next();
if (member.getKind().equals(IProgramElement.Kind.POINTCUT)) { if (member.getKind().equals(IProgramElement.Kind.POINTCUT)) {
pointcuts.add(member); pointcuts.add(member);
insertDeclarationsDetails(fileBuffer, advice, ADVICE_DETAIL, index); insertDeclarationsDetails(fileBuffer, advice, ADVICE_DETAIL, index);
} }
// add the 'aspect declarations' information against the type // add the 'aspect declarations' information against the type
List parentsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.DECLARE_PARENTS);
List<IProgramElement> parentsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.DECLARE_PARENTS);
if (parentsDeclaredOn != null && parentsDeclaredOn.size() > 0) { if (parentsDeclaredOn != null && parentsDeclaredOn.size() > 0) {
decorateDocWithRel(node, fileBuffer, index, parentsDeclaredOn, HtmlRelationshipKind.ASPECT_DECLARATIONS); decorateDocWithRel(node, fileBuffer, index, parentsDeclaredOn, HtmlRelationshipKind.ASPECT_DECLARATIONS);
} }
// add the 'annotated by' information against the type // add the 'annotated by' information against the type
List annotatedBy = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE, "annotated by");
List<String> annotatedBy = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE, "annotated by");
if (annotatedBy != null && annotatedBy.size() > 0) { if (annotatedBy != null && annotatedBy.size() > 0) {
decorateDocWithRel(node, fileBuffer, index, annotatedBy, HtmlRelationshipKind.ANNOTATED_BY); decorateDocWithRel(node, fileBuffer, index, annotatedBy, HtmlRelationshipKind.ANNOTATED_BY);
} }
// add the 'advised by' information against the type // add the 'advised by' information against the type
List advisedBy = StructureUtil.getTargets(node, IRelationship.Kind.ADVICE);
List<String> advisedBy = StructureUtil.getTargets(node, IRelationship.Kind.ADVICE);
if (advisedBy != null && advisedBy.size() > 0) { if (advisedBy != null && advisedBy.size() > 0) {
decorateDocWithRel(node, fileBuffer, index, advisedBy, HtmlRelationshipKind.ADVISED_BY); decorateDocWithRel(node, fileBuffer, index, advisedBy, HtmlRelationshipKind.ADVISED_BY);
} }
} }


static void decorateMemberDocumentation(IProgramElement node, StringBuffer fileContentsBuffer, int index) { static void decorateMemberDocumentation(IProgramElement node, StringBuffer fileContentsBuffer, int index) {
List targets = StructureUtil.getTargets(node, IRelationship.Kind.ADVICE);
List<String> targets = StructureUtil.getTargets(node, IRelationship.Kind.ADVICE);
decorateDocWithRel(node, fileContentsBuffer, index, targets, HtmlRelationshipKind.ADVISED_BY); decorateDocWithRel(node, fileContentsBuffer, index, targets, HtmlRelationshipKind.ADVISED_BY);


List warnings = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE, "matches declare");
List<String> warnings = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE, "matches declare");
decorateDocWithRel(node, fileContentsBuffer, index, warnings, HtmlRelationshipKind.MATCHES_DECLARE); decorateDocWithRel(node, fileContentsBuffer, index, warnings, HtmlRelationshipKind.MATCHES_DECLARE);


List softenedBy = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE, "softened by");
List<String> softenedBy = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE, "softened by");
decorateDocWithRel(node, fileContentsBuffer, index, softenedBy, HtmlRelationshipKind.SOFTENED_BY); decorateDocWithRel(node, fileContentsBuffer, index, softenedBy, HtmlRelationshipKind.SOFTENED_BY);


List annotatedBy = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE, "annotated by");
List<String> annotatedBy = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE, "annotated by");
decorateDocWithRel(node, fileContentsBuffer, index, annotatedBy, HtmlRelationshipKind.ANNOTATED_BY); decorateDocWithRel(node, fileContentsBuffer, index, annotatedBy, HtmlRelationshipKind.ANNOTATED_BY);
} }



+ 9
- 1
ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java View File



package org.aspectj.tools.ajdoc; package org.aspectj.tools.ajdoc;


import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;


import org.aspectj.util.LangUtil;

/** /**
* @author Mik Kersten * @author Mik Kersten
*/ */
// defaultSecurityManager.checkPermission( permission, context ); // defaultSecurityManager.checkPermission( permission, context );
// } // }
// } ); // } );

// Need to do something different on Java > 9 due to removal of standard doclet I think
// if (LangUtil.is19VMOrGreater()) {
// // Not visible according to module rules...
// clazz = Class.forName("jdk.javadoc.internal.tool.Main");
// }
try { try {
// for JDK 1.4 and above call the execute method... // for JDK 1.4 and above call the execute method...
Class jdMainClass = com.sun.tools.javadoc.Main.class; Class jdMainClass = com.sun.tools.javadoc.Main.class;

+ 23
- 23
ajdoc/src/org/aspectj/tools/ajdoc/Main.java View File

private static final String FAIL_MESSAGE = "> compile failed, exiting ajdoc"; private static final String FAIL_MESSAGE = "> compile failed, exiting ajdoc";


/** Command line options. */ /** Command line options. */
static Vector options;
static Vector<String> options;


/** Options to pass to ajc. */ /** Options to pass to ajc. */
static Vector ajcOptions;
static Vector<String> ajcOptions;


/** All of the files to be processed by ajdoc. */ /** All of the files to be processed by ajdoc. */
static Vector filenames;
static Vector<String> filenames;


/** List of files to pass to javadoc. */ /** List of files to pass to javadoc. */
static Vector fileList;
static Vector<String> fileList;


/** List of packages to pass to javadoc. */ /** List of packages to pass to javadoc. */
static Vector packageList;
static Vector<String> packageList;


/** Default to package visiblity. */ /** Default to package visiblity. */
static String docModifier = "package"; static String docModifier = "package";


static Vector sourcepath;
static Vector<String> sourcepath;


static boolean verboseMode = false; static boolean verboseMode = false;
static boolean packageMode = false; static boolean packageMode = false;
private static String outputWorkingDir = Config.WORKING_DIR; private static String outputWorkingDir = Config.WORKING_DIR;


public static void clearState() { public static void clearState() {
options = new Vector();
ajcOptions = new Vector();
filenames = new Vector();
fileList = new Vector();
packageList = new Vector();
options = new Vector<String>();
ajcOptions = new Vector<String>();
filenames = new Vector<String>();
fileList = new Vector<String>();
packageList = new Vector<String>();
docModifier = "package"; docModifier = "package";
sourcepath = new Vector();
sourcepath = new Vector<String>();
verboseMode = false; verboseMode = false;
packageMode = false; packageMode = false;
rootDir = null; rootDir = null;
* package-summary properly. * package-summary properly.
*/ */
private static void packageHTML(AsmManager model, File[] inputFiles) throws IOException { private static void packageHTML(AsmManager model, File[] inputFiles) throws IOException {
ArrayList dirList = new ArrayList();
ArrayList<String> dirList = new ArrayList<String>();
for (int i = 0; i < inputFiles.length; i++) { for (int i = 0; i < inputFiles.length; i++) {
String packageName = StructureUtil.getPackageDeclarationFromFile(model, inputFiles[i]); String packageName = StructureUtil.getPackageDeclarationFromFile(model, inputFiles[i]);
// Only copy the package.html file once. // Only copy the package.html file once.
String pathName = outputWorkingDir + File.separator + packageName.replace('.', File.separatorChar); String pathName = outputWorkingDir + File.separator + packageName.replace('.', File.separatorChar);
File packageDir = new File(pathName); File packageDir = new File(pathName);
if (!packageDir.exists()) { if (!packageDir.exists()) {
dirList.add(packageDir);
dirList.add(packageName);
continue; continue;
} }
packageName = packageName.replace('.', '/'); // !!! packageName = packageName.replace('.', '/'); // !!!
javadocargs[options.size() + k] = StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath()); javadocargs[options.size() + k] = StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath());
} }
} }

JavadocRunner.callJavadoc(javadocargs); JavadocRunner.callJavadoc(javadocargs);
} }


} }
} }


static Vector getSourcePath() {
Vector sourcePath = new Vector();
static Vector<String> getSourcePath() {
Vector<String> sourcePath = new Vector<String>();
boolean found = false; boolean found = false;
for (int i = 0; i < options.size(); i++) { for (int i = 0; i < options.size(); i++) {
String currOption = (String) options.elementAt(i); String currOption = (String) options.elementAt(i);
String line = ""; String line = "";
line = br.readLine(); line = br.readLine();
StringTokenizer st = new StringTokenizer(line, " "); StringTokenizer st = new StringTokenizer(line, " ");
List argList = new ArrayList();
List<String> argList = new ArrayList<String>();
while (st.hasMoreElements()) { while (st.hasMoreElements()) {
argList.add(st.nextElement());
argList.add(st.nextToken());
} }
// System.err.println(argList); // System.err.println(argList);
args = new String[argList.size()]; args = new String[argList.size()];
int counter = 0; int counter = 0;
for (Iterator it = argList.iterator(); it.hasNext();) {
for (Iterator<String> it = argList.iterator(); it.hasNext();) {
args[counter] = (String) it.next(); args[counter] = (String) it.next();
counter++; counter++;
} }
ioe.printStackTrace(); ioe.printStackTrace();
} }
} }
List vargs = new LinkedList(Arrays.asList(args));
List<String> vargs = new LinkedList<String>(Arrays.asList(args));
vargs.add("-Xset:minimalModel=false"); vargs.add("-Xset:minimalModel=false");
parseArgs(vargs, new File(".")); // !!! parseArgs(vargs, new File(".")); // !!!


arg = arg + File.pathSeparator; // makes things easier for ourselves arg = arg + File.pathSeparator; // makes things easier for ourselves
StringTokenizer tokenizer = new StringTokenizer(arg, File.pathSeparator); StringTokenizer tokenizer = new StringTokenizer(arg, File.pathSeparator);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
sourcepath.addElement(tokenizer.nextElement());
sourcepath.addElement(tokenizer.nextToken());
} }
} }


} }


static void expandAtSignFile(String filename, File currentWorkingDir) { static void expandAtSignFile(String filename, File currentWorkingDir) {
List result = new LinkedList();
List<String> result = new LinkedList<String>();


File atFile = qualifiedFile(filename, currentWorkingDir); File atFile = qualifiedFile(filename, currentWorkingDir);
String atFileParent = atFile.getParent(); String atFileParent = atFile.getParent();
continue; continue;
result.add(line); result.add(line);
} }
stream.close();
} catch (IOException e) { } catch (IOException e) {
System.err.println("Error while reading the @ file " + atFile.getPath() + ".\n" + e); System.err.println("Error while reading the @ file " + atFile.getPath() + ".\n" + e);
System.exit(-1); System.exit(-1);

+ 19
- 22
ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java View File

* *
* @return null if a relationship of that kind is not found * @return null if a relationship of that kind is not found
*/ */
public static List /* String */getTargets(IProgramElement node, IRelationship.Kind kind) {
public static List<String> getTargets(IProgramElement node, IRelationship.Kind kind) {
return getTargets(node, kind, null); return getTargets(node, kind, null);
} }


* *
* @return null if a relationship of that kind is not found * @return null if a relationship of that kind is not found
*/ */
public static List /* String */getTargets(IProgramElement node, IRelationship.Kind kind, String relName) {
List relations = new ArrayList();
List rels = node.getModel().getRelationshipMap().get(node);
public static List<String> getTargets(IProgramElement node, IRelationship.Kind kind, String relName) {
List<IRelationship> relations = new ArrayList<IRelationship>();
List<IRelationship> rels = node.getModel().getRelationshipMap().get(node);
if (rels != null) { if (rels != null) {
relations.addAll(rels); relations.addAll(rels);
} }
for (Iterator iter = node.getChildren().iterator(); iter.hasNext();) {
for (Iterator<IProgramElement> iter = node.getChildren().iterator(); iter.hasNext();) {
IProgramElement child = (IProgramElement) iter.next(); IProgramElement child = (IProgramElement) iter.next();
// if we're not a type, or if we are and the child is code, then // if we're not a type, or if we are and the child is code, then
// we want to get the relationships for this child - this means that the // we want to get the relationships for this child - this means that the
// correct relationships appear against the type in the ajdoc // correct relationships appear against the type in the ajdoc
if (!node.getKind().isType() || child.getKind().equals(IProgramElement.Kind.CODE)) { if (!node.getKind().isType() || child.getKind().equals(IProgramElement.Kind.CODE)) {
List childRelations = node.getModel().getRelationshipMap().get(child);
List<IRelationship> childRelations = node.getModel().getRelationshipMap().get(child);
if (childRelations != null) { if (childRelations != null) {
for (Iterator iterator = childRelations.iterator(); iterator.hasNext();) {
for (Iterator<IRelationship> iterator = childRelations.iterator(); iterator.hasNext();) {
IRelationship rel = (IRelationship) iterator.next(); IRelationship rel = (IRelationship) iterator.next();
if (!relations.contains(rel)) { if (!relations.contains(rel)) {
relations.add(rel); relations.add(rel);
} }
if (relations == null || relations.isEmpty()) if (relations == null || relations.isEmpty())
return null; return null;
List targets = new ArrayList();
for (Iterator it = relations.iterator(); it.hasNext();) {
List<String> targets = new ArrayList<String>();
for (Iterator<IRelationship> it = relations.iterator(); it.hasNext();) {
IRelationship rtn = (IRelationship) it.next(); IRelationship rtn = (IRelationship) it.next();
if (rtn.getKind().equals(kind) && ((relName != null && relName.equals(rtn.getName())) || relName == null)) { if (rtn.getKind().equals(kind) && ((relName != null && relName.equals(rtn.getName())) || relName == null)) {
List targs = rtn.getTargets();
for (Iterator iter = targs.iterator(); iter.hasNext();) {
String element = (String) iter.next();
List<String> targs = rtn.getTargets();
for (String element: targs) {
if (!targets.contains(element)) { if (!targets.contains(element)) {
targets.add(element); targets.add(element);
} }
return targets; return targets;
} }


static List /* IProgramElement */getDeclareInterTypeTargets(IProgramElement node, IProgramElement.Kind kind) {
List targets = new ArrayList();
List stringTargets = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE);
static List<IProgramElement> getDeclareInterTypeTargets(IProgramElement node, IProgramElement.Kind kind) {
List<IProgramElement> targets = new ArrayList<IProgramElement>();
List<String> stringTargets = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE);
if (stringTargets == null) { if (stringTargets == null) {
return null; return null;
} }
for (Iterator iter = stringTargets.iterator(); iter.hasNext();) {
String element = (String) iter.next();
for (String element: stringTargets) {
IProgramElement ipe = node.getModel().getHierarchy().findElementForHandle(element); IProgramElement ipe = node.getModel().getHierarchy().findElementForHandle(element);
if (ipe != null && ipe.getKind().equals(kind)) { if (ipe != null && ipe.getKind().equals(kind)) {
targets.add(ipe); targets.add(ipe);
return targets; return targets;
} }


public static List/* String */getDeclareTargets(IProgramElement node) {
List relations = node.getModel().getRelationshipMap().get(node);
List targets = null;
public static List<String> getDeclareTargets(IProgramElement node) {
List<IRelationship> relations = node.getModel().getRelationshipMap().get(node);
List<String> targets = null;
if (relations == null) if (relations == null)
return null; return null;
for (Iterator it = relations.iterator(); it.hasNext();) {
IRelationship rtn = (IRelationship) it.next();
for (IRelationship rtn: relations) {
if (rtn.getKind().isDeclareKind()) { if (rtn.getKind().isDeclareKind()) {
targets = rtn.getTargets(); targets = rtn.getTargets();
} }

+ 4
- 2
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java View File

!sourceLevel.equals("1.6") && !sourceLevel.equals("1.6") &&
!sourceLevel.equals("1.7") && !sourceLevel.equals("1.7") &&
!sourceLevel.equals("1.8") && !sourceLevel.equals("1.8") &&
!sourceLevel.equals("1.9")) {
fail("need to pass ajdoc '1.3' > '1.9' as the source level");
!sourceLevel.equals("1.9") &&
!sourceLevel.startsWith("9") &&
!sourceLevel.startsWith("10")) {
fail("need to pass suitable version to ajdoc as the source level");
} }
if (inputFiles.length == 0) { if (inputFiles.length == 0) {
fail("need to pass some files into ajdoc"); fail("need to pass some files into ajdoc");

+ 1
- 1
ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java View File

*/ */
public void testCoveragePublicMode() throws Exception { public void testCoveragePublicMode() throws Exception {
File[] files = {file3,file9}; File[] files = {file3,file9};
runAjdoc("public","1.6",files);
runAjdoc("public","9",files);
// have passed the "public" modifier as well as // have passed the "public" modifier as well as
// one public and one package visible class. There // one public and one package visible class. There

+ 3
- 0
org.aspectj.matcher/src/org/aspectj/weaver/World.java View File

} else if (ty.isGenericType()) { } else if (ty.isGenericType()) {
// ======= generic types ====================== // ======= generic types ======================
ResolvedType rt = resolveGenericTypeFor(ty, false); ResolvedType rt = resolveGenericTypeFor(ty, false);
if (rt.isMissing()) {
return rt;
}
ReferenceType genericType = (ReferenceType) rt; ReferenceType genericType = (ReferenceType) rt;
return genericType; return genericType;



+ 7
- 26
testing/newsrc/org/aspectj/testing/AjcTest.java View File

import java.util.List; import java.util.List;


import org.aspectj.tools.ajc.AjcTestCase; import org.aspectj.tools.ajc.AjcTestCase;
import org.aspectj.util.LangUtil;


/** /**
* @author Adrian Colyer * @author Adrian Colyer
private static boolean is19VMOrGreater = false; private static boolean is19VMOrGreater = false;
static { // matching logic is also in org.aspectj.util.LangUtil static { // matching logic is also in org.aspectj.util.LangUtil
String vm = System.getProperty("java.version"); // JLS 20.18.7
if (vm==null) vm = System.getProperty("java.runtime.version");
if (vm==null) vm = System.getProperty("java.vm.version");
if (vm.startsWith("1.3")) {
is14VMOrGreater = false;
} else if (vm.startsWith("1.5")) {
is15VMOrGreater = true;
} else if (vm.startsWith("1.6")) {
is15VMOrGreater = true;
is16VMOrGreater = true;
} else if (vm.startsWith("1.7")) {
is15VMOrGreater = true;
is16VMOrGreater = true;
is17VMOrGreater = true;
} else if (vm.startsWith("1.8")) {
is15VMOrGreater = true;
is16VMOrGreater = true;
is17VMOrGreater = true;
is18VMOrGreater = true;
} else if (vm.startsWith("1.9") || vm.startsWith("9")) {
is15VMOrGreater = true;
is16VMOrGreater = true;
is17VMOrGreater = true;
is18VMOrGreater = true;
is19VMOrGreater = true;
}
is14VMOrGreater = LangUtil.is14VMOrGreater();
is15VMOrGreater = LangUtil.is15VMOrGreater();
is16VMOrGreater = LangUtil.is16VMOrGreater();
is17VMOrGreater = LangUtil.is17VMOrGreater();
is18VMOrGreater = LangUtil.is18VMOrGreater();
is19VMOrGreater = LangUtil.is19VMOrGreater();
} }


private List<ITestStep> testSteps = new ArrayList<ITestStep>(); private List<ITestStep> testSteps = new ArrayList<ITestStep>();

+ 21
- 1
testing/newsrc/org/aspectj/testing/OutputSpec.java View File

private List<String> expectedOutputLines = new ArrayList<String>(); private List<String> expectedOutputLines = new ArrayList<String>();


public void addLine(OutputLine line) { public void addLine(OutputLine line) {
if (line.getVm() == null || line.getVm().contains(LangUtil.getVmVersionString())) {
if (line.getVm() == null || matchesThisVm(line.getVm())) {
expectedOutputLines.add(line.getText()); expectedOutputLines.add(line.getText());
} }
} }
/**
* For a test output line that has specified a vm version, check if it matches the vm we are running on.
* vm might be "1.2,1.3,1.4,1.5" or simply "9" or it may be a version with a '+' suffix indicating that
* level or later, e.g. "9+" should be ok on Java 10
* @return true if the current vm version matches the spec
*/
private boolean matchesThisVm(String vm) {
// vm might be 1.2, 1.3, 1.4, 1.5 or 1.9 possibly with a '+' in there
// For now assume + is attached to there only being one version, like "9+"
if (vm.contains(LangUtil.getVmVersionString())) {
return true;
}
if (vm.endsWith("+")) {
double vmVersion = LangUtil.getVmVersion();
double vmSpecified = Double.parseDouble(vm.substring(0,vm.length()-1));
return vmVersion >= vmSpecified;
}
return false;
}

public void matchAgainst(String output) { public void matchAgainst(String output) {
matchAgainst(output, "yes"); matchAgainst(output, "yes");
} }

+ 19
- 19
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File

<line text="1 @Foo()"/> <line text="1 @Foo()"/>
<line text="1 @Foo()"/> <line text="1 @Foo()"/>
<line text="1 @Classified(classification=TOP-SECRET)" vm="1.5,1.6,1.7,1.8"/> <line text="1 @Classified(classification=TOP-SECRET)" vm="1.5,1.6,1.7,1.8"/>
<line text="1 @Classified(classification=&quot;TOP-SECRET&quot;)" vm="1.9"/>
<line text="1 @Classified(classification=&quot;TOP-SECRET&quot;)" vm="9+"/>
<line text="This information is TOP-SECRET"/> <line text="This information is TOP-SECRET"/>
<line text="Entering critical join point with priority 3"/> <line text="Entering critical join point with priority 3"/>
<line text="Entering critical join point with reflectively obtained priority 3"/> <line text="Entering critical join point with reflectively obtained priority 3"/>
<stdout> <stdout>
<line text="target-ok an X execution(void X.foo())"/> <line text="target-ok an X execution(void X.foo())"/>
<line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/>
<line text="@this-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.foo())" vm="1.9"/>
<line text="@this-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.foo())" vm="9+"/>
<line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/>
<line text="@target-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.foo())" vm="1.9"/>
<line text="@target-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.foo())" vm="9+"/>
<line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/>
<line text="@within-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.foo())" vm="1.9"/>
<line text="@within-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.foo())" vm="9+"/>
<line text="cflow-ok an X a Y set(Y X.y)"/> <line text="cflow-ok an X a Y set(Y X.y)"/>
<line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@annotation-ok-sub @MyAnnotation(value=&quot;bar&quot;) execution(void X.bar())" vm="1.9"/>
<line text="@annotation-ok-sub @MyAnnotation(value=&quot;bar&quot;) execution(void X.bar())" vm="9+"/>
<line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@annotation-ok @MyAnnotation(value=&quot;bar&quot;) execution(void X.bar())" vm="1.9"/>
<line text="@annotation-ok @MyAnnotation(value=&quot;bar&quot;) execution(void X.bar())" vm="9+"/>
<line text="target-ok an X execution(void X.bar())"/> <line text="target-ok an X execution(void X.bar())"/>
<line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@this-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.bar())" vm="1.9"/>
<line text="@this-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.bar())" vm="9+"/>
<line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@target-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.bar())" vm="1.9"/>
<line text="@target-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.bar())" vm="9+"/>
<line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@within-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.bar())" vm="1.9"/>
<line text="@within-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void X.bar())" vm="9+"/>
<line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/>
<line text="@args-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void Y.foo(X))" vm="1.9"/>
<line text="@args-ok @MyAnnotation(value=&quot;my-value&quot;) execution(void Y.foo(X))" vm="9+"/>
<line text="args-ok an X execution(void Y.foo(X))"/> <line text="args-ok an X execution(void Y.foo(X))"/>
<line text="this-ok a Y execution(void Y.foo(X))"/> <line text="this-ok a Y execution(void Y.foo(X))"/>
<line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/>
<line text="@this-ok @MyAnnotation(value=&quot;on Y&quot;) execution(void Y.foo(X))" vm="1.9"/>
<line text="@this-ok @MyAnnotation(value=&quot;on Y&quot;) execution(void Y.foo(X))" vm="9+"/>
<line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/>
<line text="@target-ok @MyAnnotation(value=&quot;on Y&quot;) execution(void Y.foo(X))" vm="1.9"/>
<line text="@target-ok @MyAnnotation(value=&quot;on Y&quot;) execution(void Y.foo(X))" vm="9+"/>
<line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/>
<line text="@within-ok @MyAnnotation(value=&quot;on Y&quot;) execution(void Y.foo(X))" vm="1.9"/>
<line text="@within-ok @MyAnnotation(value=&quot;on Y&quot;) execution(void Y.foo(X))" vm="9+"/>
<line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@annotation-ok-sub @MyAnnotation(value=&quot;my-value&quot;) execution(X Y.bar())" vm="1.9"/>
<line text="@annotation-ok-sub @MyAnnotation(value=&quot;my-value&quot;) execution(X Y.bar())" vm="9+"/>
<line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@annotation-ok @MyAnnotation(value=&quot;my-value&quot;) execution(X Y.bar())" vm="1.9"/>
<line text="@annotation-ok @MyAnnotation(value=&quot;my-value&quot;) execution(X Y.bar())" vm="9+"/>
<line text="this-ok a Y execution(X Y.bar())"/> <line text="this-ok a Y execution(X Y.bar())"/>
<line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@this-ok @MyAnnotation(value=&quot;on Y&quot;) execution(X Y.bar())" vm="1.9"/>
<line text="@this-ok @MyAnnotation(value=&quot;on Y&quot;) execution(X Y.bar())" vm="9+"/>
<line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@target-ok @MyAnnotation(value=&quot;on Y&quot;) execution(X Y.bar())" vm="1.9"/>
<line text="@target-ok @MyAnnotation(value=&quot;on Y&quot;) execution(X Y.bar())" vm="9+"/>
<line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/>
<line text="@within-ok @MyAnnotation(value=&quot;on Y&quot;) execution(X Y.bar())" vm="1.9"/>
<line text="@within-ok @MyAnnotation(value=&quot;on Y&quot;) execution(X Y.bar())" vm="9+"/>
<line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5,1.6,1.7,1.8"/> <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5,1.6,1.7,1.8"/>
<line text="@withincode-ok @MyAnnotation(value=&quot;my-value&quot;) get(X Y.x)" vm="1.9"/>
<line text="@withincode-ok @MyAnnotation(value=&quot;my-value&quot;) get(X Y.x)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>

+ 6
- 6
tests/src/org/aspectj/systemtest/ajc154/ajc154.xml View File

<run class="c.d.DistantResource"> <run class="c.d.DistantResource">
<stdout> <stdout>
<line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="Annotation is @a.b.SimpleAnnotation(classname=&quot;oranges&quot;)" vm="1.9"/>
<line text="Annotation is @a.b.SimpleAnnotation(classname=&quot;oranges&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<run class="c.d.DistantResource"> <run class="c.d.DistantResource">
<stdout> <stdout>
<line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="Annotation is @a.b.SimpleAnnotation(classname=&quot;oranges&quot;)" vm="1.9"/>
<line text="Annotation is @a.b.SimpleAnnotation(classname=&quot;oranges&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<run class="c.d.DistantResource"> <run class="c.d.DistantResource">
<stdout> <stdout>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="1.9"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<run class="c.d.DistantResource"> <run class="c.d.DistantResource">
<stdout> <stdout>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="1.9"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<run class="c.d.DistantResource"> <run class="c.d.DistantResource">
<stdout> <stdout>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="1.9"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<run class="c.d.DistantResource"> <run class="c.d.DistantResource">
<stdout> <stdout>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="1.9"/>
<line text="Annotation is @e.f.SimpleAnnotation2(classname=&quot;oranges&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>

+ 1
- 1
tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml View File

<stdout> <stdout>
<line text="i does not have Anno"/> <line text="i does not have Anno"/>
<line text="j has Banno:@Banno(hoo=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="j has Banno:@Banno(hoo=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="j has Banno:@Banno(hoo=&quot;abc&quot;)" vm="1.9"/>
<line text="j has Banno:@Banno(hoo=&quot;abc&quot;)" vm="9+"/>
<line text="j does not have Anno"/> <line text="j does not have Anno"/>
</stdout></run> </stdout></run>
</ajc-test> </ajc-test>

+ 2
- 2
tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml View File

<run class="AnnoBinding2"> <run class="AnnoBinding2">
<stdout> <stdout>
<line text="get(int AnnoBinding2.field1) @Marker(message=foo)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="get(int AnnoBinding2.field1) @Marker(message=foo)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="get(int AnnoBinding2.field1) @Marker(message=&quot;foo&quot;)" vm="1.9"/>
<line text="get(int AnnoBinding2.field1) @Marker(message=&quot;foo&quot;)" vm="9+"/>
<line text="get(int AnnoBinding2.field2) @Marker(message=bar)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="get(int AnnoBinding2.field2) @Marker(message=bar)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="get(int AnnoBinding2.field2) @Marker(message=&quot;bar&quot;)" vm="1.9"/>
<line text="get(int AnnoBinding2.field2) @Marker(message=&quot;bar&quot;)" vm="9+"/>
<line text="2 ajc$anno$NNN fields"/> <line text="2 ajc$anno$NNN fields"/>
</stdout> </stdout>
</run> </run>

+ 7
- 7
tests/src/org/aspectj/systemtest/ajc169/intertype.xml View File

<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<stdout> <stdout>
<line text="wibble"/> <line text="wibble"/>
<line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_.class)" vm="1.9"/>
<line text="@a.b.c.RelatedType(value=a.b.c.Vote$_.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>

+ 7
- 7
tests/src/org/aspectj/systemtest/ajc170/ajc170.xml View File

<line text="Annotation count is 4"/> <line text="Annotation count is 4"/>
<line text="@AnnoBoolean(value=true, zzz=false)"/> <line text="@AnnoBoolean(value=true, zzz=false)"/>
<line text="@AnnoClass(value=class java.lang.Integer, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@AnnoClass(value=class java.lang.Integer, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@AnnoClass(value=java.lang.Integer.class, ccc=java.lang.String.class)" vm="1.9"/>
<line text="@AnnoClass(value=java.lang.Integer.class, ccc=java.lang.String.class)" vm="9+"/>
<line text="@AnnoLong(value=999, jjj=111)"/> <line text="@AnnoLong(value=999, jjj=111)"/>
<line text="@AnnoString(value=set from xml, sss=xyz)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@AnnoString(value=set from xml, sss=xyz)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@AnnoString(value=&quot;set from xml&quot;, sss=&quot;xyz&quot;)" vm="1.9"/>
<line text="@AnnoString(value=&quot;set from xml&quot;, sss=&quot;xyz&quot;)" vm="9+"/>
<line text="Annotations on field2? true"/> <line text="Annotations on field2? true"/>
<line text="Annotation count is 1"/> <line text="Annotation count is 1"/>
<line text="@AnnoClass(value=class java.lang.String, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@AnnoClass(value=class java.lang.String, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@AnnoClass(value=java.lang.String.class, ccc=java.lang.String.class)" vm="1.9"/>
<line text="@AnnoClass(value=java.lang.String.class, ccc=java.lang.String.class)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<line text="Annotations on field1? true"/> <line text="Annotations on field1? true"/>
<line text="Annotation count is 4"/> <line text="Annotation count is 4"/>
<line text="@AnnoChar(value=z, ccc=a)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@AnnoChar(value=z, ccc=a)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@AnnoChar(value='z', ccc='a')" vm="1.9"/>
<line text="@AnnoChar(value='z', ccc='a')" vm="9+"/>
<line text="@AnnoDouble(value=99.0, ddd=3.0)"/> <line text="@AnnoDouble(value=99.0, ddd=3.0)"/>
<line text="@AnnoFloat(value=6.0, fff=4.0)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@AnnoFloat(value=6.0, fff=4.0)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@AnnoFloat(value=6.0f, fff=4.0f)" vm="1.9"/>
<line text="@AnnoFloat(value=6.0f, fff=4.0f)" vm="9+"/>
<line text="@AnnoShort(value=8, sss=3)"/> <line text="@AnnoShort(value=8, sss=3)"/>
<line text="Annotations on field2? true"/> <line text="Annotations on field2? true"/>
<line text="Annotation count is 2"/> <line text="Annotation count is 2"/>
<line text="Annotations on field1? true"/> <line text="Annotations on field1? true"/>
<line text="Annotation count is 1"/> <line text="Annotation count is 1"/>
<line text="@Annot(a=a, fred=false, value=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@Annot(a=a, fred=false, value=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@Annot(a='a', fred=false, value=&quot;abc&quot;)" vm="1.9"/>
<line text="@Annot(a='a', fred=false, value=&quot;abc&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>
<line text="Annotations on field1? true"/> <line text="Annotations on field1? true"/>
<line text="Annotation count is 1"/> <line text="Annotation count is 1"/>
<line text="@Annot(a=a, fred=false, value=abc)" vm="1.4,1.5,1.6,1.7,1.8"/> <line text="@Annot(a=a, fred=false, value=abc)" vm="1.4,1.5,1.6,1.7,1.8"/>
<line text="@Annot(a='a', fred=false, value=&quot;abc&quot;)" vm="1.9"/>
<line text="@Annot(a='a', fred=false, value=&quot;abc&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>

+ 1
- 1
tests/src/org/aspectj/systemtest/ajc173/ajc173.xml View File

<run class="Hello"> <run class="Hello">
<stdout> <stdout>
<line text="@MyAnnotation(dummy1=, dummy2=korte)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="@MyAnnotation(dummy1=, dummy2=korte)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="@MyAnnotation(dummy1=&quot;&quot;, dummy2=&quot;korte&quot;)" vm="1.9"/>
<line text="@MyAnnotation(dummy1=&quot;&quot;, dummy2=&quot;korte&quot;)" vm="9+"/>
</stdout> </stdout>
</run> </run>
</ajc-test> </ajc-test>

+ 0
- 4
tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java View File

*/ */
public class Ajc190Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public class Ajc190Tests extends org.aspectj.testing.XMLBasedAjcTestCase {


public void testVarious_SettingFinalStatic() {
runTest("setting static final outside clinit");
}

public void testAnnotMethodHasMember_pr156962_1() { // From similar in Ajc153Tests public void testAnnotMethodHasMember_pr156962_1() { // From similar in Ajc153Tests
runTest("Test Annot Method Has Member 1"); runTest("Test Annot Method Has Member 1");
} }

+ 1
- 1
tests/src/org/aspectj/systemtest/ajc190/ajc190_from150.xml View File

<line text="1 @Foo()"/> <line text="1 @Foo()"/>
<line text="1 @Foo()"/> <line text="1 @Foo()"/>
<line text="1 @Classified(classification=TOP-SECRET)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> <line text="1 @Classified(classification=TOP-SECRET)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/>
<line text="1 @Classified(classification=&quot;TOP-SECRET&quot;)" vm="1.9"/>
<line text="1 @Classified(classification=&quot;TOP-SECRET&quot;)" vm="9+"/>
<line text="This information is TOP-SECRET"/> <line text="This information is TOP-SECRET"/>
<line text="Entering critical join point with priority 3"/> <line text="Entering critical join point with priority 3"/>
<line text="Entering critical join point with reflectively obtained priority 3"/> <line text="Entering critical join point with reflectively obtained priority 3"/>

+ 34
- 11
util/src/org/aspectj/util/LangUtil.java View File

return Double.toString(vmVersion); return Double.toString(vmVersion);
} }
public static double getVmVersion() {
return vmVersion;
}
static { static {
StringWriter buf = new StringWriter(); StringWriter buf = new StringWriter();
PrintWriter writer = new PrintWriter(buf); PrintWriter writer = new PrintWriter(buf);
} }


static { static {
// http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html
// http://openjdk.java.net/jeps/223 "New Version-String Scheme"
try { try {
String vm = System.getProperty("java.version"); // JLS 20.18.7 String vm = System.getProperty("java.version"); // JLS 20.18.7
if (vm == null) { if (vm == null) {
.printStackTrace(System.err); .printStackTrace(System.err);
vmVersion = 1.5; vmVersion = 1.5;
} else { } else {
if (vm.startsWith("9")) {
// JDK 9 beta 99 starts using 9-ea as the version string.
vmVersion = 1.9;
} else {
try {
String versionString = vm.substring(0, 3);
Double temp = new Double(Double.parseDouble(versionString));
vmVersion = temp.doubleValue();
} catch (Exception e) {
vmVersion = 1.4;
// Version: [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
// Care about the first set of digits and second set if first digit is 1
try {
List<Integer> numbers = getFirstNumbers(vm);
if (numbers.get(0) == 1) {
// Old school for 1.0 > 1.8
vmVersion = numbers.get(0)+(numbers.get(1)/10d);
} else {
// numbers.get(0) is the major version (9 and above)
// Note here the number will be 9 (or 10), *not* 1.9 or 1.10
vmVersion = numbers.get(0);
} }
} catch (Throwable t) {
// Give up
vmVersion = 1.5;
} }
} }
} catch (Throwable t) { } catch (Throwable t) {
vmVersion = 1.5; vmVersion = 1.5;
} }
} }
private static List<Integer> getFirstNumbers(String vm) {
List<Integer> result = new ArrayList<Integer>();
StringTokenizer st = new StringTokenizer(vm,".-_");
try {
result.add(Integer.parseInt(st.nextToken()));
result.add(Integer.parseInt(st.nextToken()));
} catch (Exception e) {
// NoSuchElementException if no more tokens
// NumberFormatException if not a number
}
return result;
}


public static boolean is13VMOrGreater() { public static boolean is13VMOrGreater() {
return 1.3 <= vmVersion; return 1.3 <= vmVersion;
} }
public static boolean is19VMOrGreater() { public static boolean is19VMOrGreater() {
return 1.9 <= vmVersion;
return 9 <= vmVersion;
} }


/** /**

weaver/testdata/StaticTjpBeforeHelloWorld.1.9.txt → weaver/testdata/StaticTjpBeforeHelloWorld.9.0.txt View File


weaver/testdata/TjpAround2HelloWorld.1.9.txt → weaver/testdata/TjpAround2HelloWorld.9.0.txt View File


weaver/testdata/TjpAroundHelloWorld.1.9.txt → weaver/testdata/TjpAroundHelloWorld.9.0.txt View File


weaver/testdata/TjpBeforeHelloWorld.1.9.txt → weaver/testdata/TjpBeforeHelloWorld.9.0.txt View File


Loading…
Cancel
Save