René's URL Explorer Experiment


Title: A cast breaks inside its type when the call around it stays on one line · Issue #60 · openjavaformat/open-java-format · GitHub

Open Graph Title: A cast breaks inside its type when the call around it stays on one line · Issue #60 · openjavaformat/open-java-format

X Title: A cast breaks inside its type when the call around it stays on one line · Issue #60 · openjavaformat/open-java-format

Description: What Found while formatting the JDK 21 sources with main (86cdc74e). sun.rmi.transport.tcp.TCPTransport comes out as: @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel...

Open Graph Description: What Found while formatting the JDK 21 sources with main (86cdc74e). sun.rmi.transport.tcp.TCPTransport comes out as: @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( "sun.rmi.tra...

X Description: What Found while formatting the JDK 21 sources with main (86cdc74e). sun.rmi.transport.tcp.TCPTransport comes out as: @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( &q...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"A cast breaks inside its type when the call around it stays on one line","articleBody":"### What\n\nFound while formatting the JDK 21 sources with main (`86cdc74e`). `sun.rmi.transport.tcp.TCPTransport` comes out as:\n\n```java\n    @SuppressWarnings(\"removal\")\n    static final Log tcpLog = Log.getLog(\n            \"sun.rmi.transport.tcp\", \"tcp\", LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction\u003c\n                            String>)\n                    () -> System.getProperty(\"sun.rmi.transport.tcp.logLevel\"))));\n```\n\nThe cast `(PrivilegedAction\u003cString>)` is cut between `\u003c` and `String`, and the lambda it applies to lands on a third line. Formatting the result again changes nothing, so this is what the file settles on.\n\nWanted: the arguments of `getLog` one per line, and the cast whole, on the line with its lambda:\n\n```java\n    @SuppressWarnings(\"removal\")\n    static final Log tcpLog = Log.getLog(\n            \"sun.rmi.transport.tcp\",\n            \"tcp\",\n            LogStream.parseLevel(AccessController.doPrivileged(\n                    (PrivilegedAction\u003cString>) () -> System.getProperty(\"sun.rmi.transport.tcp.logLevel\"))));\n```\n\nOne call shallower, the same cast is right today:\n\n```java\n    static final Level level = LogStream.parseLevel(AccessController.doPrivileged(\n            (PrivilegedAction\u003cString>) () -> System.getProperty(\"sun.rmi.transport.tcp.logLevel.and.some.more\")));\n```\n\nSo are a cast lambda as the only argument, a cast of a method reference instead of a lambda, and the same statement in a local variable. The code is palantir-java-format 2.98.0's, so it should format this the same way; google-java-format does not have this layout logic.\n\n### Why\n\nThe arguments of `getLog` are laid out with `breakOnlyIfInnerLevelsThenFitOnOneLine`: keep them on one line when a \"sensible prefix\" fits, where the prefix is everything up to the first break (`CountWidthUntilBreakVisitor`). The first break inside a cast is not the one before its expression but the one `visitParameterizedType` emits right after `\u003c` in its type. The prefix up to there is 113 columns, so it fits, and the type then has to take that break because `String>)` does not fit behind it.\n\n`visitTypeCast` opens its level with `preferBreakingLastInnerLevel` and `LastLevelBreakability.ACCEPT_INLINE_CHAIN`, whose javadoc asks for a level whose first non-level doc is a break. A cast starts with `(`.\n\nConfirmed with a spike that took the break after `\u003c` out of `visitParameterizedType`: with no break inside the type, the prefix runs to the cast's own break, is 121 columns, does not fit, the arguments break one per line, and the statement comes out as in \"wanted\". That spike changes the layout of every long parameterized type (6 goldens), so it is not the fix.\n\n### How\n\nTwo narrow options, neither tried:\n\n- In `visitTypeCast`, lay the type out without a break after `\u003c`, the way `addTypeArguments` does for `ImmutableList.\u003cFoo>of()`. A cast's type is short by nature, and the first break in a cast is then the one before the expression.\n- Or give the cast level a `LastLevelBreakability` that ends the inline chain when the level does not start with a break (`CHECK_INNER`), and check what that does to the shallower shape above, which is right today.\n\n### Compatibility\n\nIt changes the output of that one shape: one statement in the 15,747 files of the JDK 21 sources. The README allows a bug fix to change the output in 2.x, and the Migrate page lists such fixes.\n\n### Done when\n\n- a golden with the `getLog` statement fails today and passes with the fix, and the shallower shape stays as it is;\n- a JDK 21 corpus run shows only that statement moving, and the release notes and the Migrate page say so.\n","author":{"url":"https://github.com/abashev","@type":"Person","name":"abashev"},"datePublished":"2026-09-24T11:03:09Z","url":"https://github.com/openjavaformat/open-java-format/issues/60"}

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:cd7a1518-6083-1c02-ad41-83bca9bf6ada
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8250:3D2B40:594ADC:76F884:6AFBC734
html-safe-noncecdd22747807329b206eb5cb4c5849038fd390616f6ab83d797b207ed0118d534
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjUwOjNEMkI0MDo1OTRBREM6NzZGODg0OjZBRkJDNzM0IiwidmlzaXRvcl9pZCI6IjM5OTk2ODMzMjY5MTc3MjM5NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7ba0aafdd56ef5eba54e861e47d57610a7f4ef5a7d9d65701fc645c1c0c92fa4
hovercard-subject-tagissue:5567302870
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/60/issue_layout
twitter:imagehttps://opengraph.githubassets.com/81a382508ad0a8e6a88a428d177ef688f5ff500d72c77baa2c4b704065df2203/openjavaformat/open-java-format/issues/60
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/81a382508ad0a8e6a88a428d177ef688f5ff500d72c77baa2c4b704065df2203/openjavaformat/open-java-format/issues/60
og:image:altWhat Found while formatting the JDK 21 sources with main (86cdc74e). sun.rmi.transport.tcp.TCPTransport comes out as: @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( "sun.rmi.tra...
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-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/openjavaformat/open-java-format/issues/60#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenjavaformat%2Fopen-java-format%2Fissues%2F60
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%2F60
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/60
Reloadhttps://github.com/openjavaformat/open-java-format/issues/60
Reloadhttps://github.com/openjavaformat/open-java-format/issues/60
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/60
New issuehttps://github.com/login?return_to=https://github.com/openjavaformat/open-java-format/issues/60
#78https://github.com/openjavaformat/open-java-format/pull/78
A cast breaks inside its type when the call around it stays on one linehttps://github.com/openjavaformat/open-java-format/issues/60#top
#78https://github.com/openjavaformat/open-java-format/pull/78
bugSomething isn't workinghttps://github.com/openjavaformat/open-java-format/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/abashev
abashevhttps://github.com/abashev
on Sep 24, 2026https://github.com/openjavaformat/open-java-format/issues/60#issue-5567302870
abashevhttps://github.com/abashev
bugSomething isn't workinghttps://github.com/openjavaformat/open-java-format/issues?q=state%3Aopen%20label%3A%22bug%22
on Sep 24, 2026https://github.com/openjavaformat/open-java-format/issues/60#event-31749891895
abashevhttps://github.com/abashev
completedhttps://github.com/openjavaformat/open-java-format/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#78https://github.com/openjavaformat/open-java-format/pull/78
on Sep 25, 2026https://github.com/openjavaformat/open-java-format/issues/60#event-31836159031
Sign up for freehttps://github.com/signup?return_to=https://github.com/openjavaformat/open-java-format/issues/60
Sign in to commenthttps://github.com/login?return_to=https://github.com/openjavaformat/open-java-format/issues/60
bugSomething isn't workinghttps://github.com/openjavaformat/open-java-format/issues?q=state%3Aopen%20label%3A%22bug%22
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.