Skip to content

Commit

Permalink
Merge pull request #15970 from JasonFengJ9/permitclasses
Browse files Browse the repository at this point in the history
Fix JDK19 java.lang.ref.Reference signature
  • Loading branch information
pshipton committed Sep 27, 2022
2 parents 9f8fd74 + f5d4c70 commit cb13645
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
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

0 comments on commit cb13645

Please sign in to comment.