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

Refaster template compilation instructions are out of date or unclear #4261

Open
timo-a opened this issue Jan 25, 2024 · 2 comments
Open

Refaster template compilation instructions are out of date or unclear #4261

timo-a opened this issue Jan 25, 2024 · 2 comments

Comments

@timo-a
Copy link

timo-a commented Jan 25, 2024

Following https://errorprone.info/docs/refaster I created a new file StringIsEmpty.java (in an empty directory) and ran:

$ wget http://repo1.maven.org/maven2/com/google/errorprone/error_prone_refaster/2.3.1/error_prone_refaster-2.3.1.jar
--2024-01-25 21:56:41--  http://repo1.maven.org/maven2/com/google/errorprone/error_prone_refaster/2.3.1/error_prone_refaster-2.3.1.jar
Resolving repo1.maven.org (repo1.maven.org)... 2a04:4e42:8d::209, 146.75.116.209
Connecting to repo1.maven.org (repo1.maven.org)|2a04:4e42:8d::209|:80... connected.
HTTP request sent, awaiting response... 501 HTTPS Required
2024-01-25 21:56:41 ERROR 501: HTTPS Required.

➡️ This information is out of date the URL needs to have https

Then, I ran

$ javac -version
javac 17.0.8
$ javac \
  -cp error_prone_refaster-2.3.1.jar \
  "-Xplugin:RefasterRuleCompiler --out ${PWD}/myrule.refaster" \
  StringIsEmpty.java
Exception in thread "main" java.lang.IllegalAccessError: class com.google.errorprone.refaster.RefasterRuleCompiler (in unnamed module @0x6b143ee9) cannot access class com.sun.tools.javac.api.BasicJavacTask (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.api to unnamed module @0x6b143ee9
        at com.google.errorprone.refaster.RefasterRuleCompiler.init(RefasterRuleCompiler.java:51)
        at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugin(BasicJavacTask.java:255)
        at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugins(BasicJavacTask.java:229)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:292)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
        at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
        at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)

➡️ compile instructions are either out of date or not fool proof

A look at the maven repo reveals that the current version is 2.24.1, I get the same error however.

➡️ error_prone_refaster version needs to be updated

@timo-a timo-a changed the title Refaster template compilation instructions are out of date Refaster template compilation instructions are out of date or unclear Jan 25, 2024
@trebele-tibco
Copy link

I had the same error. I got it working for my purposes with Java 11.

@renannprado
Copy link

I have the same issue, but I've just tried to use error-prone with Java 21.

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

No branches or pull requests

3 participants