Skip to content

Use correct attribute tag in NestHost and ModuleMainClass#507

Merged
garydgregory merged 1 commit into
apache:masterfrom
rootvector2:correct-attribute-tags
Jun 21, 2026
Merged

Use correct attribute tag in NestHost and ModuleMainClass#507
garydgregory merged 1 commit into
apache:masterfrom
rootvector2:correct-attribute-tags

Conversation

@rootvector2

Copy link
Copy Markdown
Contributor

NestHost and ModuleMainClass pass Const.ATTR_NEST_MEMBERS to the Attribute constructor, so a parsed attribute reports the wrong getTag(): a NestHost reports ATTR_NEST_MEMBERS (26) instead of ATTR_NEST_HOST (25), and a ModuleMainClass reports 26 instead of ATTR_MODULE_MAIN_CLASS (24). Attribute.readAttribute selects the right class by name, but the object then mislabels itself, so JavaClass.getAttribute(Const.ATTR_NEST_HOST) / getAttribute(Const.ATTR_MODULE_MAIN_CLASS) return null for a class that has those attributes, while getAttribute(Const.ATTR_NEST_MEMBERS) hands back a NestHost/ModuleMainClass that the unchecked cast type-confuses with NestMembers; Const.getAttributeName(getTag()) also prints both as NestMembers. found by checking each Attribute subclass tag against Const — every other subclass passes its own constant.

Before you push a pull request, review this list:

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute?
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

@garydgregory garydgregory changed the title use correct attribute tag in NestHost and ModuleMainClass Use correct attribute tag in NestHost and ModuleMainClass Jun 21, 2026
@garydgregory garydgregory merged commit c64231e into apache:master Jun 21, 2026
19 checks passed
@garydgregory

Copy link
Copy Markdown
Member

TY @rootvector2 , merged 🚀

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