Bug 515612 - [1.9] @annotation does not work with Java 9
Summary: [1.9] @annotation does not work with Java 9
Status: CLOSED INVALID
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.10   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-22 14:12 EDT by Helo Spark CLA
Modified: 2017-04-25 00:34 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Helo Spark CLA 2017-04-22 14:12:02 EDT
In Java 9 the format of "java.version" has changed in JEP223 (http://openjdk.java.net/jeps/223) to no longer use the 1.x.* format, but instead use "9*" format.
With Java 9 early access (9-ea) release, expression with "@annotation" throws the following exception:

java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
	at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301)

On first sight the problem is that in:
"util/src/org/aspectj/util/LangUtil.java"

java.version string is parsed as:
try {
	String versionString = vm.substring(0, 3);
	Double temp = new Double(Double.parseDouble(versionString));
	vmVersion = temp.doubleValue();
} catch (Exception e) {
	vmVersion = 1.4;
}

vm is the "java.version" system variable, that no longer follows the 1.x format (in early release case it is 9-ea, on the stable release it will be simply "9", and with later minor/major releases 9.x.y).
9-e will not be parsed to Double and will throw an exception, so vmVersion is set to 1.4.
Comment 1 Andrew Clement CLA 2017-04-24 11:51:05 EDT
If you want to use a 1.9 JVM, you should use AspectJ for Java9 and not AspectJ 1.8. AspectJ 1.9.0 is currently on beta5.

http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/aspectj-1.9.0.BETA-5.jar

maven:

<repository>
    <id>repo.spring.io</id>
    <name>SpringSource milestones</name>
    <url>http://repo.spring.io/milestone</url>
</repository>

version: 1.9.0.BETA-5
Comment 2 Helo Spark CLA 2017-04-25 00:34:59 EDT
Thank you Andrew, I'm closing this ticket now.
I have only checked the latest version in central repository and the code in master.