You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2007/05/12 20:09:06 UTC
svn commit: r537502 -
/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
Author: nbubna
Date: Sat May 12 11:09:05 2007
New Revision: 537502
URL: http://svn.apache.org/viewvc?view=rev&rev=537502
Log:
only consider a tool old if it's init() is not deprecated
Modified:
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java?view=diff&rev=537502&r1=537501&r2=537502
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java (original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java Sat May 12 11:09:05 2007
@@ -19,6 +19,7 @@
* under the License.
*/
+import java.lang.reflect.Method;
import java.util.Map;
import org.apache.velocity.tools.OldToolInfo;
import org.apache.velocity.tools.ToolInfo;
@@ -130,23 +131,20 @@
Class clazz = getToolClass();
try
{
- clazz.getMethod("init", new Class[]{ Object.class });
- // ok, if they have init, but not configure
- // then we consider them "old"
- try
- {
- clazz.getMethod("configure", new Class[]{ Map.class });
- return false;
- }
- catch (NoSuchMethodException nsme)
+ Method init = clazz.getMethod("init", new Class[]{ Object.class });
+ // if init is deprecated, then we'll consider it a
+ // new tool with BC support, not an old tool
+ Deprecated bc = init.getAnnotation(Deprecated.class);
+ if (bc == null)
{
return true;
}
}
catch (NoSuchMethodException nsme)
{
- return false;
+ // ignore this
}
+ return false;
}
public String getRestrictTo()