Skip to content

Test relocation of ModuleMainClass in module-info#2109

Merged
Goooler merged 1 commit into
mainfrom
g/20260715/test-module-info
Jul 15, 2026
Merged

Test relocation of ModuleMainClass in module-info#2109
Goooler merged 1 commit into
mainfrom
g/20260715/test-module-info

Conversation

@Goooler

@Goooler Goooler commented Jul 15, 2026

Copy link
Copy Markdown
Member

Refs #1902.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a bytecode-level regression test ensuring relocation/remapping correctly updates ModuleMainClass information inside module-info.class, aligning module metadata handling with the existing class-name/descriptor relocation coverage in BytecodeRemappingTest.

Changes:

  • Introduces a new unit test that synthesizes a module-info.class containing a visitMainClass(...) entry and verifies the main class is relocated.
  • Adds ASM ClassWriter/ModuleVisitor usage to generate and inspect module metadata for the new test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

$$"com/github/jengelman/gradle/plugins/shadow/internal/BytecodeRemappingTest$FixtureBase"
val writer = ClassWriter(0)
writer.visit(Opcodes.V9, Opcodes.ACC_MODULE, "module-info", null, null, null)
writer.visitModule("example.module", 0, null).apply { visitMainClass(originalMainClass) }
@Goooler Goooler merged commit 9e5c06d into main Jul 15, 2026
5 checks passed
@Goooler Goooler deleted the g/20260715/test-module-info branch July 15, 2026 09:40
@Goooler Goooler changed the title Test relocation of module-info Test relocation of ModuleMainClass in module-info Jul 15, 2026
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.

2 participants