You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/12 11:03:18 UTC

svn commit: r1201235 - in /tomcat/trunk: java/org/apache/tomcat/util/IntrospectionUtils.java test/org/apache/catalina/tribes/demos/IntrospectionUtils.java

Author: kkolinko
Date: Sat Nov 12 10:03:18 2011
New Revision: 1201235

URL: http://svn.apache.org/viewvc?rev=1201235&view=rev
Log:
Deprecate unused methods in IntrospectionUtils classes

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
    tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java?rev=1201235&r1=1201234&r2=1201235&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java Sat Nov 12 10:03:18 2011
@@ -43,7 +43,9 @@ public final class IntrospectionUtils {
 
     /**
      * Call execute() - any ant-like task should work
+     * @deprecated Not used
      */
+    @Deprecated
     public static void execute(Object proxy, String method) throws Exception {
         Method executeM = null;
         Class<?> c = proxy.getClass();
@@ -58,7 +60,9 @@ public final class IntrospectionUtils {
 
     /**
      * Call void setAttribute( String ,Object )
+     * @deprecated Not used
      */
+    @Deprecated
     public static void setAttribute(Object proxy, String n, Object v)
             throws Exception {
         if (proxy instanceof AttributeHolder) {
@@ -85,7 +89,9 @@ public final class IntrospectionUtils {
 
     /**
      * Call void getAttribute( String )
+     * @deprecated Not used
      */
+    @Deprecated
     public static Object getAttribute(Object proxy, String n) throws Exception {
         Method executeM = null;
         Class<?> c = proxy.getClass();
@@ -102,7 +108,9 @@ public final class IntrospectionUtils {
 
     /**
      * Construct a URLClassLoader. Will compile and work in JDK1.1 too.
+     * @deprecated Not used
      */
+    @Deprecated
     public static ClassLoader getURLClassLoader(URL urls[], ClassLoader parent) {
         try {
             Class<?> urlCL = Class.forName("java.net.URLClassLoader");
@@ -221,7 +229,9 @@ public final class IntrospectionUtils {
 
     /**
      * Debug method, display the classpath
+     * @deprecated Not used
      */
+    @Deprecated
     public static void displayClassPath(String msg, URL[] cp) {
         if (log.isDebugEnabled()) {
             log.debug(msg);
@@ -231,6 +241,10 @@ public final class IntrospectionUtils {
         }
     }
 
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
     public static final String PATH_SEPARATOR = System.getProperty("path.separator");
 
     /**
@@ -238,7 +252,9 @@ public final class IntrospectionUtils {
      * property. This System property lists the classpath entries common to web
      * applications. This System property is currently used by Jasper when its
      * JSP servlet compiles the Java file for a JSP.
+     * @deprecated Not used
      */
+    @Deprecated
     public static String classPathAdd(URL urls[], String cp) {
         if (urls == null)
             return cp;
@@ -444,7 +460,9 @@ public final class IntrospectionUtils {
     }
 
     /**
+     * @deprecated Not used
      */
+    @Deprecated
     public static void setProperty(Object o, String name) {
         String setter = "set" + capitalize(name);
         try {
@@ -530,6 +548,10 @@ public final class IntrospectionUtils {
         return new String(chars);
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static String unCapitalize(String name) {
         if (name == null || name.length() == 0) {
             return name;
@@ -544,7 +566,9 @@ public final class IntrospectionUtils {
     /**
      * Add all the jar files in a dir to the classpath, represented as a Vector
      * of URLs.
+     * @deprecated Is used only by deprecated method
      */
+    @Deprecated
     public static void addToClassPath(Vector<URL> cpV, String dir) {
         try {
             String cpComp[] = getFilesByExt(dir, ".jar");
@@ -561,6 +585,10 @@ public final class IntrospectionUtils {
         }
     }
 
+    /**
+     * @deprecated Is used only by deprecated method
+     */
+    @Deprecated
     public static void addToolsJar(Vector<URL> v) {
         try {
             // Add tools.jar in any case
@@ -588,7 +616,9 @@ public final class IntrospectionUtils {
 
     /**
      * Return all files with a given extension in a dir
+     * @deprecated Is used only by deprecated method
      */
+    @Deprecated
     public static String[] getFilesByExt(String ld, String ext) {
         File dir = new File(ld);
         String[] names = null;
@@ -609,7 +639,9 @@ public final class IntrospectionUtils {
 
     /**
      * Construct a file url from a file, using a base dir
+     * @deprecated Is used only by deprecated method
      */
+    @Deprecated
     public static URL getURL(String base, String file) {
         try {
             File baseF = new File(base);
@@ -637,7 +669,9 @@ public final class IntrospectionUtils {
      *   separated by path.separator delimiters.
      * @throws IOException If an I/O error occurs
      * @throws MalformedURLException Doh ;)
+     * @deprecated Is used only by deprecated method
      */
+    @Deprecated
     public static void addJarsFromClassPath(Vector<URL> jars, String cp)
             throws IOException, MalformedURLException {
         String sep = System.getProperty("path.separator");
@@ -660,7 +694,9 @@ public final class IntrospectionUtils {
 
     /**
      * Return a URL[] that can be used to construct a class loader
+     * @deprecated Is used only by deprecated method
      */
+    @Deprecated
     public static URL[] getClassPath(Vector<URL> v) {
         URL[] urls = new URL[v.size()];
         for (int i = 0; i < v.size(); i++) {
@@ -672,7 +708,9 @@ public final class IntrospectionUtils {
     /**
      * Construct a URL classpath from files in a directory, a cpath property,
      * and tools.jar.
+     * @deprecated Not used
      */
+    @Deprecated
     public static URL[] getClassPath(String dir, String cpath,
             String cpathProp, boolean addTools) throws IOException,
             MalformedURLException {
@@ -749,7 +787,9 @@ public final class IntrospectionUtils {
 
     /** Test if the object implements a particular
      *  method
+     * @deprecated Not used
      */
+    @Deprecated
     public static boolean hasHook(Object obj, String methodN) {
         try {
             Method myMethods[] = findMethods(obj.getClass());
@@ -775,6 +815,10 @@ public final class IntrospectionUtils {
         return false;
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static void callMain(Class<?> c, String args[]) throws Exception {
         Class<?> p[] = new Class[1];
         p[0] = args.getClass();
@@ -806,6 +850,10 @@ public final class IntrospectionUtils {
         return m.invoke(target, new Object[] { param1 });
     }
 
+    /**
+     * @deprecated Not used, though compliments callMethod1 and callMethodN here
+     */
+    @Deprecated
     public static Object callMethod0(Object target, String methodN)
             throws Exception {
         if (target == null) {
@@ -826,7 +874,11 @@ public final class IntrospectionUtils {
         return m.invoke(target, emptyArray);
     }
 
-    static Object[] emptyArray = new Object[] {};
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
+    private static final Object[] emptyArray = new Object[] {};
 
     public static Object callMethodN(Object target, String methodN,
             Object params[], Class<?> typeParams[]) throws Exception {
@@ -902,6 +954,10 @@ public final class IntrospectionUtils {
 
     }
 
+    /**
+     * @deprecated Is used only by deprecated method
+     */
+    @Deprecated
     public static interface AttributeHolder {
 
         public void setAttribute(String key, Object o);

Modified: tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java?rev=1201235&r1=1201234&r2=1201235&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java Sat Nov 12 10:03:18 2011
@@ -43,7 +43,9 @@ public final class IntrospectionUtils {
 
     /**
      * Call execute() - any ant-like task should work
+     * @deprecated Not used
      */
+    @Deprecated
     public static void execute(Object proxy, String method) throws Exception {
         Method executeM = null;
         Class<?> c = proxy.getClass();
@@ -58,7 +60,9 @@ public final class IntrospectionUtils {
 
     /**
      * Call void setAttribute( String ,Object )
+     * @deprecated Not used
      */
+    @Deprecated
     public static void setAttribute(Object proxy, String n, Object v)
             throws Exception {
         if (proxy instanceof AttributeHolder) {
@@ -85,7 +89,9 @@ public final class IntrospectionUtils {
 
     /**
      * Call void getAttribute( String )
+     * @deprecated Not used
      */
+    @Deprecated
     public static Object getAttribute(Object proxy, String n) throws Exception {
         Method executeM = null;
         Class<?> c = proxy.getClass();
@@ -102,7 +108,9 @@ public final class IntrospectionUtils {
 
     /**
      * Construct a URLClassLoader. Will compile and work in JDK1.1 too.
+     * @deprecated Not used
      */
+    @Deprecated
     public static ClassLoader getURLClassLoader(URL urls[], ClassLoader parent) {
         try {
             Class<?> urlCL = Class.forName("java.net.URLClassLoader");
@@ -125,6 +133,10 @@ public final class IntrospectionUtils {
         }
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static String guessInstall(String installSysProp,
             String homeSysProp, String jarName) {
         return guessInstall(installSysProp, homeSysProp, jarName, null);
@@ -139,7 +151,9 @@ public final class IntrospectionUtils {
      * both System properties are unset, "install" and "home" will be set to the
      * same value. This value will be the other System property that is set, or
      * the guessed value if neither is set.
+     * @deprecated Used only by deprecated method
      */
+    @Deprecated
     public static String guessInstall(String installSysProp,
             String homeSysProp, String jarName, String classFile) {
         String install = null;
@@ -221,7 +235,9 @@ public final class IntrospectionUtils {
 
     /**
      * Debug method, display the classpath
+     * @deprecated Not used
      */
+    @Deprecated
     public static void displayClassPath(String msg, URL[] cp) {
         if (log.isDebugEnabled()) {
             log.debug(msg);
@@ -231,6 +247,10 @@ public final class IntrospectionUtils {
         }
     }
 
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
     public static final String PATH_SEPARATOR =
         System.getProperty("path.separator");
 
@@ -239,7 +259,9 @@ public final class IntrospectionUtils {
      * property. This System property lists the classpath entries common to web
      * applications. This System property is currently used by Jasper when its
      * JSP servlet compiles the Java file for a JSP.
+     * @deprecated Not used
      */
+    @Deprecated
     public static String classPathAdd(URL urls[], String cp) {
         if (urls == null)
             return cp;
@@ -392,6 +414,10 @@ public final class IntrospectionUtils {
         return false;
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static Object getProperty(Object o, String name) {
         String getter = "get" + capitalize(name);
         String isGetter = "is" + capitalize(name);
@@ -441,7 +467,9 @@ public final class IntrospectionUtils {
     }
 
     /**
+     * @deprecated Not used
      */
+    @Deprecated
     public static void setProperty(Object o, String name) {
         String setter = "set" + capitalize(name);
         try {
@@ -463,7 +491,9 @@ public final class IntrospectionUtils {
 
     /**
      * Replace ${NAME} with the property value
+     * @deprecated Not used
      */
+    @Deprecated
     public static String replaceProperties(String value,
             Hashtable<Object,Object> staticProp, PropertySource dynamicProp[]) {
         if (value.indexOf("$") < 0) {
@@ -527,6 +557,10 @@ public final class IntrospectionUtils {
         return new String(chars);
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static String unCapitalize(String name) {
         if (name == null || name.length() == 0) {
             return name;
@@ -541,7 +575,9 @@ public final class IntrospectionUtils {
     /**
      * Add all the jar files in a dir to the classpath, represented as a Vector
      * of URLs.
+     * @deprecated Used only by deprecated method
      */
+    @Deprecated
     public static void addToClassPath(Vector<URL> cpV, String dir) {
         try {
             String cpComp[] = getFilesByExt(dir, ".jar");
@@ -558,6 +594,10 @@ public final class IntrospectionUtils {
         }
     }
 
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
     public static void addToolsJar(Vector<URL> v) {
         try {
             // Add tools.jar in any case
@@ -585,7 +625,9 @@ public final class IntrospectionUtils {
 
     /**
      * Return all files with a given extension in a dir
+     * @deprecated Used only by deprecated method
      */
+    @Deprecated
     public static String[] getFilesByExt(String ld, String ext) {
         File dir = new File(ld);
         String[] names = null;
@@ -606,7 +648,9 @@ public final class IntrospectionUtils {
 
     /**
      * Construct a file url from a file, using a base dir
+     * @deprecated Used only by deprecated method
      */
+    @Deprecated
     public static URL getURL(String base, String file) {
         try {
             File baseF = new File(base);
@@ -634,7 +678,9 @@ public final class IntrospectionUtils {
      *   separated by path.separator delimiters.
      * @throws IOException If an I/O error occurs
      * @throws MalformedURLException Doh ;)
+     * @deprecated Used only by deprecated method
      */
+    @Deprecated
     public static void addJarsFromClassPath(Vector<URL> jars, String cp)
             throws IOException, MalformedURLException {
         String sep = System.getProperty("path.separator");
@@ -657,7 +703,9 @@ public final class IntrospectionUtils {
 
     /**
      * Return a URL[] that can be used to construct a class loader
+     * @deprecated Used only by deprecated method
      */
+    @Deprecated
     public static URL[] getClassPath(Vector<URL> v) {
         URL[] urls = new URL[v.size()];
         for (int i = 0; i < v.size(); i++) {
@@ -669,7 +717,9 @@ public final class IntrospectionUtils {
     /**
      * Construct a URL classpath from files in a directory, a cpath property,
      * and tools.jar.
+     * @deprecated Not used
      */
+    @Deprecated
     public static URL[] getClassPath(String dir, String cpath,
             String cpathProp, boolean addTools) throws IOException,
             MalformedURLException {
@@ -697,6 +747,10 @@ public final class IntrospectionUtils {
     }
 
     // -------------------- other utils --------------------
+    /**
+     * @deprecated Not used, but code must be updated to call it
+     */
+    @Deprecated
     public static void clear() {
         objectMethods.clear();
     }
@@ -747,7 +801,9 @@ public final class IntrospectionUtils {
 
     /** Test if the object implements a particular
      *  method
+     * @deprecated Not used
      */
+    @Deprecated
     public static boolean hasHook(Object obj, String methodN) {
         try {
             Method myMethods[] = findMethods(obj.getClass());
@@ -773,6 +829,10 @@ public final class IntrospectionUtils {
         return false;
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static void callMain(Class<?> c, String args[]) throws Exception {
         Class<?> p[] = new Class[1];
         p[0] = args.getClass();
@@ -780,6 +840,10 @@ public final class IntrospectionUtils {
         m.invoke(c, new Object[] { args });
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static Object callMethod0(Object target, String methodN)
             throws Exception {
         if (target == null) {
@@ -800,8 +864,16 @@ public final class IntrospectionUtils {
         return m.invoke(target, emptyArray);
     }
 
-    static Object[] emptyArray = new Object[] {};
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
+    private static final Object[] emptyArray = new Object[] {};
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static Object callMethodN(Object target, String methodN,
             Object params[], Class<?> typeParams[]) throws Exception {
         Method m = null;
@@ -829,6 +901,10 @@ public final class IntrospectionUtils {
         return o;
     }
 
+    /**
+     * @deprecated Not used
+     */
+    @Deprecated
     public static Object convert(String object, Class<?> paramType) {
         Object result = null;
         if ("java.lang.String".equals(paramType.getName())) {
@@ -870,12 +946,20 @@ public final class IntrospectionUtils {
     // -------------------- Get property --------------------
     // This provides a layer of abstraction
 
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
     public static interface PropertySource {
 
         public String getProperty(String key);
 
     }
 
+    /**
+     * @deprecated Used only by deprecated method
+     */
+    @Deprecated
     public static interface AttributeHolder {
 
         public void setAttribute(String key, Object o);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org