From: <dgr...@us...> - 2007-08-14 01:09:12
|
Revision: 13284 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=13284&view=rev Author: dgrove-oss Date: 2007-08-13 18:09:10 -0700 (Mon, 13 Aug 2007) Log Message: ----------- checkstyle fixes; no semantic changes. Modified Paths: -------------- rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java rvmroot/trunk/libraryInterface/Common/src/java/lang/JikesRVMSupport.java rvmroot/trunk/libraryInterface/Common/src/java/lang/Object.java rvmroot/trunk/libraryInterface/Common/src/java/lang/ref/Reference.java rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Constructor.java rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Field.java rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Method.java Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -53,12 +53,10 @@ * as they appear in the method summary list of Sun's 1.4 Javadoc API. */ public final class Class<T> implements Serializable, Type, AnnotatedElement, GenericDeclaration { - private static final class StaticData - { + private static final class StaticData { static final ProtectionDomain unknownProtectionDomain; - static - { + static { Permissions permissions = new Permissions(); permissions.add(new AllPermission()); unknownProtectionDomain = new ProtectionDomain(null, permissions); @@ -111,10 +109,9 @@ try { security.checkPermission(new RuntimePermission("getClassLoader")); } catch (SecurityException e) { - throw new ClassNotFoundException( - "Security exception when" - + " trying to get a classloader so we can load the" - + " class named \"" + className +"\"", e); + throw new ClassNotFoundException("Security exception when" + + " trying to get a classloader so we can load the" + + " class named \"" + className +"\"", e); } } } @@ -123,9 +120,7 @@ return forNameInternal(className, initialize, classLoader); } - public Class<?>[] getClasses() - throws SecurityException - { + public Class<?>[] getClasses() throws SecurityException { checkMemberAccess(Member.PUBLIC); if (!type.isClassType()) return new Class[0]; @@ -162,14 +157,12 @@ } public Class<?> getComponentType() { - return type.isArrayType() - ? type.asArray().getElementType().getClassForType() - : null; + return type.isArrayType() ? type.asArray().getElementType().getClassForType(): null; } public Constructor<?> getConstructor(Class<?>[] parameterTypes) - throws NoSuchMethodException, SecurityException - { + throws NoSuchMethodException, SecurityException { + checkMemberAccess(Member.PUBLIC); if (!type.isClassType()) throw new NoSuchMethodException(); @@ -181,12 +174,10 @@ } } - throw new NoSuchMethodException("<init> " + parameterTypes ); + throw new NoSuchMethodException("<init> " + parameterTypes); } - public Constructor<?>[] getConstructors() - throws SecurityException - { + public Constructor<?>[] getConstructors() throws SecurityException { checkMemberAccess(Member.PUBLIC); if (!type.isClassType()) return new Constructor[0]; @@ -200,9 +191,7 @@ return coll.constructorArray(); } - public Class<?>[] getDeclaredClasses() - throws SecurityException - { + public Class<?>[] getDeclaredClasses() throws SecurityException { checkMemberAccess(Member.DECLARED); if (!type.isClassType()) return new Class[0]; @@ -237,8 +226,7 @@ } public Constructor<?> getDeclaredConstructor(Class<?>[] parameterTypes) - throws NoSuchMethodException, SecurityException - { + throws NoSuchMethodException, SecurityException { checkMemberAccess(Member.DECLARED); if (!type.isClassType()) throw new NoSuchMethodException(); @@ -250,7 +238,7 @@ } } - throw new NoSuchMethodException("<init> " + parameterTypes ); + throw new NoSuchMethodException("<init> " + parameterTypes); } public Constructor<?>[] getDeclaredConstructors() throws SecurityException { @@ -266,8 +254,7 @@ } public Field getDeclaredField(String name) - throws NoSuchFieldException, SecurityException - { + throws NoSuchFieldException, SecurityException { checkMemberAccess(Member.DECLARED); if (!type.isClassType()) throw new NoSuchFieldException(); @@ -296,8 +283,7 @@ } public Method getDeclaredMethod(String name, Class<?>[] parameterTypes) - throws NoSuchMethodException, SecurityException - { + throws NoSuchMethodException, SecurityException { checkMemberAccess(Member.DECLARED); if (!type.isClassType()) { @@ -305,10 +291,9 @@ } VM_Atom aName = VM_Atom.findUnicodeAtom(name); - if (aName == null - || aName == VM_ClassLoader.StandardClassInitializerMethodName - || aName == VM_ClassLoader.StandardObjectInitializerMethodName) - { + if (aName == null || + aName == VM_ClassLoader.StandardClassInitializerMethodName || + aName == VM_ClassLoader.StandardObjectInitializerMethodName) { // null means that we don't have such an atom; // <init> and <clinit> are not methods. throw new NoSuchMethodException(name + parameterTypes); @@ -392,7 +377,7 @@ return coll.fieldArray(); } - public Class<?>[] getInterfaces () { + public Class<?>[] getInterfaces() { if (type.isArrayType()) { // arrays implement JavaLangSerializable & JavaLangCloneable return new Class[] { VM_Type.JavaLangCloneableType.getClassForType(), @@ -543,7 +528,7 @@ } } - public Class<?> getSuperclass () { + public Class<?> getSuperclass() { if (type.isArrayType()) { return VM_Type.JavaLangObjectType.getClassForType(); } else if (type.isClassType()) { @@ -680,8 +665,7 @@ VM_Atom descriptor = VM_Atom .findOrCreateAsciiAtom(className.replace('.','/')) .descriptorFromClassName(); - VM_TypeReference tRef - = VM_TypeReference.findOrCreate(classLoader, descriptor); + VM_TypeReference tRef = VM_TypeReference.findOrCreate(classLoader, descriptor); VM_Type ans = tRef.resolve(); VM_Callbacks.notifyForName(ans); if (initialize && !ans.isInitialized()) { @@ -743,11 +727,10 @@ String qualifiedClassName = getName(); int classIndex = qualifiedClassName.lastIndexOf('.'); if (classIndex == -1) return resName; // from a default package - return qualifiedClassName.substring(0, classIndex + 1).replace('.', '/') - + resName; + return qualifiedClassName.substring(0, classIndex + 1).replace('.', '/') + resName; } - private static boolean validArrayDescriptor (String name) { + private static boolean validArrayDescriptor(String name) { int i; int length = name.length(); @@ -842,8 +825,7 @@ public boolean isAnonymousClass() { if (type.isClassType()) { return type.asClass().isAnonymousClass(); - } - else { + } else { return false; } } @@ -851,8 +833,7 @@ public boolean isLocalClass() { if (type.isClassType()) { return type.asClass().isLocalClass(); - } - else { + } else { return false; } } @@ -860,8 +841,7 @@ public boolean isMemberClass() { if (type.isClassType()) { return type.asClass().isMemberClass(); - } - else { + } else { return false; } } @@ -891,8 +871,7 @@ public Type[] getGenericInterfaces() { if (type.isPrimitiveType()) { return new Type[0]; - } - else if (type.isArrayType()) { + } else if (type.isArrayType()) { // arrays implement JavaLangSerializable & JavaLangCloneable return new Class[] { VM_Type.JavaLangCloneableType.getClassForType(), VM_Type.JavaIoSerializableType.getClassForType()}; @@ -910,31 +889,25 @@ public Type getGenericSuperclass() { if (type.isArrayType()) { return Object.class; - } - else if (type.isPrimitiveType() || - (type.isClassType() && type.asClass().isInterface()) || - (this == Object.class) - ) - { - return null; + } else if (type.isPrimitiveType() || + (type.isClassType() && type.asClass().isInterface()) || + this == Object.class) { + return null; + } else { + VM_Class klass = type.asClass(); + VM_Atom sig = klass.getSignature(); + if (sig == null) { + return getSuperclass(); + } else { + return JikesRVMHelpers.getSuperclassType(this, sig); } - else { - VM_Class klass = type.asClass(); - VM_Atom sig = klass.getSignature(); - if (sig == null) { - return getSuperclass(); - } - else { - return JikesRVMHelpers.getSuperclassType(this, sig); - } } } public TypeVariable<?>[] getTypeParameters() { if (!type.isClassType()) { return new TypeVariable[0]; - } - else { + } else { VM_Class klass = type.asClass(); VM_Atom sig = klass.getSignature(); if (sig == null) { @@ -948,8 +921,7 @@ public String getSimpleName() { if (type.isArrayType()) { return getComponentType().getSimpleName() + "[]"; - } - else { + } else { String fullName = getName(); return fullName.substring(fullName.lastIndexOf(".") + 1); } @@ -976,12 +948,10 @@ VM_TypeReference enclosingClass = type.asClass().getEnclosingClass(); if(enclosingClass != null) { return create(enclosingClass.resolve()); - } - else { + } else { return null; } - } - else { + } else { return null; } } @@ -1006,19 +976,15 @@ if (isEnum()) { try { return (Object[])getMethod("values", new Class[0]).invoke(null, new Object[0]); - } - catch (NoSuchMethodException exception) { + } catch (NoSuchMethodException exception) { throw new Error("Enum lacks values() method"); - } - catch (IllegalAccessException exception) { + } catch (IllegalAccessException exception) { throw new Error("Unable to access Enum class"); - } - catch (InvocationTargetException exception) { + } catch (InvocationTargetException exception) { throw new RuntimeException("The values method threw an exception", exception); } - } - else { + } else { return null; } } @@ -1026,8 +992,7 @@ public boolean isEnum() { if(type.isClassType()) { return type.asClass().isEnum(); - } - else { + } else { return false; } } Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/JikesRVMSupport.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/JikesRVMSupport.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/JikesRVMSupport.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -90,15 +90,13 @@ public static VM_Thread getThread(Thread thread) { if (thread == null) { return null; - } - else if(thread.vmThread == null) { + } else if(thread.vmThread == null) { return null; - } - else { + } else { return thread.vmThread.vmdata; } } - + public static void threadDied(Thread thread) { thread.die(); } Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/Object.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/Object.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/Object.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -29,12 +29,12 @@ return VM_Runtime.clone(this); } - public boolean equals (Object o) { + public boolean equals(Object o) { return this == o; } @SuppressWarnings({"PMD.EmptyFinalizer","FinalizeDoesntCallSuperFinalize"}) - protected void finalize () throws Throwable { + protected void finalize() throws Throwable { } public final Class<?> getClass() { @@ -53,24 +53,24 @@ VM_Thread.notifyAll(this); } - public String toString () { + public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } - public final void wait () throws InterruptedException, + public final void wait() throws InterruptedException, IllegalMonitorStateException { VM_Thread.wait(this); } - public final void wait (long time) throws InterruptedException, + public final void wait(long time) throws InterruptedException, IllegalMonitorStateException, IllegalArgumentException { wait(time, 0); } - public final void wait (long time, int frac) throws InterruptedException, - IllegalMonitorStateException, - IllegalArgumentException { + public final void wait(long time, int frac) throws InterruptedException, + IllegalMonitorStateException, + IllegalArgumentException { if (time >= 0 && frac >= 0 && frac < 1000000) { if (time == 0 && frac > 0) { time = 1; Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/ref/Reference.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/ref/Reference.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/ref/Reference.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -26,7 +26,7 @@ /** * The underlying object. This field is a Address so it will not * be automatically kept alive by the garbage collector. - * + * * Set and maintained by the ReferenceProcessor class. */ private Address referent; @@ -58,7 +58,7 @@ throw new NullPointerException(); queue = q; } - + /** * Returns the object, this reference refers to. * @return the object, this reference refers to, or null if the @@ -80,17 +80,17 @@ * * @param tmp The non-zero referent address * @return The referent object. - */ + */ @Uninterruptible @Inline - private final Object getInternal(Address tmp) { + private Object getInternal(Address tmp) { Object ref = VM_Magic.addressAsObject(tmp); if (MM_Constants.NEEDS_REFTYPE_READ_BARRIER) { ref = MM_Interface.referenceTypeReadBarrier(ref); } - return ref; + return ref; } public void clear() { Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Constructor.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Constructor.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Constructor.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -23,8 +23,7 @@ * as they appear in the method summary list of Sun's 1.4 Javadoc API. */ public final class Constructor<T> extends AccessibleObject - implements GenericDeclaration, Member -{ + implements GenericDeclaration, Member { final VM_Method constructor; // Prevent this class from being instantiated. @@ -77,7 +76,7 @@ } public boolean isSynthetic() { - return constructor.isSynthetic(); + return constructor.isSynthetic(); } public Object newInstance(Object[] args) throws InstantiationException, @@ -138,19 +137,19 @@ Modifier.toString(getModifiers(), sb).append(' '); sb.append(getDeclaringClass().getName()).append('('); Class<?>[] c = getParameterTypes(); - if (c.length > 0) - { + if (c.length > 0) { sb.append(JikesRVMHelpers.getUserName(c[0])); - for (int i = 1; i < c.length; i++) + for (int i = 1; i < c.length; i++) { sb.append(',').append(JikesRVMHelpers.getUserName(c[i])); + } } sb.append(')'); c = getExceptionTypes(); - if (c.length > 0) - { + if (c.length > 0) { sb.append(" throws ").append(c[0].getName()); - for (int i = 1; i < c.length; i++) + for (int i = 1; i < c.length; i++) { sb.append(',').append(c[i].getName()); + } } return sb.toString(); } @@ -190,19 +189,19 @@ addTypeParameters(sb, getTypeParameters()); sb.append(getDeclaringClass().getName()).append('('); Type[] types = getGenericParameterTypes(); - if (types.length > 0) - { + if (types.length > 0) { sb.append(types[0]); - for (int i = 1; i < types.length; ++i) + for (int i = 1; i < types.length; ++i) { sb.append(',').append(types[i]); + } } sb.append(')'); types = getGenericExceptionTypes(); - if (types.length > 0) - { + if (types.length > 0) { sb.append(" throws ").append(types[0]); - for (int i = 1; i < types.length; i++) + for (int i = 1; i < types.length; i++) { sb.append(',').append(types[i]); + } } return sb.toString(); } @@ -211,10 +210,10 @@ if (typeArgs.length == 0) return; sb.append('<'); - for (int i = 0; i < typeArgs.length; ++i) - { - if (i > 0) + for (int i = 0; i < typeArgs.length; ++i) { + if (i > 0) { sb.append(','); + } sb.append(typeArgs[i]); } sb.append("> "); Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Field.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Field.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Field.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -163,9 +163,8 @@ } catch (NoClassDefFoundError e) { throw new IllegalArgumentException("field type mismatch"); } - if (fieldType != valueType - && !VM_Runtime.isAssignableWith(fieldType, valueType)) - { + if (fieldType != valueType && + !VM_Runtime.isAssignableWith(fieldType, valueType)) { throw new IllegalArgumentException("field type mismatch"); } } Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Method.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Method.java 2007-08-14 01:08:46 UTC (rev 13283) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/Method.java 2007-08-14 01:09:10 UTC (rev 13284) @@ -140,9 +140,9 @@ return VM_Reflection.invoke(method, receiver, args); } catch (Throwable t) { throw new InvocationTargetException(t, - "While invoking the method:\n\t\"" + method + "\"\n" - + " on the object:\n\t\"" + receiver + "\"\n" - + " it threw the exception:\n\t\"" + t + "\""); + "While invoking the method:\n\t\"" + method + "\"\n" + + " on the object:\n\t\"" + receiver + "\"\n" + + " it threw the exception:\n\t\"" + t + "\""); } } @@ -153,16 +153,15 @@ sb.append(getDeclaringClass().getName()).append('.'); sb.append(getName()).append('('); Class<?>[] c = getParameterTypes(); - if (c.length > 0) - { + if (c.length > 0) { sb.append(JikesRVMHelpers.getUserName(c[0])); - for (int i = 1; i < c.length; i++) + for (int i = 1; i < c.length; i++) { sb.append(',').append(JikesRVMHelpers.getUserName(c[i])); + } } sb.append(')'); c = getExceptionTypes(); - if (c.length > 0) - { + if (c.length > 0) { sb.append(" throws ").append(c[0].getName()); for (int i = 1; i < c.length; i++) sb.append(',').append(c[i].getName()); @@ -226,19 +225,19 @@ sb.append(getDeclaringClass().getName()).append('.'); sb.append(getName()).append('('); Type[] types = getGenericParameterTypes(); - if (types.length > 0) - { + if (types.length > 0) { sb.append(types[0]); - for (int i = 1; i < types.length; i++) + for (int i = 1; i < types.length; i++) { sb.append(',').append(types[i]); + } } sb.append(')'); types = getGenericExceptionTypes(); - if (types.length > 0) - { + if (types.length > 0) { sb.append(" throws ").append(types[0]); - for (int i = 1; i < types.length; i++) + for (int i = 1; i < types.length; i++) { sb.append(',').append(types[i]); + } } return sb.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |