Skip to content
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

Plugin Compatibility with Eclipse running on Java 16 #281

Closed
jorsol opened this issue Mar 23, 2021 · 2 comments · Fixed by #288
Closed

Plugin Compatibility with Eclipse running on Java 16 #281

jorsol opened this issue Mar 23, 2021 · 2 comments · Fixed by #288

Comments

@jorsol
Copy link

jorsol commented Mar 23, 2021

Java 16 comes with JEP 396: Strongly Encapsulate JDK Internals by Default

When using Java 16 in Eclipse the plugin fails with:

Errors occurred during the build.
Errors running builder 'Checkstyle Builder' on project 'common'.
Unable to make field private static volatile java.net.Authenticator 
java.net.Authenticator.theAuthenticator accessible: module java.base does not 
"opens java.net" to unnamed module @5cfdefb7
@romani
Copy link
Member

romani commented Apr 2, 2021

please open ticket at https://github.com/checkstyle/checkstyle/
plugin just do integration with Eclipse, no logic on parsing and validation, all this logic is in library.
Library is updated to support only up to jdk14 syntax :(.

@romani romani closed this as completed Apr 2, 2021
@jorsol
Copy link
Author

jorsol commented Apr 9, 2021

Hi @romani, sorry if I was not clear, but the issue is "running" Eclipse with Java 16 as runtime (not with the parsing or validation of Java 16 syntax), so yes this is related to the plugin integration with Eclipse. I point out the JEP 396 since that JEP enables the encapsulation of JDK internals and this plugin makes a hack around java.net.Authenticator wich triggers the error.

// Hack to get the current authenticator
Field[] fields = Authenticator.class.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (Authenticator.class.equals(fields[i].getType())) {
fields[i].setAccessible(true);
currentDefault = (Authenticator) fields[i].get(Authenticator.class);
break;
}
}

Just as a suggestion, recent versions of Eclipse (since Eclipse 4.17 (2020-09)) requires Java 11 as minimum, so this plugin could probably make use of the new HTTP Client of Java 11 instead of hacking around HttpURLConnection.

@romani romani reopened this Apr 10, 2021
@romani romani changed the title Compatibility with Java 16 Plugin Compatibility with Eclipse running on Java 16 Apr 10, 2021
Calixte added a commit to Calixte/eclipse-cs that referenced this issue Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants