René's URL Explorer Experiment


Title: Say how to run the formatter when the Gradle JVM hides javac by abashev · Pull Request #79 · openjavaformat/open-java-format · GitHub

Open Graph Title: Say how to run the formatter when the Gradle JVM hides javac by abashev · Pull Request #79 · openjavaformat/open-java-format

X Title: Say how to run the formatter when the Gradle JVM hides javac by abashev · Pull Request #79 · openjavaformat/open-java-format

Description: Closes #19. The bug In a build that applies dev.openjavaformat.java-format and nothing else, ./gradlew formatDiff printed Formatting and then failed with the raw error from the formatter's first file: > class com.palantir.javaformat.java.JavaInput (in unnamed module @0x…) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x… The formatter reads javac's internals, and a plain Gradle daemon exports none of them. Nothing in the error says what to change. The fix JavaFormatExtension, which loads the formatter into the daemon for formatDiff and for the Spotless step, checks up front whether jdk.compiler exports the five packages the formatter needs to the formatter's class loader (Module.isExported). If not, it fails before the first file with the two settings that make the formatter run and the page that explains them: > open-java-format cannot run inside this Gradle JVM: module jdk.compiler does not export com.sun.tools.javac.file, com.sun.tools.javac.parser, com.sun.tools.javac.tree to it. Set one of these in gradle.properties: openjavaformat.native.formatter=true runs the formatter as a native binary, outside the Gradle JVM (Linux with glibc, macOS, Windows on x86-64) 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 opens javac's packages to the Gradle JVM; if the file already sets org.gradle.jvmargs, add the flags to that line See https://openjavaformat.dev/get-started/gradle/#choose-how-the-formatter-runs The message lists only the packages that are missing: a Gradle daemon exports com.sun.tools.javac.api and .util on its own, the other three it does not. The Spotless step goes through the same loader, so a Spotless build without the flags gets the same message instead of the raw error. The native path does not load the formatter into the daemon and is unchanged. A JVM without the jdk.compiler module at all (a JRE) gets its own one-line message. Checked In a consumer project against the plugin published to a scratch Maven repository, as #19 asks, with Gradle 9.7.1 on Temurin 21: on main, the raw error above after Formatting ; with this change and no gradle.properties, the message above, exit code 1, and the file untouched; with the five flags, the changed lines are formatted. The native variant was not run here: it needs the native image built and published, and its code path is not touched. FormatDiffWithoutJavacExportsTest, a TestKit project without the flags, pins the message, that no IllegalAccessError and no Formatting line appear, and that the file is not written. It lives in its own class because PalantirJavaFormatPluginTest runs only in the native CI jobs, which have the binary. ./gradlew :gradle-open-java-format:test: 23 tests, all green; :gradle-open-java-format:check passes. Follow-up The Gradle page on the website says that without one of the two settings formatDiff fails with an IllegalAccessError; once this is released it fails with the message above, and that sentence can go.

Open Graph Description: Closes #19. The bug In a build that applies dev.openjavaformat.java-format and nothing else, ./gradlew formatDiff printed Formatting <file> and then failed with the raw error from the formatt...

X Description: Closes #19. The bug In a build that applies dev.openjavaformat.java-format and nothing else, ./gradlew formatDiff printed Formatting &lt;file&gt; and then failed with the raw error from the...

Opengraph URL: https://github.com/openjavaformat/open-java-format/pull/79

X: @github

direct link

