Path: blob/master/jcl/src/java.base/share/classes/java/lang/ref/WeakReference.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* WeakReference objects are used to detect referents which27* are no longer visible.28*29* @author OTI30* @version initial31* @since 1.232*/33public class WeakReference<T> extends java.lang.ref.Reference<T> {3435/**36* Constructs a new instance of this class.37*38* @param r referent to track.39* @param q queue to register to the reference object with.40*/41public WeakReference(T r, ReferenceQueue<? super T> q) {42initReference(r, q);43}4445/**46* Constructs a new instance of this class.47*48* @param r referent to track.49*/50public WeakReference(T r) {51initReference(r);52}53}545556