Skip to content

Fix getting package export status in a modular project - #8662

Merged
mbien merged 1 commit into
apache:masterfrom
pedro-w:issue-8560
Aug 27, 2025
Merged

mbien merged 1 commit into
apache:masterfrom
pedro-w:issue-8560

Conversation

@pedro-w

@pedro-w pedro-w commented Jul 20, 2025 •

Copy link
Copy Markdown
Contributor

When getting the module definition from a module-info.java file, use getModule rather than scanning through getTypeDecls.
In the compiler API, the latter used to work up until JDK16, then it was changed for subsequent releases, so that the module object is no longer considered a type declaration. See discussion in #8560.

Tests included (there were no tests for this previously). I have not squashed them so it's possible to see the tests run without the fix. Please advise.

Fixes #8560
Fixes #8614


Click to collapse/expand PR instructions

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

PR approval and merge checklist:

  1. Was this PR correctly labeled, did the right tests run? When did they run?
  2. Is this PR squashed?
  3. Are author name / email address correct? Are co-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch: don't merge. (full wiki article)

@pedro-w pedro-w changed the title Issue 8560 Fix getting package export status in a modular project Jul 20, 2025
@mbien mbien added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Aug 25, 2025

@mbien mbien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good on first glance, added some comments.

feel free to squash / force push

@mbien

mbien commented Aug 25, 2025 •

Copy link
Copy Markdown
Member

on second look: I don't think this will build. extractExports() is also not used atm so something is missing in this changeset.

Next sync should trigger CI (for some reason it didn't trigger so far).

@pedro-w

pedro-w commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

I do apologize, something got lost somewhere along the way. Should now be fixed. I don't know why CI didn't run tests. All tests on that module are passing locally.

@mbien

mbien commented Aug 26, 2025

Copy link
Copy Markdown
Member

awesome, thanks!

could you:

  • rebase to latest master (git pull --rebase),
  • then remove all @Ignore annotations from UnitTestsCompilerOptionsQueryImplTest in java/java.api.common
  • and squash everything to one commit and force push?

It should now be all green.

@mbien mbien added this to the NB28 milestone Aug 26, 2025
@pedro-w
pedro-w force-pushed the issue-8560 branch 2 times, most recently from 5b018b5 to 7352d2b Compare August 26, 2025 10:19
This is instead of getTypeDecls, due to
a change in the API between JDK16 and 17.
@pedro-w

pedro-w commented Aug 27, 2025

Copy link
Copy Markdown
Contributor Author

ok 🤞

@mbien mbien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for working on the fix and your patience during review

will merge once CI green

@mbien
mbien merged commit 853607e into apache:master Aug 27, 2025
@pedro-w
pedro-w deleted the issue-8560 branch August 28, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test UnitTestsCompilerOptionsQueryImplTest fails on Java 17 and Java 21 Analyze Javadoc not working on modular project

2 participants