Skip to content

8390112: Protected static access resolves to a wrong static method - #1150

Closed
dbalek wants to merge 2 commits into
openjdk:code-reflectionfrom
dbalek:dbalek/8390112
Closed

8390112: Protected static access resolves to a wrong static method#1150
dbalek wants to merge 2 commits into
openjdk:code-reflectionfrom
dbalek:dbalek/8390112

Conversation

@dbalek

@dbalek dbalek commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Consider the following code snippets:

package a;

public class Parent {
    protected static boolean test(Object value) {
        return value != null;
    }
}
package b;
import a.Parent;

public class Child extends Parent {
    @Reflect
    public static boolean test(Object value) {
        return Parent.test(value);
    }
}

When generating bytecode for a protected static method invocation from a different package, the generator uses the lookup class as the receiver of findStatic. This could resolve a method declared on the accessing class instead of the referenced class.

The proposal is to modify BytecodeGenerator to use the referenced class for protected static method-handle lookups. A regression test covers resolving and invoking a protected static method declared by a superclass in another package.



Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8390112: Protected static access resolves to a wrong static method (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/babylon.git pull/1150/head:pull/1150
$ git checkout pull/1150

Update a local copy of the PR:
$ git checkout pull/1150
$ git pull https://git.openjdk.org/babylon.git pull/1150/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1150

View PR using the GUI difftool:
$ git pr show -t 1150

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/babylon/pull/1150.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

👋 Welcome back dbalek! A progress list of the required criteria for merging this PR into code-reflection will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Aug 14, 2026

Copy link
Copy Markdown

@dbalek This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8390112: Protected static access resolves to a wrong static method

Reviewed-by: asotona, psandoz

You can use pull request commands such as /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 2 new commits pushed to the code-reflection branch:

  • 49577a7: 8389767: Assertion error from BytecodeGenerator.setCatchStack
  • 9aa71b4: I missed updating nbodygl example to skip KernelContext

Please see this link for an up-to-date comparison between the source branch of this pull request and the code-reflection branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@asotona, @PaulSandoz) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk Bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Aug 14, 2026
@mlbridge

mlbridge Bot commented Aug 14, 2026

Copy link
Copy Markdown

Webrevs

@asotona asotona 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 to me.

@dbalek

dbalek commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

/integrate

@openjdk openjdk Bot added the sponsor Pull request is ready to be sponsored label Aug 17, 2026
@openjdk

openjdk Bot commented Aug 17, 2026

Copy link
Copy Markdown

@dbalek
Your change (at version 3841883) is now ready to be sponsored by a Committer.

@PaulSandoz

Copy link
Copy Markdown
Member

/sponsor

@openjdk

openjdk Bot commented Aug 18, 2026

Copy link
Copy Markdown

Going to push as commit 6d1be28.
Since your change was applied there have been 5 commits pushed to the code-reflection branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Aug 18, 2026
@openjdk openjdk Bot closed this Aug 18, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 18, 2026
@openjdk

openjdk Bot commented Aug 18, 2026

Copy link
Copy Markdown

@PaulSandoz @dbalek Pushed as commit 6d1be28.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants