Path: blob/master/jcl/src/java.base/share/classes/java/lang/ref/PhantomReference.java
12521 views
/*[INCLUDE-IF Sidecar16]*/1package java.lang.ref;23/*******************************************************************************4* Copyright (c) 1998, 2010 IBM Corp. and others5*6* This program and the accompanying materials are made available under7* the terms of the Eclipse Public License 2.0 which accompanies this8* distribution and is available at https://www.eclipse.org/legal/epl-2.0/9* or the Apache License, Version 2.0 which accompanies this distribution and10* is available at https://www.apache.org/licenses/LICENSE-2.0.11*12* This Source Code may also be made available under the following13* Secondary Licenses when the conditions for such availability set14* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU15* General Public License, version 2 with the GNU Classpath16* Exception [1] and GNU General Public License, version 2 with the17* OpenJDK Assembly Exception [2].18*19* [1] https://www.gnu.org/software/classpath/license.html20* [2] http://openjdk.java.net/legal/assembly-exception.html21*22* 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-exception23*******************************************************************************/2425/**26* PhantomReference objects are used to detect referents which27* are no longer visible and are eligible to have their storage28* reclaimed.29*30* @author OTI31* @version initial32* @since JDK1.233*/34public class PhantomReference<T> extends java.lang.ref.Reference<T> {3536/**37* Return the referent of the reference object. Phantom reference38* objects referents are inaccessible, and so null is returned.39*40* @return Object41* Returns null.42*/43public T get() {44return null;45}4647/**48* Constructs a new instance of this class.49*50* @param r51* referent to track.52* @param q53* queue to register to the reference object with.54*/55public PhantomReference(T r, ReferenceQueue<? super T> q) {56initReference(r, q);57}58}596061