Fix a Refaster crash on module-info.java files. - #6058
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_968532824
branch
from
August 21, 2026 17:08
a34c45c to
c6af57d
Compare
`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
Bot
force-pushed
the
test_968532824
branch
from
August 21, 2026 17:19
c6af57d to
674e2c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a Refaster crash on
module-info.javafiles.UMemberSelect#visitIdentifierunconditionally dereferencessym.owner, but module symbols have no owner:Symbol.ModuleSymbol#createalways passesnull. Any Refaster rule whose@BeforeTemplateis rooted at an instance member select then crashes the compiler as soon as it scans arequiresdirective whose module name is a single identifier.Module names that contain a dot are parsed as member selects instead, and
#visitMemberSelectis 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