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

Fix JDK19 java.lang.ref.Reference signature #15970

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*[INCLUDE-IF Sidecar16]*/
package java.lang.ref;

/*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/
/*******************************************************************************
* Copyright (c) 1998, 2010 IBM Corp. and others
* Copyright (c) 1998, 2022 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand All @@ -22,7 +20,8 @@
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

package java.lang.ref;

/**
* PhantomReference objects are used to detect referents which
* are no longer visible and are eligible to have their storage
Expand All @@ -32,7 +31,11 @@
* @version initial
* @since JDK1.2
*/
public class PhantomReference<T> extends java.lang.ref.Reference<T> {
public
/*[IF JAVA_SPEC_VERSION >= 19]*/
non-sealed
/*[ENDIF] JAVA_SPEC_VERSION >= 19 */
class PhantomReference<T> extends Reference<T> {

/**
* Return the referent of the reference object. Phantom reference
Expand Down
6 changes: 5 additions & 1 deletion jcl/src/java.base/share/classes/java/lang/ref/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
* @version initial
* @since 1.2
*/
public abstract class Reference<T> extends Object {
/*[IF JAVA_SPEC_VERSION < 19]*/
public abstract class Reference<T> extends Object {
/*[ELSE] JAVA_SPEC_VERSION < 19
public abstract sealed class Reference<T> extends Object permits PhantomReference, SoftReference, WeakReference, FinalReference {
/*[ENDIF] JAVA_SPEC_VERSION < 19 */
private static final int STATE_INITIAL = 0;
private static final int STATE_CLEARED = 1;
private static final int STATE_ENQUEUED = 2;
Expand Down
15 changes: 9 additions & 6 deletions jcl/src/java.base/share/classes/java/lang/ref/SoftReference.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*[INCLUDE-IF Sidecar16]*/
package java.lang.ref;

/*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/
/*******************************************************************************
* Copyright (c) 1998, 2020 IBM Corp. and others
* Copyright (c) 1998, 2022 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand All @@ -22,7 +20,8 @@
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

package java.lang.ref;

/**
* SoftReference objects are used to detect referents which
* are no longer visible and who's memory is to be reclaimed.
Expand All @@ -31,7 +30,11 @@
* @version initial
* @since 1.2
*/
public class SoftReference<T> extends java.lang.ref.Reference<T> {
public
/*[IF JAVA_SPEC_VERSION >= 19]*/
non-sealed
/*[ENDIF] JAVA_SPEC_VERSION >= 19 */
class SoftReference<T> extends Reference<T> {
/*[PR 124242] SoftReference.get() should reset age */
private volatile int age;

Expand Down
15 changes: 9 additions & 6 deletions jcl/src/java.base/share/classes/java/lang/ref/WeakReference.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*[INCLUDE-IF Sidecar16]*/
package java.lang.ref;

/*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/
/*******************************************************************************
* Copyright (c) 1998, 2010 IBM Corp. and others
* Copyright (c) 1998, 2022 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand All @@ -22,7 +20,8 @@
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

package java.lang.ref;

/**
* WeakReference objects are used to detect referents which
* are no longer visible.
Expand All @@ -31,7 +30,11 @@
* @version initial
* @since 1.2
*/
public class WeakReference<T> extends java.lang.ref.Reference<T> {
public
/*[IF JAVA_SPEC_VERSION >= 19]*/
non-sealed
/*[ENDIF] JAVA_SPEC_VERSION >= 19 */
class WeakReference<T> extends Reference<T> {

/**
* Constructs a new instance of this class.
Expand Down