Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/jcl/src/java.base/share/classes/java/lang/ref/PhantomReference.java
12521 views
1
/*[INCLUDE-IF Sidecar16]*/
2
package java.lang.ref;
3
4
/*******************************************************************************
5
* Copyright (c) 1998, 2010 IBM Corp. and others
6
*
7
* This program and the accompanying materials are made available under
8
* the terms of the Eclipse Public License 2.0 which accompanies this
9
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
10
* or the Apache License, Version 2.0 which accompanies this distribution and
11
* is available at https://www.apache.org/licenses/LICENSE-2.0.
12
*
13
* This Source Code may also be made available under the following
14
* Secondary Licenses when the conditions for such availability set
15
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
16
* General Public License, version 2 with the GNU Classpath
17
* Exception [1] and GNU General Public License, version 2 with the
18
* OpenJDK Assembly Exception [2].
19
*
20
* [1] https://www.gnu.org/software/classpath/license.html
21
* [2] http://openjdk.java.net/legal/assembly-exception.html
22
*
23
* 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
24
*******************************************************************************/
25
26
/**
27
* PhantomReference objects are used to detect referents which
28
* are no longer visible and are eligible to have their storage
29
* reclaimed.
30
*
31
* @author OTI
32
* @version initial
33
* @since JDK1.2
34
*/
35
public class PhantomReference<T> extends java.lang.ref.Reference<T> {
36
37
/**
38
* Return the referent of the reference object. Phantom reference
39
* objects referents are inaccessible, and so null is returned.
40
*
41
* @return Object
42
* Returns null.
43
*/
44
public T get() {
45
return null;
46
}
47
48
/**
49
* Constructs a new instance of this class.
50
*
51
* @param r
52
* referent to track.
53
* @param q
54
* queue to register to the reference object with.
55
*/
56
public PhantomReference(T r, ReferenceQueue<? super T> q) {
57
initReference(r, q);
58
}
59
}
60
61