Domain: redirect.github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:24ff5788-819e-18bb-199c-85ed5406d81a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC524:359DAD:98748:D4029:6AFBD8E7
html-safe-nonced5933397bd7ebfcb39b14988e1f7ba905c3be33908eebf23d39ec01520d974d4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTI0OjM1OURBRDo5ODc0ODpENDAyOTo2QUZCRDhFNyIsInZpc2l0b3JfaWQiOiIzMDUwMDYyNzkzNTk2OTgzNTI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac868e72ef326bb90e3e225523dc19d890985784f1485d89bfe94c5cc1ff41f96f
hovercard-subject-tagpull_request:4638303210
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/openjavaformat/open-java-format/pull/79/files
twitter:imagehttps://avatars.githubusercontent.com/u/214171?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/214171?s=400&v=4
og:image:altCloses #19. The bug In a build that applies dev.openjavaformat.java-format and nothing else, ./gradlew formatDiff printed Formatting <file> and then failed with the raw error from the formatt...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None18742cb872ec73544356e60359266b67aafece70c4ce008042e06227924cdd07
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/openjavaformat/open-java-format git https://github.com/openjavaformat/open-java-format.git
octolytics-dimension-user_id325177626
octolytics-dimension-user_loginopenjavaformat
octolytics-dimension-repository_id1288055459
octolytics-dimension-repository_nwoopenjavaformat/open-java-format
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id214273098
octolytics-dimension-repository_parent_nwopalantir/palantir-java-format
octolytics-dimension-repository_network_root_id214273098
octolytics-dimension-repository_network_root_nwopalantir/palantir-java-format
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release820be804f18e1ef3940bd74a00d41d73d02e2b91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files#start-of-content
https://redirect.github.com/
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenjavaformat%2Fopen-java-format%2Fpull%2F79%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenjavaformat%2Fopen-java-format%2Fpull%2F79%2Ffiles
Sign uphttps://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=openjavaformat%2Fopen-java-format
Reloadhttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
Reloadhttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
Reloadhttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
openjavaformathttps://redirect.github.com/openjavaformat
open-java-formathttps://redirect.github.com/openjavaformat/open-java-format
Codehttps://redirect.github.com/openjavaformat/open-java-format
Issues30 (30)https://redirect.github.com/openjavaformat/open-java-format/issues
Pull requests5 (5)https://redirect.github.com/openjavaformat/open-java-format/pulls
Discussionshttps://redirect.github.com/openjavaformat/open-java-format/discussions
Actionshttps://redirect.github.com/openjavaformat/open-java-format/actions
Security and qualityhttps://redirect.github.com/openjavaformat/open-java-format/security
Insightshttps://redirect.github.com/openjavaformat/open-java-format/pulse
Sign up for GitHub https://redirect.github.com/signup?return_to=%2Fopenjavaformat%2Fopen-java-format%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://redirect.github.com/login?return_to=%2Fopenjavaformat%2Fopen-java-format%2Fissues%2Fnew%2Fchoose
abashevhttps://redirect.github.com/abashev
mainhttps://redirect.github.com/openjavaformat/open-java-format/tree/main
format-diff-javac-exports-messagehttps://redirect.github.com/openjavaformat/open-java-format/tree/format-diff-javac-exports-message
Conversation 0 https://redirect.github.com/openjavaformat/open-java-format/pull/79
Commits 2 https://redirect.github.com/openjavaformat/open-java-format/pull/79/commits
Checks 15 https://redirect.github.com/openjavaformat/open-java-format/pull/79/checks
Files changed https://redirect.github.com/openjavaformat/open-java-format/pull/79/files
Please reload this pagehttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
Say how to run the formatter when the Gradle JVM hides javac https://redirect.github.com/openjavaformat/open-java-format/pull/79/files#top
Show all changes 2 commits https://redirect.github.com/openjavaformat/open-java-format/pull/79/files
a9f92e5 Say how to run the formatter when the Gradle JVM hides javac abashev Sep 25, 2026 https://redirect.github.com/openjavaformat/open-java-format/pull/79/commits/a9f92e56d3e816608272ea3cfae29b9619937259
2dc5197 Write the javac exports message as a text block abashev Sep 25, 2026 https://redirect.github.com/openjavaformat/open-java-format/pull/79/commits/2dc5197d9148b2913c1926a29b90a3afcd82f8d0
Clear filters https://redirect.github.com/openjavaformat/open-java-format/pull/79/files
Please reload this pagehttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
Please reload this pagehttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
JavaFormatExtension.java https://redirect.github.com/openjavaformat/open-java-format/pull/79/files#diff-e462d01ff1a9cad24cf0d06770a9a8d424fd8efed798f8548ede82dc659c7412
FormatDiffWithoutJavacExportsTest.java https://redirect.github.com/openjavaformat/open-java-format/pull/79/files#diff-a600277f9e321a7068e4efc6414c1dcad345b49ff9dd04733aa24afdd5d16db9
...le-open-java-format/src/main/java/com/palantir/javaformat/gradle/JavaFormatExtension.javahttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files#diff-e462d01ff1a9cad24cf0d06770a9a8d424fd8efed798f8548ede82dc659c7412
View file https://redirect.github.com/openjavaformat/open-java-format/blob/2dc5197d9148b2913c1926a29b90a3afcd82f8d0/gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/JavaFormatExtension.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/openjavaformat/open-java-format/pull/79/{{ revealButtonHref }}
https://redirect.github.com/openjavaformat/open-java-format/pull/79/files#diff-e462d01ff1a9cad24cf0d06770a9a8d424fd8efed798f8548ede82dc659c7412
https://redirect.github.com/openjavaformat/open-java-format/pull/79/files#diff-e462d01ff1a9cad24cf0d06770a9a8d424fd8efed798f8548ede82dc659c7412
...ormat/src/test/java/com/palantir/javaformat/gradle/FormatDiffWithoutJavacExportsTest.javahttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files#diff-a600277f9e321a7068e4efc6414c1dcad345b49ff9dd04733aa24afdd5d16db9
View file https://redirect.github.com/openjavaformat/open-java-format/blob/2dc5197d9148b2913c1926a29b90a3afcd82f8d0/gradle-open-java-format/src/test/java/com/palantir/javaformat/gradle/FormatDiffWithoutJavacExportsTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/openjavaformat/open-java-format/pull/79/{{ revealButtonHref }}
Please reload this pagehttps://redirect.github.com/openjavaformat/open-java-format/pull/79/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.