Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ASTParser - Running on JDK11, analysing JDK8 classes
ASTParser - Running on JDK11, analysing JDK8 classes [message #1851108] Mon, 28 March 2022 08:59 Go to next message
Juanma Leflet is currently offline Juanma LefletFriend
Messages: 2
Registered: March 2022
Junior Member
Hello,

We need to analyse JDK8 classes running the JDT ASTParser from a JDK11 application. Since some classes and methods have been removed in the upgrade from JDK8 to JDK11, some of the JDK8 APIs that might be being used in the JDK8 classes to be analysed might not be present in the boot classpath of the JDK11 app. This is a problem, since the ASTParser won't be able to find these references, and will report these links as "broken".

We have found a way around this problem by creating a JAR file with the missing classes and passing it to the ASTParser as a classpathEntry. We also had to "clone" the ASTParser class in order to change the getClasspath method - the order in which the boot classpath was being loaded wasn't working for us, and had to call collectRunningVMBootclasspath last.

We were wondering if there's a simpler way of doing this. Is this a problem you were aware of?

Thank you.
Re: ASTParser - Running on JDK11, analysing JDK8 classes [message #1851146 is a reply to message #1851108] Tue, 29 March 2022 04:58 Go to previous messageGo to next message
Jay Arthanareeswaran is currently offline Jay ArthanareeswaranFriend
Messages: 128
Registered: July 2009
Senior Member
I don't know much about the AST Parser, but in compiler in general, if you pass the --release option, then you will be able to work with the Java 8 system classes even when you are running a JDK 11. If you using IJavaProject with ASTParser, it might be possible to achieve this using --release option.
Re: ASTParser - Running on JDK11, analysing JDK8 classes [message #1851531 is a reply to message #1851146] Thu, 07 April 2022 15:11 Go to previous message
Juanma Leflet is currently offline Juanma LefletFriend
Messages: 2
Registered: March 2022
Junior Member
Hi Jay, thank you for your answer. I took a look and, unfortunately, that option seems to be exclusively for the compiler. There's a similar option for the ASTParser, but it doesn't do what I need. I guess it makes sense, since, for the parser to be able to detect JDK 8 classes when running on JDK 11, it needs those missing classes that were removed...
Previous Topic:Strange debugging behavior
Next Topic:Detail formatter code and class resolving
Goto Forum:
  


Current Time: Fri Apr 19 21:55:51 GMT 2024

Powered by FUDForum. Page generated in 0.03572 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top