ASTParser - Running on JDK11, analysing JDK8 classes [message #1851108] |
Mon, 28 March 2022 04:59  |
Eclipse User |
|
|
|
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 #1851531 is a reply to message #1851146] |
Thu, 07 April 2022 11:11  |
Eclipse User |
|
|
|
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...
|
|
|
Powered by
FUDForum. Page generated in 0.03604 seconds