René's URL Explorer Experiment


Title: Replace Guava ImmutableList/ImmutableMap/ImmutableSet with java.util and ban them with forbidden-apis · Issue #202 · openjavaformat/open-java-format · GitHub

Open Graph Title: Replace Guava ImmutableList/ImmutableMap/ImmutableSet with java.util and ban them with forbidden-apis · Issue #202 · openjavaformat/open-java-format

X Title: Replace Guava ImmutableList/ImmutableMap/ImmutableSet with java.util and ban them with forbidden-apis · Issue #202 · openjavaformat/open-java-format

Description: Goal Stop using Guava's ImmutableList, ImmutableMap and ImmutableSet in this repository (all modules, the SPI included) in favour of plain java.util collections, and make the build fail if they come back. Tooling Error Prone has no built...

Open Graph Description: Goal Stop using Guava's ImmutableList, ImmutableMap and ImmutableSet in this repository (all modules, the SPI included) in favour of plain java.util collections, and make the build fail if they com...

X Description: Goal Stop using Guava's ImmutableList, ImmutableMap and ImmutableSet in this repository (all modules, the SPI included) in favour of plain java.util collections, and make the build fail if they...

Opengraph URL: https://github.com/openjavaformat/open-java-format/issues/202

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replace Guava ImmutableList/ImmutableMap/ImmutableSet with java.util and ban them with forbidden-apis","articleBody":"## Goal\n\nStop using Guava's `ImmutableList`, `ImmutableMap` and `ImmutableSet` in this repository (all modules, the SPI included) in favour of plain `java.util` collections, and make the build fail if they come back.\n\n## Tooling\n\nError Prone has no built-in \"ban this class\" check, and Picnic's error-prone-support (0.30.0) pushes the other way (it has many rules around Guava's `Immutable*`). What fits instead:\n\n- **[forbidden-apis](https://github.com/policeman-tools/forbidden-apis) 3.11** (`de.thetaphi.forbiddenapis`): bytecode check, one signature per class in `config/forbidden-apis/guava-immutables.txt`.\n  - Configuration cache: works (stored and reused with no problems on `:open-java-format-spi:forbiddenApisMain`).\n  - Build cache: not supported, `CheckForbiddenApis` is not `@CacheableTask`. It is still `UP-TO-DATE` locally, and the scan takes ~0.03 s.\n  - It needs `ignoreSignaturesOfMissingClasses = true`, otherwise modules without Guava on the classpath (benchmarks) fail while parsing the signatures.\n  - It also flags indirect uses that javac accepts: subclasses (`ImmutableSortedSet`), and Guava methods whose declared return type is an `Immutable*` (`ImmutableRangeMap.asMapOfRanges()`, `ClassPath.getResources()`).\n- Alternatives considered: Checkstyle `IllegalImport` (cacheable, source level, but misses `var`), OpenRewrite `NoGuavaImmutableList*` recipes for the migration itself.\n\n## What was done (local, not pushed)\n\nAbout 46 files across all modules; `./gradlew check` was green, including all tests.\n\n- Mechanical: `ImmutableList.of/copyOf` -> `List.of/copyOf`, `toImmutableList()` -> `Stream.toList()`, builders -> `ArrayList` + `List.copyOf`.\n- `ignoreFailures` removed from the forbidden-apis convention, so the ban actually fails the build.\n- `FileBasedTests` lists test resources with `Files.walk` instead of Guava's `ClassPath`.\n- `Input.getPositionTokenMap()` now returns `RangeMap` (was `ImmutableRangeMap`).\n\n## Pitfalls found on the way\n\n- `Set.of` / `Map.of` do not keep insertion order. `Newlines.BREAKS` iterates in order (`\"\\r\\n\"` before `\"\\n\"`), so it became a `List`; `StringWrapper` keeps a `LinkedHashSet`.\n- `Set.of(..).contains(null)` and `List.of(..).contains(null)` throw. `JavaInput.buildToks` calls `contains` with a null token kind for comment tokens; this broke dozens of tests until the check used the (null-tolerant) `HashSet`.\n- Error Prone's `@Immutable` cannot prove `java.util.List`/`Map` immutable, so it had to be removed from `Input.Token`, `JavaInput.Token`, `OpsBuilder.BlankLineWanted`, `InputMetadata` and `doc.Token`.\n- `formatDiff` only formats changed lines and does not re-sort inserted imports.\n\n## Open question: SPI compatibility with Spotless (#200)\n\n#200 keeps `Style.PALANTIR` so Spotless's built-in `palantirJavaFormat()` step keeps working after swapping coordinates. Spotless's glue (`PalantirJavaFormatFormatterFunc`) is linked against `JavaFormatterOptions` (`Style`, `Builder.style`, `formatJavadoc`), `Formatter.createFormatter` / `formatSource`, `ImportOrderer.reorderImports(String, Style)` and `RemoveUnusedImports.removeUnusedImports`. None of these mention `Immutable*`.\n\nThe migration changes one public SPI signature, `FormatterService.getFormatReplacements(...)`: `ImmutableList\u003cReplacement>` -> `List\u003cReplacement>` (also in its implementations). `FormatterException` only changes its private field (`diagnostics()` already returned `List`).\n\nDecide whether the SPI keeps the Guava types (and is excluded from the ban) or changes.\n\n## Next steps\n\n1. Verify binary compatibility against Spotless: compile its `PalantirJavaFormatFormatterFunc` against the old (HEAD) classes and run it against the new ones.\n2. Decide what to do with the SPI signatures above.\n3. Rebase onto `origin/abashev/Fix-error-prone-issues` (two newer commits touch `SnippetFormatter`, `PalantirJavaFormatFormattingService` and `StringWrapper`), reapply the work, and open a PR.\n4. Update the CLAUDE.md line that still allows Guava immutables \"where an existing API already hands one over\".\n","author":{"url":"https://github.com/abashev","@type":"Person","name":"abashev"},"datePublished":"2026-11-08T16:29:50Z","url":"https://github.com/openjavaformat/open-java-format/issues/202"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:965b80de-8270-11f4-bcfc-3a288ac82c4b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id82B4:2A59EB:5E4B8F:7D4C01:6AFBC739
html-safe-noncedf46c65e1454b339289eef65064269653da4648433854ea04b6f743da6c066f8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkI0OjJBNTlFQjo1RTRCOEY6N0Q0QzAxOjZBRkJDNzM5IiwidmlzaXRvcl9pZCI6IjUzMDE4NDE5NTcwNzk0Njc4MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7e7efb919369636897019ee0fa57d762596c2658232e86a65d35e1bd6399055e
hovercard-subject-tagissue:6273051193
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openjavaformat/open-java-format/202/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0eb73fe68500537585a44c1d638d2b1a810629facacd048ce88052b47615c814/openjavaformat/open-java-format/issues/202
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0eb73fe68500537585a44c1d638d2b1a810629facacd048ce88052b47615c814/openjavaformat/open-java-format/issues/202
og:image:altGoal Stop using Guava's ImmutableList, ImmutableMap and ImmutableSet in this repository (all modules, the SPI included) in favour of plain java.util collections, and make the build fail if they com...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameabashev
hostnamegithub.com
expected-hostnamegithub.com
Noned440bda0d812801778b27bfe9f7c1ce9ff22420c73f6f95150c4fcbca311c50b
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2c43021aed8695990c86c0eaaedc600bfeffec36
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/openjavaformat/open-java-format/issues/202#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenjavaformat%2Fopen-java-format%2Fissues%2F202
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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenjavaformat%2Fopen-java-format%2Fissues%2F202
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=openjavaformat%2Fopen-java-format
Reloadhttps://github.com/openjavaformat/open-java-format/issues/202
Reloadhttps://github.com/openjavaformat/open-java-format/issues/202
Reloadhttps://github.com/openjavaformat/open-java-format/issues/202
openjavaformathttps://github.com/openjavaformat
open-java-formathttps://github.com/openjavaformat/open-java-format
Codehttps://github.com/openjavaformat/open-java-format
Issues30 (30)https://github.com/openjavaformat/open-java-format/issues
Pull requests5 (5)https://github.com/openjavaformat/open-java-format/pulls
Discussionshttps://github.com/openjavaformat/open-java-format/discussions
Actionshttps://github.com/openjavaformat/open-java-format/actions
Security and qualityhttps://github.com/openjavaformat/open-java-format/security
Insightshttps://github.com/openjavaformat/open-java-format/pulse
https://github.com/openjavaformat/open-java-format
New issuehttps://github.com/login?return_to=https://github.com/openjavaformat/open-java-format/issues/202
New issuehttps://github.com/login?return_to=https://github.com/openjavaformat/open-java-format/issues/202
#218https://github.com/openjavaformat/open-java-format/pull/218
Replace Guava ImmutableList/ImmutableMap/ImmutableSet with java.util and ban them with forbidden-apishttps://github.com/openjavaformat/open-java-format/issues/202#top
#218https://github.com/openjavaformat/open-java-format/pull/218
https://github.com/abashev
abashevhttps://github.com/abashev
on Nov 8, 2026https://github.com/openjavaformat/open-java-format/issues/202#issue-6273051193
forbidden-apishttps://github.com/policeman-tools/forbidden-apis
#200https://github.com/openjavaformat/open-java-format/pull/200
#200https://github.com/openjavaformat/open-java-format/pull/200
abashevhttps://github.com/abashev
completedhttps://github.com/openjavaformat/open-java-format/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#218https://github.com/openjavaformat/open-java-format/pull/218
on Nov 12, 2026https://github.com/openjavaformat/open-java-format/issues/202#event-35944098962
Sign up for freehttps://github.com/signup?return_to=https://github.com/openjavaformat/open-java-format/issues/202
Sign in to commenthttps://github.com/login?return_to=https://github.com/openjavaformat/open-java-format/issues/202
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.