You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2004/01/17 04:09:48 UTC
cvs commit: incubator-geronimo/modules/common/src/java/org/apache/geronimo/common Classes.java
jboynes 2004/01/16 19:09:48
Modified: modules/common/src/java/org/apache/geronimo/common
Classes.java
Log:
removed forceLoad as it is not used and it means this needs commons-lang
Revision Changes Path
1.9 +2 -54 incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/Classes.java
Index: Classes.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/Classes.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Classes.java 17 Nov 2003 00:46:39 -0000 1.8
+++ Classes.java 17 Jan 2004 03:09:48 -0000 1.9
@@ -61,14 +61,12 @@
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.lang.ClassUtils;
import org.apache.geronimo.common.propertyeditor.PropertyEditors;
/**
@@ -76,58 +74,8 @@
*
* @version $Revision$ $Date$
*/
-public class Classes extends ClassUtils {
+public class Classes {
private static final Class[] stringArg = new Class[]{String.class};
-
- /**
- * Force the given class to be loaded fully.
- *
- * <p>This method attempts to locate a static method on the given class
- * the attempts to invoke it with dummy arguments in the hope that
- * the virtual machine will prepare the class for the method call and
- * call all of the static class initializers.
- *
- * @param type Class to force load.
- *
- * @throws NullArgumentException Type is <i>null</i>.
- */
- public static void forceLoad(final Class type) {
- if (type == null)
- throw new NullArgumentException("type");
-
- // don't attempt to force primitives to load
- if (type.isPrimitive()) return;
-
- // don't attempt to force java.* classes to load
- String packageName = ClassUtils.getPackageName(type);
- assert packageName != null;
-
- if (packageName.startsWith("java.") ||
- packageName.startsWith("javax.")) {
- return;
- }
-
- try {
- Method methods[] = type.getDeclaredMethods();
- Method method = null;
- for (int i = 0; i < methods.length; i++) {
- int modifiers = methods[i].getModifiers();
- if (Modifier.isStatic(modifiers)) {
- method = methods[i];
- break;
- }
- }
-
- if (method != null) {
- method.invoke(null, null);
- } else {
- type.newInstance();
- }
- } catch (Exception ignore) {
- ThrowableHandler.add(ignore);
- }
- }
-
/////////////////////////////////////////////////////////////////////////
// Primitives //