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

8295962: Reference to State in Task.java is ambiguous when building with JDK 19 #933

Closed

Conversation

kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented Oct 26, 2022

This PR replaces all occurrences of State with Worker.State in javafx.concurrent.Task.

The javafx.concurrent.Task class implements javafx.concurrent.Worker and extends java.util.concurrent.FutureTask, which in turn implements java.util.concurrent.Future.

Worker has a nested State enum, which is used in the implementing Task class without being qualified -- since Task is a Worker, we can just say State instead of Worker.State.

JDK-8277090 added a nested State enum to the java.util.concurrent.Future interface in JDK 19, so an unqualified reference to State from the Task class is now ambiguous when using JDK 19 to build. The javadoc task fails with an error (and the only reason the javac task doesn't is that we use --release 17).

With this fix, a local build and test using JDK 19 passes.


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

Issue

  • JDK-8295962: Reference to State in Task.java is ambiguous when building with JDK 19

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 933

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/933.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 26, 2022

👋 Welcome back kcr! 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 openjdk bot added the rfr Ready for review label Oct 26, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 26, 2022

Webrevs

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

all instances in Task class

@andy-goryachev-oracle
Copy link
Contributor

@kevinrushforth
I am getting 9 errors:

Description	Resource	Location
The type State is ambiguous	AbstractTask.java	line 62
The type State is ambiguous	TaskShim.java	line 52
The type Task.State is ambiguous	TaskCancelTest.java	line 60
The type Task.State is ambiguous	TaskCancelTest.java	line 72
The type Task.State is ambiguous	TaskCancelTest.java	line 93
The type Task.State is ambiguous	TaskCancelTest.java	line 108
The type Task.State is ambiguous	TaskCancelTest.java	line 120
The type Task.State is ambiguous	TaskCancelTest.java	line 139
The type Task.State is ambiguous	TaskSimpleTest.java	line 68

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

see 9 errors.
why do we not see these errors in github actions checks?

edit: pls disregard the question - forgot we are building with 18 in github.

@kevinrushforth
Copy link
Member Author

@kevinrushforth I am getting 9 errors:

Thanks for reporting this, I'll fix them. I think I know why I missed them when I did my test run.

@kevinrushforth
Copy link
Member Author

The reason I didn't catch these is that gradle test passes when using JDK 19, for the same reason that "gradle sdk" does: we compile classes for all modules except javafx.swing and the system tests with --release 17. When building the javadocs and when building javafx.swing and the system tests, we (necessarily) use -source 17 -target 17 instead of --release 17. I'll bet your Eclipse test run does the same (or maybe doesn't specificy anything relating the target release).

If I temporarily modify my build to use -source 17 -target 17 for all modules, I also get errors. Conversely, if you add --release 17 to your Eclipse options, you won't see the error.

I'll still fix those tests to make it more future proof.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

please update copyright year in modified tests :-)

@kevinrushforth
Copy link
Member Author

please update copyright year in modified tests :-)

Sure. I generally don't manually update the copyright date (we run a script for that), but since I already did it for Task.java, I'll update it for the tests, too.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle 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 in eclipse with jdk-19

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

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

LGTM, tested on Mac.

@openjdk
Copy link

openjdk bot commented Nov 2, 2022

@kevinrushforth 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:

8295962: Reference to State in Task.java is ambiguous when building with JDK 19

Reviewed-by: angorya, arapte

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 ready Ready to be integrated label Nov 2, 2022
@kevinrushforth
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 2, 2022

Going to push as commit 4a2afb4.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 2, 2022
@openjdk openjdk bot closed this Nov 2, 2022
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Nov 2, 2022
@openjdk
Copy link

openjdk bot commented Nov 2, 2022

@kevinrushforth Pushed as commit 4a2afb4.

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

@kevinrushforth kevinrushforth deleted the 8295962-Worker.State branch November 2, 2022 20:38
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
3 participants