Comments (6)
To also confirm, this worked on jdk 15:
openjdk version "15.0.4" 2021-07-20
OpenJDK Runtime Environment Zulu15.34+17-CA (build 15.0.4+5-MTS)
OpenJDK 64-Bit Server VM Zulu15.34+17-CA (build 15.0.4+5-MTS, mixed mode, sharing)
from palantir-java-format.
This is due to JEP 396: Strongly Encapsulate JDK Internals by Default
We haven't adopted java 16 internally since the supported lifespan is too short for us to roll off in time, however we're beginning to work on Java 17 support.
from palantir-java-format.
That JEP dangles some tantalising options:
It will still be possible to use the --add-opens command-line option, or the Add-Opens JAR-file manifest attribute, to open specific packages.
https://openjdk.java.net/jeps/261#Packaging:-Modular-JAR-files - could this be as easy as just embedding a module-info.class file that specifies all the crazy --add-opens things this project needs?
palantir-java-format/build.gradle
Line 85 in 409f42e
EDIT seems like I confused --add-exports
with --add-opens
- maybe this won't be so easy
from palantir-java-format.
Some relevant context from how google-java-format is tackling this: issue, readme.
Basically their solution for running with Java16+ is that you have to run the formatter with --add-exports
flags added. Bit unfortunate and we might have to do some hacky stuff to get this working as Gradle integration or with the intellij plugin. One option might be to do something like bootstrapping our own jre when trying to format some files so we can pass through our flags (as mentioned here).
from palantir-java-format.
The latest version should work with Java 16+. However depending on how you invoke the formatter you need to add --add-exports
flags due to JEP 396: Strongly Encapsulate JDK Internals by Default.
When running the formatter through Gradle, you can for example add the args to your gradle.properties
file:
org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
The intellij plugin and integration with palantir/goethe will automatically add these flags for you.
Closing this issue for now. Please re-open if you run into further issues!
from palantir-java-format.
Note that I couldn't get goethe to add the flags in modern gradle (filed here: palantir/goethe#91)
from palantir-java-format.
Related Issues (20)
- Inconsistent/Incorrect indentation for Java `Record` object HOT 3
- Add Eclipse plugin to Github release
- Feature Request: Indent `Record` constructor to be `4` spaces instead of `8` HOT 2
- README.md -> IntelliJ plugin section has wrong paths to the IDE menu
- Poor formatting around expression switches
- Non-deterministic indentation when 2nd, 4th, etc arguments of methods are long
- Bad formatting for empty enum
- Formatting shortcut not intercepted in IntelliJ 2024.1 HOT 20
- Project import fails with JetBrains Fleet
- [Feature] Support GitHub Action HOT 1
- Poor formatting of generic parameters on methods when class names are long
- IntelliJ-Plugin: Line break is added for empty record HOT 1
- Eclipse plugin does not seem to work HOT 1
- Unnecessary line breaks and missed (maybe?) line breaks
- Intellij plugin: missed newlines on IDE auto-completion HOT 6
- not format
- Error when installing palantir plugin in Intellij 2024.1.1
- Excessive import optimization in intellij HOT 2
- Apply baseline's NullAway on this repo
- Update IntelliJ integration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from palantir-java-format.