Skip to content

Conversation

@vicente-romero-oracle
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle commented Dec 9, 2025

Code like:

class Test {
    static boolean testMethod() { return true; }
    Test() {}
    Test(int a) {
        Test.this.testMethod();
        this();
    }
}

or:

class Super {
    static <T> void m() {}
}

class Test extends Super {
    Test() {
        Test.super.<String>m();
        super();
    }
}

shouldn't be allowed in prologue. Javac was not checking static method invocations in the prologue correctly. This fix should solve this issue,

TIA


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8370635: [lworld] TypeName.super.[TypeArguments] Identifier cannot occur in prologue (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1779

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1779.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 9, 2025

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

@openjdk
Copy link

openjdk bot commented Dec 9, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 9, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 9, 2025

Webrevs

if ((sym.kind == VAR || sym.kind == MTH) &&
sym.isMemberOf(env.enclClass.sym, types) &&
((sym.flags() & STATIC) == 0 ||
(sym.kind == MTH && tree instanceof JCFieldAccess))) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we only restrict MTH? We can write code like:

class A { static int a = 5; }
class B extends A { B() { IO.println(B.super.a); } }

Wonder if we should block B.super.a style stuff in early construction.

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

Labels

rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants