Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8332507: compilation result depends on compilation order #19400

Closed

Conversation

vicente-romero-oracle
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle commented May 24, 2024

Wildcards and separate compilation haven't been friends since like: forever. Javac has had a long standing issue of not being able to restore wildcard bounds when they are read from the classfile. Part of this is due to a restriction of not reading another class file while a given class file is being read. Without breaking this restriction we can "wait" until a class symbol is completed from a class file to have access to richer information and being able to set the right bounds to wildcards. The fix seems simple enough. Basically the proposal is to register listeners that will be invoked once a given class symbol is completely read from a class file. This tactic has been used in type inference and other areas of the compiler where another layer of indirection has been a must to fix similar problems.

It will be a great pleasure if this proposal can be the solution to this long standing issue,

TIA


Progress

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

Warning

 ⚠️ Found leading lowercase letter in issue title for 8332507: compilation result depends on compilation order

Issue

  • JDK-8332507: compilation result depends on compilation order (Bug - P4)(⚠️ The fixVersion in this issue is [24] but the fixVersion in .jcheck/conf is 23, a new backport will be created when this pr is integrated.)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19400

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19400.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 24, 2024

👋 Welcome back vromero! A progress list of the required criteria for merging this PR into master 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 May 24, 2024

@vicente-romero-oracle 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:

8332507: compilation result depends on compilation order

Reviewed-by: mcimadamore

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

At the time when this comment was updated there had been 164 new commits pushed to the master 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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 24, 2024
@openjdk
Copy link

openjdk bot commented May 24, 2024

@vicente-romero-oracle The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the compiler compiler-dev@openjdk.org label May 24, 2024
@mlbridge
Copy link

mlbridge bot commented May 24, 2024

Webrevs

}
if (actuals.length() != (formals == null ? 0 : formals.length())) {
final List<Type> actualsCp = actuals;
addSymbolReadListener(t, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could use the completion mechanism for this - class reader should already sign itself up as a completer for the class symbols it generates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if we could use the completion mechanism for this - class reader should already sign itself up as a completer for the class symbols it generates?

pretty good suggestion, thanks! I have uploaded another iteration that leverages the completer mechanism

if (actuals.isEmpty())
actuals = formals;
else
updateBounds(actuals, formals);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it important we do this here - or can we always do this in the completer (to simplify the code some more)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the suggestion, will give it a try

Copy link
Contributor

@mcimadamore mcimadamore left a comment

Choose a reason for hiding this comment

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

Looks good - I left an optional suggestion

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 31, 2024

@Override
public List<Type> getTypeArguments() {
List<Type> formalsCp = ((ClassType)t.type.tsym.type).typarams_field;
Copy link
Contributor

Choose a reason for hiding this comment

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

This works. You might use another boolean flag up top to say whether you actually need to adjust the type arguments (which is only needed the first time) ?

Copy link
Contributor Author

@vicente-romero-oracle vicente-romero-oracle May 31, 2024

Choose a reason for hiding this comment

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

sure sorry I forgot about that, done

@vicente-romero-oracle
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented May 31, 2024

Going to push as commit e650bdf.
Since your change was applied there have been 167 commits pushed to the master branch:

  • e4fbb15: 8320215: HeapDumper can use DumpWriter buffer during merge
  • 681137c: 8333131: Source launcher should work with service loader SPI
  • 914423e: 8332899: RISC-V: add comment and make the code more readable (if possible) in MacroAssembler::movptr
  • 5abc029: 8331877: JFR: Remove JIInliner framework
  • d9e7b7e: 8210471: GZIPInputStream constructor could leak an un-end()ed Inflater
  • 1e04ee6: 8331579: Reference to primitive type fails without error or warning
  • 32ee252: 8333169: javac NullPointerException record.type
  • e930bc1: 8329537: Nested and enclosing classes should be linked separately in breadcrumb navigation
  • 79a78f0: 8333129: Move ShrinkHeapInSteps flag to Serial GC
  • 2f2dc22: 8330981: ZGC: Should not dedup strings in the finalizer graph
  • ... and 157 more: https://git.openjdk.org/jdk/compare/9bfae8891e6efa58c557bd6dac61de111a16f71e...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 31, 2024
@openjdk openjdk bot closed this May 31, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 31, 2024
@openjdk
Copy link

openjdk bot commented May 31, 2024

@vicente-romero-oracle Pushed as commit e650bdf.

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

@vicente-romero-oracle vicente-romero-oracle deleted the JDK-8332507 branch May 31, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants