-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java] Support Java 23 #5112
[java] Support Java 23 #5112
Conversation
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableId.java
Outdated
Show resolved
Hide resolved
.../src/main/java/net/sourceforge/pmd/lang/java/symbols/table/internal/SymbolTableResolver.java
Outdated
Show resolved
Hide resolved
.../src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/ast/AstSymbolMakerVisitor.java
Outdated
Show resolved
Hide resolved
Generated by 🚫 Danger |
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTImportDeclaration.java
Show resolved
Hide resolved
Also, 24-ea is available to GitHub actions, which we use over at Apache Commons as we do 23-ea, but all these fail due to the dependency on ASM 9.6. |
8353ccd
to
3cb4c4a
Compare
This is now possible, since java 21 preview is gone.
... and Instance Main Methods" (JEP 477) - language feature is renamed - update symbol table resolver
- new JModuleSymbol - UnnecessaryImportRule also supports module imports - module-info.class can be loaded by ClasspathClassLoader - Support annotations on modules - Verify that exported packages are loaded
Allow to use primitive types in patterns, instanceof, and switch. This is a Java 23 Preview feature. See JEP 455.
JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview)
Import by default module java.base and java.io.IO.*
Reuse the classloader for auxclasspath instead of creating a new one for every single rule test case.
3cb4c4a
to
f33e75c
Compare
Also add some @SInCE tags to new API methods
f33e75c
to
21d499d
Compare
.../src/main/java/net/sourceforge/pmd/lang/java/symbols/table/internal/SymbolTableResolver.java
Outdated
Show resolved
Hide resolved
pmd-core/src/main/java/net/sourceforge/pmd/internal/util/ClasspathClassLoader.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Clément Fournier <[email protected]>
@Override | ||
public @Nullable JTypeMirror resolveFirst(String simpleName) { | ||
for (String module : moduleNames) { | ||
JModuleSymbol moduleSymbol = symbolResolver.resolveModule(module); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be cached in the name resolver, otherwise it will perform a classloader lookup and parse the module file for every name that is requested (which is probably all the type identifiers in the compilation unit).
} | ||
|
||
for (String packageName : moduleSymbol.getExportedPackages()) { | ||
JClassSymbol sym = symbolResolver.resolveClassFromCanonicalName(packageName + "." + simpleName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should resolve from binary name instead of canonical name, otherwise it will try every package segment. But we know that these segments are packages and not outer classes. This is different from type import on demand, because these can import inner types too.
Describe the PR
This is ready now.
I pushed the branch is directly to our main repo on github: https://github.com/pmd/pmd/tree/issue-5062-support-java-23.
Java 23 is GA in September, which means it would be great, if we could finish this latest in August, so that in lands in PMD 7.5.0 to be released end of August.
Related issues
Ready?
./mvnw clean verify
passes (checked automatically by github actions)