Repository navigation
Simplify manifest name extraction and constant-pool name lookup - #252
Merged
Merged
Conversation
The single-assignment binaryParser and automaticModuleName locals existed only to return one of two values, and packageName was a verbatim copy of className. Return the chosen value directly and delegate the duplicate. No behaviour change.
The ternary merged two constructor calls whose compile-time types differ: BinaryModuleInfoParser extends ModuleInfoClassParser in the Java 8 sources, but the Java 9 multi-release variant extends AbstractBinaryModuleInfoParser. javac 25 emitted a StackMapTable frame typed as ModuleInfoClassParser at the merge, which fails verification once the MR-jar substitutes the Java 9 class. The declared ModuleInfoParser local keeps the frame at the interface type, as on green master.
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.
Why
automaticModuleNamewas a single-use local, andpackageNamewas a verbatim copy ofclassName. Both add noise without changing behaviour.A third cleanup (collapsing
LocationManager.getBinaryModuleInfoParserto a ternary) was reverted in a follow-up commit: javac 25 emits a StackMapTable frame typed asModuleInfoClassParserfor that merge, but the multi-release Java 9BinaryModuleInfoParserdoes not extendModuleInfoClassParser, so failsafe ITs fail withVerifyErroron JDK 9+. The originalModuleInfoParser-typed local keeps the frame at the interface type.Area
plexus-javaJPMS module-name resolution — main source only.Changes
ManifestModuleNameExtractor.extract: returnAutomatic-Module-Namewith a ternary,nullwhen no manifest is present.ModuleInfoClassParser.ConstantPool.packageName: delegate toclassName, whose body is identical.No behaviour change: the same names are returned.
Verification
With
JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home:mvn -B -o spotless:apply— BUILD SUCCESS (0 files changed).mvn -B -o spotless:check— BUILD SUCCESS.mvn -B -o verify— BUILD SUCCESS; 94 unit tests + 4LocationManagerITtests, 0 failures, 0 errors, 0 skipped.