Skip to content

Fix a Refaster crash on module-info.java files. - #6058

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_968532824
Aug 21, 2026
Merged

Fix a Refaster crash on module-info.java files.#6058
copybara-service[bot] merged 1 commit into
masterfrom
test_968532824

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Fix a Refaster crash on module-info.java files.

UMemberSelect#visitIdentifier unconditionally dereferences sym.owner, but module symbols have no owner: Symbol.ModuleSymbol#create always passes null. Any Refaster rule whose @BeforeTemplate is rooted at an instance member select then crashes the compiler as soon as it scans a requires directive whose module name is a single identifier.

Module names that contain a dot are parsed as member selects instead, and #visitMemberSelect is already null-safe; as every JDK module name contains a dot, this has so far gone unnoticed.

Reported at PicnicSupermarket/error-prone-support#2316.
Fixes #6055

`UMemberSelect#visitIdentifier` unconditionally dereferences `sym.owner`, but module symbols have no owner: `Symbol.ModuleSymbol#create` always passes `null`. Any Refaster rule whose `@BeforeTemplate` is rooted at an instance member select then crashes the compiler as soon as it scans a `requires` directive whose module name is a single identifier.

Module names that contain a dot are parsed as member selects instead, and `#visitMemberSelect` is already null-safe; as every JDK module name contains a dot, this has so far gone unnoticed.

Reported at PicnicSupermarket/error-prone-support#2316.
Fixes #6055

PiperOrigin-RevId: 968565585
@copybara-service
copybara-service Bot merged commit 674e2c8 into master Aug 21, 2026
@copybara-service
copybara-service Bot deleted the test_968532824 branch August 21, 2026 17:19
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 this pull request may close these issues.

1 participant