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

8336654: [lworld] Tests depending on sun.awt.AppContext can fail when run with migrated classes #22868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prrace
Copy link
Contributor

@prrace prrace commented Dec 23, 2024

The problem is that Boolean will be a value type in the future (Project Valhalla)
and so it can't be the referent of a Reference.

In this code, the abstract class that creates the Reference accepts a generic type so isn't in control of what it receives.

The concrete class that extends the generic class has no idea what the super class implementation does,
so has no way to know that it might do something that is invalid for a value type.

That's an interesting observation for Valhalla (that the code that does something inappropriate for a value type
isn't the source of the value type) but I don't think we need to be concerned
about that here because we can see reasons to do this anyway.

The specific classes exist because a nominal singleton for the VM may need to be private to an AppContext.
This is a concept from applets but also from webstart where we have a single JVM that may be running code
from different origins that needs to be partitioned and sand boxed.

This concept is obsolete now as applets and webstart are no longer supported, and the Security Manager
is disabled, further undermining any way to support partitioning.

This specific case of a Boolean created from the value of a Java System Property looks like it never needed
this partitioning, so the minimal fix is to stop using RecyclableSingleton for it, and just cache the value of that.

The next level of fix is to note that since AppContext is obsolete, there is no need for RecyclableSingleton
to use AppContext specific values, making RecyclableSingleton just a lazy initialization mechanism for the singleton.

Given that removing the obsolete AppContext is on the TBD list - and some JDK components have already
removed per-AppContext code - and we'd probably come back to this in JDK 25 anyway it seems best
to get it over with.

That does mean that one other place in sun.awt.ImageCache needed to be updated too.

Also one test that explicitly checked that AppContexts were used for UI instances is obsolete and removed.

Note that RecyclableSingleton also offers some lazy initialisation benefit, and is widely used in Aqua,
so going further and removing that probably isn't something we want to do at all, and certainly not here.


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-8336654: [lworld] Tests depending on sun.awt.AppContext can fail when run with migrated classes (Bug - P3)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22868

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 23, 2024

👋 Welcome back prr! 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 Dec 23, 2024

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

@openjdk openjdk bot changed the title 8336654 8336654: [lworld] Tests depending on sun.awt.AppContext can fail when run with migrated classes Dec 23, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 23, 2024
@openjdk
Copy link

openjdk bot commented Dec 23, 2024

@prrace The following label will be automatically applied to this pull request:

  • client

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.

@mlbridge
Copy link

mlbridge bot commented Dec 23, 2024

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

1 participant