From df49dea906653a362b0b509f12a779b616fde7b6 Mon Sep 17 00:00:00 2001 From: "Jesse N. Glick" Date: Mon, 28 Mar 2005 22:42:09 +0000 Subject: [PATCH] #32463: deprecate WeakishReference since we can assume JDK 1.2 APIs now. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278067 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/util/WeakishReference.java | 3 +- .../ant/util/optional/WeakishReference12.java | 2 +- .../apache/tools/ant/util/ReferencesTest.java | 46 ------------------- 3 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 src/testcases/org/apache/tools/ant/util/ReferencesTest.java diff --git a/src/main/org/apache/tools/ant/util/WeakishReference.java b/src/main/org/apache/tools/ant/util/WeakishReference.java index b8cd32b0c..0fd9fac1f 100644 --- a/src/main/org/apache/tools/ant/util/WeakishReference.java +++ b/src/main/org/apache/tools/ant/util/WeakishReference.java @@ -23,6 +23,7 @@ import org.apache.tools.ant.util.optional.WeakishReference12; * This is a weak reference on java1.2 and up, that is all * platforms Ant1.6 supports. * @since ant1.6 + * @deprecated Just use {@link java.lang.ref.WeakReference} directly. */ public abstract class WeakishReference { @@ -46,7 +47,7 @@ public abstract class WeakishReference { /** * A hard reference for Java 1.1. - * Hopefully nobody is using this. + * @deprecated Hopefully nobody is using this. */ public static class HardReference extends WeakishReference { private Object object; diff --git a/src/main/org/apache/tools/ant/util/optional/WeakishReference12.java b/src/main/org/apache/tools/ant/util/optional/WeakishReference12.java index 44b1425df..311ba6c98 100644 --- a/src/main/org/apache/tools/ant/util/optional/WeakishReference12.java +++ b/src/main/org/apache/tools/ant/util/optional/WeakishReference12.java @@ -24,7 +24,7 @@ import java.lang.ref.WeakReference; /** * This is a reference that really is is Weak, as it uses the * appropriate java.lang.ref class. - * + * @deprecated Just use {@link WeakReference} directly. */ public class WeakishReference12 extends WeakishReference { diff --git a/src/testcases/org/apache/tools/ant/util/ReferencesTest.java b/src/testcases/org/apache/tools/ant/util/ReferencesTest.java deleted file mode 100644 index 195c12fd5..000000000 --- a/src/testcases/org/apache/tools/ant/util/ReferencesTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.tools.ant.util; - -import junit.framework.TestCase; - - -/** - * this test just makes sure that we really do create weak references - * on java1.2+, and is written to not import the WeakishReference12 class - * because then we'd have to make the class conditional on java1.2+. - */ -public class ReferencesTest extends TestCase{ - - public ReferencesTest(String s) { - super(s); - } - - /** - * look at the type of a reference we have created - */ - public static void testReferencesAreSoft() { - boolean isJava11=JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1); - WeakishReference reference = WeakishReference.createReference(new Object()); - if ((reference.getClass().getName().indexOf("HardReference") > 0 ) - && !isJava11) { - fail("We should be creating soft references in this version of Java"); - } - } - -}