[Clirr-devel] CVS: clirr/core/src/java/net/sf/clirr/core/spi TypeArrayBuilderSupport.java,NONE,1.1 T
Status: Alpha
Brought to you by:
lkuehne
Update of /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/spi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6735/src/java/net/sf/clirr/core/spi Modified Files: Method.java JavaType.java Added Files: TypeArrayBuilderSupport.java TypeArrayBuilder.java Log Message: Replaced BCEL with ASM. This lays the groundwork for the Java5 RFEs and also fixes bug 1373831, which was caused by a bug in BCEL. As an added bonus, the uberjar file size drops by several hundred KB. --- NEW FILE --- package net.sf.clirr.core.spi; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import net.sf.clirr.core.internal.ExceptionUtil; public abstract class TypeArrayBuilderSupport implements TypeArrayBuilder { protected ClassLoader createClassLoader(File[] jarFiles, ClassLoader thirdPartyClasses) { final URL[] jarUrls = new URL[jarFiles.length]; for (int i = 0; i < jarFiles.length; i++) { File jarFile = jarFiles[i]; try { URL url = jarFile.toURL(); jarUrls[i] = url; } catch (MalformedURLException ex) { // this should never happen final IllegalArgumentException illegalArgumentException = new IllegalArgumentException( "Cannot create classloader with jar file " + jarFile); ExceptionUtil.initCause(illegalArgumentException, ex); throw illegalArgumentException; } } final URLClassLoader jarsLoader = new URLClassLoader(jarUrls, thirdPartyClasses); return jarsLoader; } } --- NEW FILE --- package net.sf.clirr.core.spi; import java.io.File; import net.sf.clirr.core.CheckerException; import net.sf.clirr.core.ClassFilter; public interface TypeArrayBuilder { /** * Creates a set of classes to check. * * @param jarFiles a set of jar filed to scan for class files. * * @param thirdPartyClasses loads classes that are referenced * by the classes in the jarFiles * * @param classSelector is an object which determines which classes from the * old and new jars are to be compared. This parameter may be null, in * which case all classes in the old and new jars are compared. */ JavaType[] createClassSet( File[] jarFiles, ClassLoader thirdPartyClasses, ClassFilter classSelector) throws CheckerException; } Index: Method.java =================================================================== RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/spi/Method.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Method.java 26 Aug 2005 05:29:52 -0000 1.1 +++ Method.java 16 Mar 2006 22:30:19 -0000 1.2 @@ -6,8 +6,7 @@ public interface Method extends Named, Scoped { /** - * - * @return the return type of this method, or null if the method return type is <code>void</code> + * @return the return type of this method or <code>null</code> for void. */ JavaType getReturnType(); @@ -17,7 +16,7 @@ */ JavaType[] getArgumentTypes(); -// JavaType[] getDeclaredExceptions(); + JavaType[] getDeclaredExceptions(); boolean isFinal(); Index: JavaType.java =================================================================== RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/spi/JavaType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JavaType.java 2 Oct 2005 09:24:11 -0000 1.2 +++ JavaType.java 16 Mar 2006 22:30:19 -0000 1.3 @@ -9,6 +9,16 @@ { /** * The type's fully qualified class name. + * In case of array types, this is the name without the array brackets + * + * @return a fully qualified class name, + * like <code>"my.company.procuct.SampleClass"</code>. + */ + String getBasicName(); + + /** + * The type's fully qualified class name. + * In case of array types, this is the name with the array brackets. * * @return a fully qualified class name, * like <code>"my.company.procuct.SampleClass"</code>. @@ -59,13 +69,36 @@ */ Field[] getFields(); - boolean isPrimitive(); + /** + * The number of array dimensions this type has. + * @return 0 if this type does not represent an array. + */ + int getArrayDimension(); - boolean isArray(); + /** + * Whether this type represents a primitive type like <code>int</code>. + * @return true iff this type represents a primitive type. + */ + boolean isPrimitive(); + /** + * Whether this class is declared as final. + * @return true iff this type represents a final class or a {@link #isPrimitive() primitive} type. + */ boolean isFinal(); + /** + * Whether this type represents a class that is declared as abstract. + * Note that interfaces are not abstract. + * + * @return true iff this type represents an abstract class. + */ boolean isAbstract(); + /** + * Whether this type represents an interface. + * + * @return true iff this type represents an interface. + */ boolean isInterface(); } |