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

Contradicting advice about -XDcompilePolicy #1322

Closed
PhilippWendler opened this issue Jul 30, 2019 · 3 comments · Fixed by #2071
Closed

Contradicting advice about -XDcompilePolicy #1322

PhilippWendler opened this issue Jul 30, 2019 · 3 comments · Fixed by #2071

Comments

@PhilippWendler
Copy link

If error-prone is used and -XDcompilePolicy is not used as command-line argument for javac, error-prone throws an exception with the following message

Exception in thread "main" com.sun.tools.javac.util.PropagatedException: com.google.errorprone.InvalidCommandLineOptionException: The default compilation policy (by-todo) is not supported by Error Prone, pass -XDcompilePolicy=byfile instead

An exception with the same recommendation occurs if an unsupported compile policy is specified.

However, the installation instructions specify to pass -XDcompilePolicy=simple (for all of the build systems).

Since d4b291e error-prone accepts both compile policies, but which one is preferred?

The same compile policy should be suggested by the error message and by the documentation to avoid confusion.

Does https://bugs.openjdk.java.net/browse/JDK-8155674 mean that byfile is the better choice? Do these compile policies have any relevant effect for the user? I was not able to find any documentation on them.

@cushon
Copy link
Collaborator

cushon commented May 20, 2020

If you're using the Error Prone javac, it has a fix (google/error-prone-javac@94c6b72) that isn't currently in the stock OpenJDK javac, but which is discussed in one of the threads link from JDK-8155674.

If you're using a stock OpenJDK javac, -XDcompilePolicy=simple is currently a better choice.

@PhilippWendler
Copy link
Author

Thanks for the clarification! Might be nice for others if the exception message were adjusted, but if you do not think this is important enough feel free to close this issue.

@cushon
Copy link
Collaborator

cushon commented May 22, 2020

We should probably update the message, or document it somewhere outside the issue.

The hope is still to fix the default compilation policy so it works with Error Prone and avoid the need for the error message, but progress on that has obviously been slow.

copybara-service bot pushed a commit that referenced this issue Jan 7, 2021
to avoid contradictory advice, since `byfile` only works reliably with
`error-prone-javac`, which we're no longer recommending for JDK > 8.

Fixes #1322

PiperOrigin-RevId: 350619212
stevie400 pushed a commit to HubSpot/error-prone that referenced this issue Jan 15, 2021
to avoid contradictory advice, since `byfile` only works reliably with
`error-prone-javac`, which we're no longer recommending for JDK > 8.

Fixes google#1322

PiperOrigin-RevId: 350625679
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