You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2014/02/25 09:17:29 UTC
svn commit: r1571611 [2/3] - in /commons/proper/weaver/trunk: ./ ant/lib/
ant/lib/src/main/java/org/apache/commons/weaver/ant/
build-tools/src/main/resources/org/apache/commons/weaver/ maven-plugin/
maven-plugin/src/main/java/org/apache/commons/weaver/...
Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java Tue Feb 25 08:17:27 2014
@@ -48,7 +48,8 @@ class InlineNestedPrivilegedCalls extend
* @param privilegedMethods map of original method to name of internal implementation method
* @param next visitor
*/
- InlineNestedPrivilegedCalls(Privilizer privilizer, Map<Method, String> privilegedMethods, ClassVisitor next) {
+ InlineNestedPrivilegedCalls(final Privilizer privilizer, final Map<Method, String> privilegedMethods,
+ final ClassVisitor next) {
super(Opcodes.ASM4);
this.privilizer = privilizer;
this.privilegedMethods = privilegedMethods;
@@ -61,27 +62,28 @@ class InlineNestedPrivilegedCalls extend
accept(new ClassVisitor(Opcodes.ASM4, next) {
@Override
- public MethodVisitor visitMethod(int access, final String name, String desc, String signature,
- String[] exceptions) {
+ public MethodVisitor visitMethod(final int access, final String name, final String desc,
+ final String signature, final String[] exceptions) {
final Method outer = new Method(name, desc);
final MethodVisitor orig = super.visitMethod(access, name, desc, signature, exceptions);
- if (privilegedMethods.containsValue(name)) {
- return new MethodVisitor(Opcodes.ASM4, orig) {
- public void visitMethodInsn(int opcode, String owner, String name, String desc) {
- String useName = name;
- if (owner.equals(InlineNestedPrivilegedCalls.this.name)) {
- final Method m = new Method(name, desc);
- if (privilegedMethods.containsKey(m)) {
- useName = privilegedMethods.get(m);
- privilizer.env.debug("Inlining call from %s to %s as %s", outer, m,
- useName);
- }
+ if (!privilegedMethods.containsValue(name)) {
+ return orig;
+ }
+ return new MethodVisitor(Opcodes.ASM4, orig) {
+ @Override
+ public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
+ String useName = name;
+ if (owner.equals(InlineNestedPrivilegedCalls.this.name)) {
+ final Method methd = new Method(name, desc);
+ if (privilegedMethods.containsKey(methd)) {
+ useName = privilegedMethods.get(methd);
+ privilizer.env.debug("Inlining call from %s to %s as %s", outer, methd,
+ useName);
}
- super.visitMethodInsn(opcode, owner, useName, desc);
}
- };
- }
- return orig;
+ super.visitMethodInsn(opcode, owner, useName, desc);
+ }
+ };
}
});
}
Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java Tue Feb 25 08:17:27 2014
@@ -58,14 +58,14 @@ public enum Policy {
/**
* Parse from a {@link String} returning {@link #defaultValue()} for blank/null input.
- * @param s to parse
+ * @param str to parse
* @return {@link Policy}
*/
- public static Policy parse(String s) {
- if (StringUtils.isBlank(s)) {
+ public static Policy parse(final String str) {
+ if (StringUtils.isBlank(str)) {
return defaultValue();
}
- return valueOf(s.trim().toUpperCase(Locale.US));
+ return valueOf(str.trim().toUpperCase(Locale.US));
}
/**
Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java Tue Feb 25 08:17:27 2014
@@ -56,7 +56,7 @@ public class Privilizer {
this(null);
}
- protected PrivilizerClassVisitor(ClassVisitor cv) {
+ protected PrivilizerClassVisitor(final ClassVisitor cv) { //NOPMD
super(Opcodes.ASM4, cv);
}
@@ -65,8 +65,8 @@ public class Privilizer {
}
@Override
- public void visit(int version, int access, String name, String signature, String superName,
- String[] interfaces) {
+ public void visit(final int version, final int access, final String name, final String signature, final String superName,
+ final String[] interfaces) {
super.visit(version, access, name, signature, superName, interfaces);
className = name;
target = Type.getObjectType(name);
@@ -77,8 +77,8 @@ public class Privilizer {
* Convenient {@link ClassVisitor} layer to write classfiles into the {@link WeaveEnvironment}.
*/
class WriteClass extends PrivilizerClassVisitor {
- WriteClass(ClassWriter cw) {
- super(cw);
+ WriteClass(final ClassWriter classWriter) {
+ super(classWriter);
}
@Override
@@ -96,7 +96,7 @@ public class Privilizer {
try {
outputStream = classfile.getOutputStream();
IOUtils.write(bytecode, outputStream);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(outputStream);
@@ -140,7 +140,7 @@ public class Privilizer {
* Create a new {@link Privilizer}.
* @param env to use
*/
- public Privilizer(WeaveEnvironment env) {
+ public Privilizer(final WeaveEnvironment env) {
super();
this.env = env;
this.policy = Policy.parse(env.config.getProperty(CONFIG_POLICY));
@@ -148,12 +148,12 @@ public class Privilizer {
verify = BooleanUtils.toBoolean(env.config.getProperty(CONFIG_VERIFY));
}
- String generateName(String simple) {
+ String generateName(final String simple) {
return String.format(GENERATE_NAME, simple);
}
- Type wrap(Type t) {
- switch (t.getSort()) {
+ Type wrap(final Type type) {
+ switch (type.getSort()) {
case Type.BOOLEAN:
return Type.getType(Boolean.class);
case Type.BYTE:
@@ -173,25 +173,25 @@ public class Privilizer {
case Type.VOID:
return Type.getType(Void.class);
default:
- return t;
+ return type;
}
}
void blueprint(final Class<?> type, final Privilizing privilizing) {
- Object[] args = { type.getName(), privilizing };
+ final Object[] args = { type.getName(), privilizing };
env.debug("blueprinting class %s %s", args);
InputStream bytecode = null;
try {
bytecode = env.getClassfile(type).getInputStream();
final ClassReader classReader = new ClassReader(bytecode);
- ClassVisitor cv;
- cv = new WriteClass(new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
- cv = new PrivilizingVisitor(this, cv);
- cv = new BlueprintingVisitor(this, cv, privilizing);
+ ClassVisitor cvr;
+ cvr = new WriteClass(new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
+ cvr = new PrivilizingVisitor(this, cvr);
+ cvr = new BlueprintingVisitor(this, cvr, privilizing);
- classReader.accept(cv, ClassReader.EXPAND_FRAMES);
- } catch (Exception e) {
+ classReader.accept(cvr, ClassReader.EXPAND_FRAMES);
+ } catch (final Exception e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(bytecode);
@@ -199,18 +199,18 @@ public class Privilizer {
}
void privilize(final Class<?> type) {
- Object[] args = { type.getName() };
+ final Object[] args = { type.getName() };
env.debug("privilizing class %s", args);
InputStream bytecode = null;
try {
bytecode = env.getClassfile(type).getInputStream();
final ClassReader classReader = new ClassReader(bytecode);
- ClassVisitor cv;
+ ClassVisitor cv; //NOPMD
cv = new WriteClass(new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
cv = new PrivilizingVisitor(this, cv);
classReader.accept(cv, ClassReader.EXPAND_FRAMES);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(bytecode);
@@ -221,7 +221,7 @@ public class Privilizer {
final ClassReader reader = new ClassReader(bytecode);
env.debug("Verifying bytecode for class %s", className);
- final StringWriter w = new StringWriter();
+ final StringWriter w = new StringWriter(); //NOPMD
CheckClassAdapter.verify(reader, env.classLoader, false, new PrintWriter(w));
final String error = w.toString();
if (!error.isEmpty()) {
@@ -237,7 +237,7 @@ public class Privilizer {
final Set<String> innerNames = new HashSet<String>();
@Override
- public void visitInnerClass(String name, String outerName, String innerName, int access) {
+ public void visitInnerClass(final String name, final String outerName, final String innerName, final int access) {
super.visitInnerClass(name, outerName, innerName, access);
Validate.validState(innerNames.add(innerName), "%s already defined", innerName);
}
Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java Tue Feb 25 08:17:27 2014
@@ -40,7 +40,7 @@ import org.objectweb.asm.Opcodes;
public class PrivilizerCleaner implements Cleaner {
@Override
- public boolean clean(WeaveEnvironment environment, Scanner scanner) {
+ public boolean clean(final WeaveEnvironment environment, final Scanner scanner) {
final Privilizer privilizer = new Privilizer(environment);
final List<String> toDelete = new ArrayList<String>();
@@ -48,7 +48,7 @@ public class PrivilizerCleaner implement
final ScanRequest scanRequest = new ScanRequest().add(WeaveInterest.of(Privilized.class, ElementType.TYPE));
environment.debug("Cleaning classes privilized with policy other than %s", privilizer.policy);
- for (WeavableClass<?> weavableClass : scanner.scan(scanRequest).getClasses().with(Privilized.class)) {
+ for (final WeavableClass<?> weavableClass : scanner.scan(scanRequest).getClasses().with(Privilized.class)) {
final Policy privilizedPolicy = Policy.valueOf(weavableClass.getAnnotation(Privilized.class).value());
if (privilizedPolicy == privilizer.policy) {
continue;
@@ -62,26 +62,27 @@ public class PrivilizerCleaner implement
final ClassReader classReader = new ClassReader(bytecode);
classReader.accept(new ClassVisitor(Opcodes.ASM4) {
@Override
- public void visit(int version, int access, String name, String signature, String superName,
- String[] interfaces) {
+ public void visit(final int version, final int access, final String name, final String signature,
+ final String superName, final String[] interfaces) {
toDelete.add(name);
}
@Override
- public void visitInnerClass(String name, String outerName, String innerName, int access) {
+ public void visitInnerClass(final String name, final String outerName, final String innerName,
+ final int access) {
if (toDelete.contains(outerName)) {
toDelete.add(name);
}
}
}, ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG + ClassReader.SKIP_FRAMES);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(bytecode);
}
}
boolean result = false;
- for (String className : toDelete) {
+ for (final String className : toDelete) {
final String resourcePath = toResourcePath(className);
final boolean success = environment.deleteResource(resourcePath);
environment.debug("Deletion of resource %s was %ssuccessful.", resourcePath, success ? "" : "un");
@@ -90,7 +91,7 @@ public class PrivilizerCleaner implement
return result;
}
- private static String toResourcePath(String className) {
+ private static String toResourcePath(final String className) {
return className.replace('.', '/') + ".class";
}
Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java Tue Feb 25 08:17:27 2014
@@ -35,28 +35,28 @@ import org.apache.commons.weaver.spi.Wea
*/
public class PrivilizerWeaver implements Weaver {
@Override
- public boolean process(WeaveEnvironment weaveEnvironment, Scanner scanner) {
+ public boolean process(final WeaveEnvironment weaveEnvironment, final Scanner scanner) {
final Privilizer privilizer = new Privilizer(weaveEnvironment);
final Set<Class<?>> privilizedTypes = new LinkedHashSet<Class<?>>();
// handle blueprints:
- for (WeavableClass<?> type : scanner.scan(
+ for (final WeavableClass<?> type : scanner.scan(
new ScanRequest().add(WeaveInterest.of(Privilizing.class, ElementType.TYPE))).getClasses()) {
- final Class<?> t = type.getTarget();
- if (privilizedTypes.add(t) && validateRequest(privilizer, type)) {
- privilizer.blueprint(t, type.getAnnotation(Privilizing.class));
+ final Class<?> target = type.getTarget();
+ if (privilizedTypes.add(target) && validateRequest(privilizer, type)) {
+ privilizer.blueprint(target, type.getAnnotation(Privilizing.class));
}
}
// handle remaining classes declaring @Privileged methods:
- for (WeavableClass<?> type : scanner.scan(
+ for (final WeavableClass<?> type : scanner.scan(
new ScanRequest().add(WeaveInterest.of(Privileged.class, ElementType.METHOD))).getClasses()) {
- final Class<?> t = type.getTarget();
- if (privilizedTypes.add(t) && validateRequest(privilizer, type)) {
- privilizer.privilize(t);
+ final Class<?> target = type.getTarget();
+ if (privilizedTypes.add(target) && validateRequest(privilizer, type)) {
+ privilizer.privilize(target);
}
}
return !privilizedTypes.isEmpty();
@@ -69,13 +69,14 @@ public class PrivilizerWeaver implements
* @return whether weaving should proceed
* @throws IllegalStateException if class has already been woven with some other policy
*/
- private boolean validateRequest(Privilizer privilizer, WeavableClass<?> type) {
- Privilized marker = type.getAnnotation(Privilized.class);
+ private boolean validateRequest(final Privilizer privilizer, final WeavableClass<?> type) {
+ final Privilized marker = type.getAnnotation(Privilized.class);
if (marker == null) {
return privilizer.policy != Policy.NEVER;
}
Validate.validState(privilizer.policy.name().equals(marker.value()), "%s already privilized with policy %s",
type.getTarget().getName(), marker.value());
+
return false;
}
}
Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java Tue Feb 25 08:17:27 2014
@@ -52,7 +52,7 @@ class PrivilizingVisitor extends Privili
* @param privilizer owner
* @param cv next
*/
- PrivilizingVisitor(Privilizer privilizer, ClassVisitor cv) {
+ PrivilizingVisitor(final Privilizer privilizer, final ClassVisitor cv) { //NOPMD
privilizer.super();
this.policy = privilizer.policy;
this.accessLevel = privilizer.accessLevel;
@@ -72,13 +72,14 @@ class PrivilizingVisitor extends Privili
}
@Override
- public void visitInnerClass(String name, String outerName, String innerName, int access) {
+ public void visitInnerClass(final String name, final String outerName, final String innerName, final int access) {
annotate();
super.visitInnerClass(name, outerName, innerName, access);
}
@Override
- public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
+ public FieldVisitor visitField(final int access, final String name, final String desc, final String signature,
+ final Object value) {
annotate();
return super.visitField(access, name, desc, signature, value);
}
@@ -88,24 +89,24 @@ class PrivilizingVisitor extends Privili
final String[] exceptions) {
annotate();
final MethodVisitor originalMethod = super.visitMethod(access, name, desc, signature, exceptions);
- final Method m = new Method(name, desc);
+ final Method methd = new Method(name, desc);
return new GeneratorAdapter(Opcodes.ASM4, originalMethod, access, name, desc) {
@Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+ public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
if (Type.getType(Privileged.class).getDescriptor().equals(desc)) {
final AccessLevel localAccessLevel = AccessLevel.of(access);
if (accessLevel.compareTo(localAccessLevel) > 0) {
- throw new RuntimeException(new IllegalAccessException("Method " + className + "#" + m
+ throw new RuntimeException(new IllegalAccessException("Method " + className + "#" + methd
+ " must have maximum access level '" + accessLevel + "' but is defined wider ('"
+ localAccessLevel + "')"));
}
if (AccessLevel.PACKAGE.compareTo(accessLevel) > 0) {
privilizer().env.warn("Possible security leak: granting privileges to %s method %s.%s",
- localAccessLevel, className, m);
+ localAccessLevel, className, methd);
}
- privilegedMethods.put(m, privilizer().generateName(name));
+ privilegedMethods.put(methd, privilizer().generateName(name));
}
return super.visitAnnotation(desc, visible);
}
@@ -113,10 +114,10 @@ class PrivilizingVisitor extends Privili
@Override
public void visitCode() {
super.visitCode();
- if (!privilegedMethods.containsKey(m)) {
+ if (!privilegedMethods.containsKey(methd)) {
return;
}
- final String impl = privilegedMethods.get(m);
+ final String impl = privilegedMethods.get(methd);
final boolean instanceMethod = !Modifier.isStatic(access);
if (policy.isConditional()) {
@@ -150,11 +151,11 @@ class PrivilizingVisitor extends Privili
// generate action:
final Type[] ctorArgs;
if (instanceMethod) {
- ctorArgs = ArrayUtils.add(m.getArgumentTypes(), 0, target);
+ ctorArgs = ArrayUtils.add(methd.getArgumentTypes(), 0, target);
} else {
- ctorArgs = m.getArgumentTypes();
+ ctorArgs = methd.getArgumentTypes();
}
- final Type actionType = new ActionGenerator(access, m, exceptions, PrivilizingVisitor.this).build();
+ final Type actionType = new ActionGenerator(access, methd, exceptions, PrivilizingVisitor.this).build();
newInstance(actionType);
dup();
if (instanceMethod) {
@@ -173,7 +174,7 @@ class PrivilizingVisitor extends Privili
final Method doPrivileged = new Method("doPrivileged", Type.getType(Object.class), new Type[] { arg });
invokeStatic(Type.getType(AccessController.class), doPrivileged);
- unbox(m.getReturnType());
+ unbox(methd.getReturnType());
returnValue();
if (exc) {
@@ -200,6 +201,7 @@ class PrivilizingVisitor extends Privili
}
+ @Override
public void visitEnd() {
annotate();
if (privilizer().policy == Policy.ON_INIT) {
@@ -208,13 +210,13 @@ class PrivilizingVisitor extends Privili
visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL, fieldName,
Type.BOOLEAN_TYPE.getDescriptor(), null, null).visitEnd();
- final GeneratorAdapter mg =
+ final GeneratorAdapter mgen =
new GeneratorAdapter(Opcodes.ACC_STATIC, new Method("<clinit>", "()V"), null,
Privilizer.EMPTY_TYPE_ARRAY, this);
- checkSecurityManager(mg);
- mg.putStatic(target, fieldName, Type.BOOLEAN_TYPE);
- mg.returnValue();
- mg.endMethod();
+ checkSecurityManager(mgen);
+ mgen.putStatic(target, fieldName, Type.BOOLEAN_TYPE);
+ mgen.returnValue();
+ mgen.endMethod();
}
super.visitEnd();
}
@@ -222,18 +224,18 @@ class PrivilizingVisitor extends Privili
/**
* Generates the instructions to push onto the stack whether there is a
* security manager available.
- * @param mg to control
+ * @param mgen to control
*/
- private static void checkSecurityManager(GeneratorAdapter mg) {
+ private static void checkSecurityManager(final GeneratorAdapter mgen) {
final Label setFalse = new Label();
final Label done = new Label();
- mg.invokeStatic(Type.getType(System.class),
+ mgen.invokeStatic(Type.getType(System.class),
new Method("getSecurityManager", Type.getType(SecurityManager.class), Privilizer.EMPTY_TYPE_ARRAY));
- mg.ifNull(setFalse);
- mg.push(true);
- mg.goTo(done);
- mg.mark(setFalse);
- mg.push(false);
- mg.mark(done);
+ mgen.ifNull(setFalse);
+ mgen.push(true);
+ mgen.goTo(done);
+ mgen.mark(setFalse);
+ mgen.push(false);
+ mgen.mark(done);
}
}
Modified: commons/proper/weaver/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/pom.xml?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/pom.xml (original)
+++ commons/proper/weaver/trunk/pom.xml Tue Feb 25 08:17:27 2014
@@ -260,6 +260,11 @@ under the License.
<version>2.8</version>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>3.0.1</version>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
@@ -442,6 +447,22 @@ under the License.
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>commons-weaver-build-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <rulesets>
+ <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
+ </rulesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
Modified: commons/proper/weaver/trunk/processor/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/pom.xml?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/pom.xml (original)
+++ commons/proper/weaver/trunk/processor/pom.xml Tue Feb 25 08:17:27 2014
@@ -58,6 +58,15 @@ under the License.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+ <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
+ </rulesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<configuration>
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java Tue Feb 25 08:17:27 2014
@@ -47,9 +47,9 @@ public class CleanProcessor {
private static final List<Cleaner> CLEANERS;
static {
- List<Cleaner> cleaners = new ArrayList<Cleaner>();
- for (Cleaner c : ServiceLoader.load(Cleaner.class)) {
- cleaners.add(c);
+ final List<Cleaner> cleaners = new ArrayList<Cleaner>();
+ for (final Cleaner cleaner : ServiceLoader.load(Cleaner.class)) {
+ cleaners.add(cleaner);
}
CLEANERS = Collections.unmodifiableList(cleaners);
}
@@ -76,7 +76,7 @@ public class CleanProcessor {
* @param target not {@code null}
* @param configuration not {@code null}
*/
- public CleanProcessor(List<String> classpath, File target, Properties configuration) {
+ public CleanProcessor(final List<String> classpath, final File target, final Properties configuration) {
super();
this.classpath = Validate.notNull(classpath, "classpath");
this.target = Validate.notNull(target, "target");
@@ -96,7 +96,7 @@ public class CleanProcessor {
finderClasspath.addAll(classpath);
final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(finderClasspath));
final Finder finder = new Finder(new FileArchive(classLoader, target));
- for (Cleaner cleaner : CLEANERS) {
+ for (final Cleaner cleaner : CLEANERS) {
final WeaveEnvironment env =
new LocalWeaveEnvironment(target, classLoader, configuration, Logger.getLogger(cleaner.getClass()
.getName()));
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java Tue Feb 25 08:17:27 2014
@@ -34,6 +34,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.weaver.model.ScanRequest;
import org.apache.commons.weaver.model.ScanResult;
@@ -61,7 +62,7 @@ class Finder extends AnnotationFinder im
final Class<? extends Annotation> annotationType;
final Map<String, Object> elements = new LinkedHashMap<String, Object>();
- AnnotationInflater(String desc, AnnotationVisitor wrapped) {
+ AnnotationInflater(final String desc, final AnnotationVisitor wrapped) {
super(wrapped);
this.annotationType = toClass(Type.getType(desc)).asSubclass(Annotation.class);
}
@@ -71,25 +72,25 @@ class Finder extends AnnotationFinder im
}
@Override
- protected void storeValue(String name, Object value) {
+ protected void storeValue(final String name, final Object value) {
Object toStore = value;
Validate.notNull(toStore, "null annotation element");
if (toStore.getClass().isArray()) {
final Class<?> requiredType;
try {
requiredType = annotationType.getDeclaredMethod(name).getReturnType();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
if (!requiredType.isInstance(toStore)) {
final int len = Array.getLength(toStore);
final Object typedArray = Array.newInstance(requiredType.getComponentType(), len);
for (int i = 0; i < len; i++) {
- Object o = Array.get(toStore, i);
- if (o instanceof Type) {
- o = toClass((Type) o);
+ Object element = Array.get(toStore, i);
+ if (element instanceof Type) {
+ element = toClass((Type) element);
}
- Array.set(typedArray, i, o);
+ Array.set(typedArray, i, element);
}
toStore = typedArray;
}
@@ -101,7 +102,7 @@ class Finder extends AnnotationFinder im
}
private abstract class AnnotationCapturer extends AnnotationVisitor {
- public AnnotationCapturer(AnnotationVisitor wrapped) {
+ public AnnotationCapturer(final AnnotationVisitor wrapped) {
super(Opcodes.ASM4, wrapped);
}
@@ -113,7 +114,7 @@ class Finder extends AnnotationFinder im
protected abstract void storeValue(String name, Object value);
@Override
- public void visit(String name, Object value) {
+ public void visit(final String name, final Object value) {
storeValue(name, value);
}
@@ -142,25 +143,25 @@ class Finder extends AnnotationFinder im
}
@Override
- protected void storeValue(String name, Object value) {
+ protected void storeValue(final String name, final Object value) {
values.add(value);
}
};
}
@Override
- public void visitEnum(String name, String desc, String value) {
+ public void visitEnum(final String name, final String desc, final String value) {
super.visitEnum(name, desc, value);
@SuppressWarnings("rawtypes")
final Class<? extends Enum> enumType;
try {
enumType = Class.forName(Type.getType(desc).getClassName()).asSubclass(Enum.class);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
throw new RuntimeException(e);
}
@SuppressWarnings("unchecked")
- final Enum<?> e = Enum.valueOf(enumType, value);
- storeValue(name, e);
+ final Enum<?> enumValue = Enum.valueOf(enumType, value);
+ storeValue(name, enumValue);
}
}
@@ -168,7 +169,7 @@ class Finder extends AnnotationFinder im
private class TopLevelAnnotationInflater extends AnnotationInflater {
private final Info info;
- TopLevelAnnotationInflater(String desc, AnnotationVisitor wrapped, Info info) {
+ TopLevelAnnotationInflater(final String desc, final AnnotationVisitor wrapped, final Info info) {
super(desc, wrapped);
this.info = info;
}
@@ -179,7 +180,7 @@ class Finder extends AnnotationFinder im
classfileAnnotationsFor(info).add(inflate());
}
- private List<Annotation> classfileAnnotationsFor(Info info) {
+ private List<Annotation> classfileAnnotationsFor(final Info info) {
synchronized (CLASSFILE_ANNOTATIONS) {
if (!CLASSFILE_ANNOTATIONS.get().containsKey(info)) {
final List<Annotation> result = new ArrayList<Annotation>();
@@ -198,13 +199,14 @@ class Finder extends AnnotationFinder im
public class Visitor extends ClassVisitor {
private final InfoBuildingVisitor wrapped;
- public Visitor(InfoBuildingVisitor wrapped) {
+ public Visitor(final InfoBuildingVisitor wrapped) {
super(Opcodes.ASM4, wrapped);
this.wrapped = wrapped;
}
@Override
- public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
+ public FieldVisitor visitField(final int access, final String name, final String desc, final String signature,
+ final Object value) {
final FieldVisitor toWrap = wrapped.visitField(access, name, desc, signature, value);
final ClassInfo classInfo = (ClassInfo) wrapped.getInfo();
FieldInfo testFieldInfo = null;
@@ -222,7 +224,7 @@ class Finder extends AnnotationFinder im
final FieldInfo fieldInfo = testFieldInfo;
return new FieldVisitor(Opcodes.ASM4, toWrap) {
@Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+ public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, fieldInfo);
}
@@ -230,7 +232,8 @@ class Finder extends AnnotationFinder im
}
@Override
- public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
+ public MethodVisitor visitMethod(final int access, final String name, final String desc,
+ final String signature, final String[] exceptions) {
final MethodVisitor toWrap = wrapped.visitMethod(access, name, desc, signature, exceptions);
final ClassInfo classInfo = (ClassInfo) wrapped.getInfo();
@@ -241,19 +244,19 @@ class Finder extends AnnotationFinder im
return toWrap;
}
MethodInfo testMethodInfo = null;
- final Member m;
+ final Member member;
try {
- m = compareMethodInfo.get();
+ member = compareMethodInfo.get();
// should be the most recently added method, so iterate backward:
for (int i = classInfo.getMethods().size() - 1; i >= 0; i--) {
final MethodInfo atI = classInfo.getMethods().get(i);
- if (atI.getName().equals(name) && atI.get().equals(m)) {
+ if (atI.getName().equals(name) && atI.get().equals(member)) {
testMethodInfo = atI;
break;
}
}
- } catch (ClassNotFoundException e) {
- //ignore
+ } catch (final ClassNotFoundException e) {
+ return toWrap;
}
if (testMethodInfo == null) {
return toWrap;
@@ -261,13 +264,14 @@ class Finder extends AnnotationFinder im
final MethodInfo methodInfo = testMethodInfo;
return new MethodVisitor(Opcodes.ASM4, toWrap) {
@Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+ public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, methodInfo);
}
@Override
- public AnnotationVisitor visitParameterAnnotation(int param, String desc, boolean visible) {
+ public AnnotationVisitor visitParameterAnnotation(final int param, final String desc,
+ final boolean visible) {
final AnnotationVisitor toWrap = super.visitParameterAnnotation(param, desc, visible);
if (visible) {
return toWrap;
@@ -282,8 +286,8 @@ class Finder extends AnnotationFinder im
parameterInfo = atI;
break;
}
- } catch (ClassNotFoundException e) {
- //ignore
+ } catch (final ClassNotFoundException e) {
+ continue;
}
}
return parameterInfo == null ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, parameterInfo);
@@ -292,17 +296,17 @@ class Finder extends AnnotationFinder im
}
@Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+ public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, wrapped.getInfo());
}
- private boolean isJavaIdentifier(String s) {
- if (s.isEmpty() || !Character.isJavaIdentifierStart(s.charAt(0))) {
+ private boolean isJavaIdentifier(final String toCheck) {
+ if (toCheck.isEmpty() || !Character.isJavaIdentifierStart(toCheck.charAt(0))) {
return false;
}
- for (int i = 1, sz = s.length(); i < sz; i++) {
- if (!Character.isJavaIdentifierPart(s.charAt(i))) {
+ for (final char chr : toCheck.substring(1).toCharArray()) {
+ if (!Character.isJavaIdentifierPart(chr)) {
return false;
}
}
@@ -311,32 +315,22 @@ class Finder extends AnnotationFinder im
}
private static class IncludesClassfile<T extends AnnotatedElement> implements Annotated<T> {
- private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
-
private final T target;
private final Annotation[] annotations;
- IncludesClassfile(T target, List<Annotation> classfileAnnotations) {
- this(target, classfileAnnotations.toArray(EMPTY_ANNOTATION_ARRAY));
+ IncludesClassfile(final T target, final List<Annotation> classfileAnnotations) {
+ this(target, classfileAnnotations.toArray(new Annotation[classfileAnnotations.size()]));
}
- IncludesClassfile(T target, Annotation[] classfileAnnotations) {
+ IncludesClassfile(final T target, final Annotation[] classfileAnnotations) {
super();
this.target = target;
-
- final Annotation[] runtime = target.getAnnotations();
- if (classfileAnnotations == null || classfileAnnotations.length == 0) {
- annotations = runtime;
- } else {
- annotations = new Annotation[runtime.length + classfileAnnotations.length];
- System.arraycopy(runtime, 0, annotations, 0, runtime.length);
- System.arraycopy(classfileAnnotations, 0, annotations, runtime.length, classfileAnnotations.length);
- }
+ this.annotations = ArrayUtils.addAll(target.getAnnotations(), classfileAnnotations);
}
@Override
- public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
- for (Annotation prospect : annotations) {
+ public <A extends Annotation> A getAnnotation(final Class<A> annotationType) {
+ for (final Annotation prospect : annotations) {
if (prospect.annotationType().equals(annotationType)) {
@SuppressWarnings("unchecked")
final A result = (A) prospect;
@@ -359,7 +353,7 @@ class Finder extends AnnotationFinder im
}
@Override
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+ public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) {
return getAnnotation(annotationType) != null;
}
@@ -374,41 +368,43 @@ class Finder extends AnnotationFinder im
* Helper class for finding elements with annotations (including those with classfile-level retention).
*/
public final class WithAnnotations {
+ private static final String INIT = "<init>";
+
private WithAnnotations() {
}
- public List<Annotated<Package>> findAnnotatedPackages(Class<? extends Annotation> annotation) {
+ public List<Annotated<Package>> findAnnotatedPackages(final Class<? extends Annotation> annotation) {
Finder.this.findAnnotatedPackages(annotation);
final List<Annotated<Package>> result = new ArrayList<Annotated<Package>>();
- for (Info info : getAnnotationInfos(annotation.getName())) {
+ for (final Info info : getAnnotationInfos(annotation.getName())) {
if (info instanceof PackageInfo) {
- PackageInfo packageInfo = (PackageInfo) info;
+ final PackageInfo packageInfo = (PackageInfo) info;
try {
- IncludesClassfile<Package> annotated =
+ final IncludesClassfile<Package> annotated =
new IncludesClassfile<Package>(packageInfo.get(), classfileAnnotationsFor(packageInfo));
if (annotated.isAnnotationPresent(annotation)) {
result.add(annotated);
}
- } catch (ClassNotFoundException e) {
- //ignore
+ } catch (final ClassNotFoundException e) {
+ continue;
}
}
}
return result;
}
- public List<Annotated<Class<?>>> findAnnotatedClasses(Class<? extends Annotation> annotation) {
+ public List<Annotated<Class<?>>> findAnnotatedClasses(final Class<? extends Annotation> annotation) {
Finder.this.findAnnotatedClasses(annotation);
final List<Annotated<Class<?>>> result = new ArrayList<Annotated<Class<?>>>();
- for (Info info : getAnnotationInfos(annotation.getName())) {
+ for (final Info info : getAnnotationInfos(annotation.getName())) {
if (info instanceof ClassInfo) {
- ClassInfo classInfo = (ClassInfo) info;
+ final ClassInfo classInfo = (ClassInfo) info;
IncludesClassfile<Class<?>> annotated;
try {
annotated =
new IncludesClassfile<Class<?>>(classInfo.get(), classfileAnnotationsFor(classInfo));
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
if (annotated.isAnnotationPresent(annotation)) {
@@ -419,7 +415,7 @@ class Finder extends AnnotationFinder im
return result;
}
- public List<Annotated<Class<?>>> findAssignableTypes(Class<?> supertype) {
+ public List<Annotated<Class<?>>> findAssignableTypes(final Class<?> supertype) {
final List<Annotated<Class<?>>> result = new ArrayList<Annotated<Class<?>>>();
final List<?> assignableTypes;
if (supertype.isInterface()) {
@@ -428,12 +424,12 @@ class Finder extends AnnotationFinder im
assignableTypes = Finder.this.findSubclasses(supertype);
}
- for (Object object : assignableTypes) {
+ for (final Object object : assignableTypes) {
final ClassInfo classInfo = classInfos.get(((Class<?>) object).getName());
final IncludesClassfile<Class<?>> annotated;
try {
annotated = new IncludesClassfile<Class<?>>(classInfo.get(), classfileAnnotationsFor(classInfo));
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
result.add(annotated);
@@ -441,13 +437,13 @@ class Finder extends AnnotationFinder im
return result;
}
- public List<Annotated<Method>> findAnnotatedMethods(Class<? extends Annotation> annotation) {
+ public List<Annotated<Method>> findAnnotatedMethods(final Class<? extends Annotation> annotation) {
Finder.this.findAnnotatedMethods(annotation);
final List<Annotated<Method>> result = new ArrayList<Annotated<Method>>();
- for (Info info : getAnnotationInfos(annotation.getName())) {
+ for (final Info info : getAnnotationInfos(annotation.getName())) {
if (info instanceof MethodInfo) {
- MethodInfo methodInfo = (MethodInfo) info;
- if ("<init>".equals(methodInfo.getName())) {
+ final MethodInfo methodInfo = (MethodInfo) info;
+ if (INIT.equals(methodInfo.getName())) {
continue;
}
IncludesClassfile<Method> annotated;
@@ -455,7 +451,7 @@ class Finder extends AnnotationFinder im
annotated =
new IncludesClassfile<Method>((Method) methodInfo.get(),
classfileAnnotationsFor(methodInfo));
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
if (annotated.isAnnotationPresent(annotation)) {
@@ -468,24 +464,24 @@ class Finder extends AnnotationFinder im
}
public List<Annotated<Parameter<Method>>> findAnnotatedMethodParameters(
- Class<? extends Annotation> annotationType) {
+ final Class<? extends Annotation> annotationType) {
Finder.this.findAnnotatedMethodParameters(annotationType);
final List<Annotated<Parameter<Method>>> result = new ArrayList<Annotated<Parameter<Method>>>();
- for (Info info : getAnnotationInfos(annotationType.getName())) {
+ for (final Info info : getAnnotationInfos(annotationType.getName())) {
if (info instanceof ParameterInfo) {
- ParameterInfo parameterInfo = (ParameterInfo) info;
- if ("<init>".equals(parameterInfo.getDeclaringMethod().getName())) {
+ final ParameterInfo parameterInfo = (ParameterInfo) info;
+ if (INIT.equals(parameterInfo.getDeclaringMethod().getName())) {
continue;
}
Parameter<Method> parameter;
try {
@SuppressWarnings("unchecked")
- Parameter<Method> unchecked = (Parameter<Method>) parameterInfo.get();
+ final Parameter<Method> unchecked = (Parameter<Method>) parameterInfo.get();
parameter = unchecked;
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
- IncludesClassfile<Parameter<Method>> annotated =
+ final IncludesClassfile<Parameter<Method>> annotated =
new IncludesClassfile<Parameter<Method>>(parameter, classfileAnnotationsFor(parameterInfo));
if (annotated.isAnnotationPresent(annotationType)) {
result.add(annotated);
@@ -495,21 +491,21 @@ class Finder extends AnnotationFinder im
return result;
}
- public List<Annotated<Constructor<?>>> findAnnotatedConstructors(Class<? extends Annotation> annotation) {
+ public List<Annotated<Constructor<?>>> findAnnotatedConstructors(final Class<? extends Annotation> annotation) {
Finder.this.findAnnotatedConstructors(annotation);
final List<Annotated<Constructor<?>>> result = new ArrayList<Annotated<Constructor<?>>>();
- for (Info info : getAnnotationInfos(annotation.getName())) {
+ for (final Info info : getAnnotationInfos(annotation.getName())) {
if (info instanceof MethodInfo) {
- MethodInfo methodInfo = (MethodInfo) info;
- if (!"<init>".equals(methodInfo.getName())) {
+ final MethodInfo methodInfo = (MethodInfo) info;
+ if (!INIT.equals(methodInfo.getName())) {
continue;
}
- IncludesClassfile<Constructor<?>> annotated;
+ final IncludesClassfile<Constructor<?>> annotated;
try {
annotated =
new IncludesClassfile<Constructor<?>>((Constructor<?>) methodInfo.get(),
classfileAnnotationsFor(methodInfo));
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
if (annotated.isAnnotationPresent(annotation)) {
@@ -521,25 +517,25 @@ class Finder extends AnnotationFinder im
}
public List<Annotated<Parameter<Constructor<?>>>> findAnnotatedConstructorParameters(
- Class<? extends Annotation> annotation) {
+ final Class<? extends Annotation> annotation) {
Finder.this.findAnnotatedConstructorParameters(annotation);
final List<Annotated<Parameter<Constructor<?>>>> result =
new ArrayList<Annotated<Parameter<Constructor<?>>>>();
- for (Info info : getAnnotationInfos(annotation.getName())) {
+ for (final Info info : getAnnotationInfos(annotation.getName())) {
if (info instanceof ParameterInfo) {
- ParameterInfo parameterInfo = (ParameterInfo) info;
- if (!"<init>".equals(parameterInfo.getDeclaringMethod().getName())) {
+ final ParameterInfo parameterInfo = (ParameterInfo) info;
+ if (!INIT.equals(parameterInfo.getDeclaringMethod().getName())) {
continue;
}
Parameter<Constructor<?>> parameter;
try {
@SuppressWarnings("unchecked")
- Parameter<Constructor<?>> unchecked = (Parameter<Constructor<?>>) parameterInfo.get();
+ final Parameter<Constructor<?>> unchecked = (Parameter<Constructor<?>>) parameterInfo.get();
parameter = unchecked;
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
- IncludesClassfile<Parameter<Constructor<?>>> annotated =
+ final IncludesClassfile<Parameter<Constructor<?>>> annotated =
new IncludesClassfile<Parameter<Constructor<?>>>(parameter,
classfileAnnotationsFor(parameterInfo));
if (annotated.isAnnotationPresent(annotation)) {
@@ -550,19 +546,19 @@ class Finder extends AnnotationFinder im
return result;
}
- public List<Annotated<Field>> findAnnotatedFields(Class<? extends Annotation> annotation) {
+ public List<Annotated<Field>> findAnnotatedFields(final Class<? extends Annotation> annotation) {
Finder.this.findAnnotatedFields(annotation);
final List<Annotated<Field>> result = new ArrayList<Annotated<Field>>();
- for (Info info : getAnnotationInfos(annotation.getName())) {
+ for (final Info info : getAnnotationInfos(annotation.getName())) {
if (info instanceof FieldInfo) {
- FieldInfo fieldInfo = (FieldInfo) info;
+ final FieldInfo fieldInfo = (FieldInfo) info;
try {
- IncludesClassfile<Field> annotated =
+ final IncludesClassfile<Field> annotated =
new IncludesClassfile<Field>((Field) fieldInfo.get(), classfileAnnotationsFor(fieldInfo));
if (annotated.isAnnotationPresent(annotation)) {
result.add(annotated);
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
continue;
}
}
@@ -570,7 +566,7 @@ class Finder extends AnnotationFinder im
return result;
}
- private List<Annotation> classfileAnnotationsFor(Info info) {
+ private List<Annotation> classfileAnnotationsFor(final Info info) {
synchronized (classfileAnnotations) {
if (!classfileAnnotations.containsKey(info)) {
final List<Annotation> result = new ArrayList<Annotation>();
@@ -592,7 +588,8 @@ class Finder extends AnnotationFinder im
*/
private static final ThreadLocal<Map<Info, List<Annotation>>> CLASSFILE_ANNOTATIONS =
new ThreadLocal<Map<Info, List<Annotation>>>() {
- protected java.util.Map<Info, java.util.List<Annotation>> initialValue() {
+ @Override
+ protected Map<Info, List<Annotation>> initialValue() {
return new IdentityHashMap<AnnotationFinder.Info, List<Annotation>>();
}
};
@@ -605,7 +602,7 @@ class Finder extends AnnotationFinder im
* Create a new {@link Finder} instance.
* @param archive
*/
- public Finder(Archive archive) {
+ public Finder(final Archive archive) {
super(archive, false);
classfileAnnotations = CLASSFILE_ANNOTATIONS.get();
CLASSFILE_ANNOTATIONS.remove();
@@ -625,12 +622,13 @@ class Finder extends AnnotationFinder im
/**
* {@inheritDoc}
*/
- protected void readClassDef(InputStream in) throws IOException {
+ @Override
+ protected void readClassDef(final InputStream bytecode) throws IOException {
try {
- ClassReader classReader = new ClassReader(in);
+ final ClassReader classReader = new ClassReader(bytecode);
classReader.accept(new Visitor(new InfoBuildingVisitor()), ASM_FLAGS);
} finally {
- in.close();
+ bytecode.close();
}
}
@@ -638,7 +636,7 @@ class Finder extends AnnotationFinder im
* {@inheritDoc}
*/
@Override
- public AnnotationFinder select(Class<?>... arg0) {
+ public AnnotationFinder select(final Class<?>... arg0) {
throw new UnsupportedOperationException();
}
@@ -646,7 +644,7 @@ class Finder extends AnnotationFinder im
* {@inheritDoc}
*/
@Override
- public AnnotationFinder select(Iterable<String> clazz) {
+ public AnnotationFinder select(final Iterable<String> clazz) {
throw new UnsupportedOperationException();
}
@@ -654,7 +652,7 @@ class Finder extends AnnotationFinder im
* {@inheritDoc}
*/
@Override
- public AnnotationFinder select(String... clazz) {
+ public AnnotationFinder select(final String... clazz) {
throw new UnsupportedOperationException();
}
@@ -662,43 +660,46 @@ class Finder extends AnnotationFinder im
* {@inheritDoc}
*/
@Override
- public ScanResult scan(ScanRequest request) {
+ public ScanResult scan(final ScanRequest request) {
final ScanResult result = new ScanResult();
- for (WeaveInterest interest : request.getInterests()) {
+ for (final WeaveInterest interest : request.getInterests()) {
switch (interest.target) {
case PACKAGE:
- for (Annotated<Package> pkg : this.withAnnotations().findAnnotatedPackages(interest.annotationType)) {
+ for (final Annotated<Package> pkg : this.withAnnotations().findAnnotatedPackages(
+ interest.annotationType)) {
result.getWeavable(pkg.get()).addAnnotations(pkg.getAnnotations());
}
case TYPE:
- for (Annotated<Class<?>> type : this.withAnnotations().findAnnotatedClasses(interest.annotationType)) {
+ for (final Annotated<Class<?>> type : this.withAnnotations().findAnnotatedClasses(
+ interest.annotationType)) {
result.getWeavable(type.get()).addAnnotations(type.getAnnotations());
}
break;
case METHOD:
- for (Annotated<Method> method : this.withAnnotations().findAnnotatedMethods(interest.annotationType)) {
+ for (final Annotated<Method> method : this.withAnnotations().findAnnotatedMethods(
+ interest.annotationType)) {
result.getWeavable(method.get()).addAnnotations(method.getAnnotations());
}
break;
case CONSTRUCTOR:
- for (Annotated<Constructor<?>> cs : this.withAnnotations().findAnnotatedConstructors(
+ for (final Annotated<Constructor<?>> ctor : this.withAnnotations().findAnnotatedConstructors(
interest.annotationType)) {
- result.getWeavable(cs.get()).addAnnotations(cs.getAnnotations());
+ result.getWeavable(ctor.get()).addAnnotations(ctor.getAnnotations());
}
break;
case FIELD:
- for (Annotated<Field> fld : this.withAnnotations().findAnnotatedFields(interest.annotationType)) {
+ for (final Annotated<Field> fld : this.withAnnotations().findAnnotatedFields(interest.annotationType)) {
result.getWeavable(fld.get()).addAnnotations(fld.getAnnotations());
}
break;
case PARAMETER:
- for (Annotated<Parameter<Method>> parameter : this.withAnnotations().findAnnotatedMethodParameters(
- interest.annotationType)) {
+ for (final Annotated<Parameter<Method>> parameter : this.withAnnotations()
+ .findAnnotatedMethodParameters(interest.annotationType)) {
result.getWeavable(parameter.get().getDeclaringExecutable())
.getWeavableParameter(parameter.get().getIndex()).addAnnotations(parameter.getAnnotations());
}
- for (Annotated<Parameter<Constructor<?>>> parameter : this.withAnnotations()
+ for (final Annotated<Parameter<Constructor<?>>> parameter : this.withAnnotations()
.findAnnotatedConstructorParameters(interest.annotationType)) {
result.getWeavable(parameter.get().getDeclaringExecutable())
.getWeavableParameter(parameter.get().getIndex()).addAnnotations(parameter.getAnnotations());
@@ -709,28 +710,33 @@ class Finder extends AnnotationFinder im
break;
}
}
- for (Class<?> supertype : request.getSupertypes()) {
- for (Annotated<Class<?>> type : this.withAnnotations().findAssignableTypes(supertype)) {
+ for (final Class<?> supertype : request.getSupertypes()) {
+ for (final Annotated<Class<?>> type : this.withAnnotations().findAssignableTypes(supertype)) {
result.getWeavable(type.get()).addAnnotations(type.getAnnotations());
}
}
return inflater.inflate(result);
}
- private Class<?> toClass(Type type) {
- final String className = (type.getSort() == Type.ARRAY ? type.getElementType() : type).getClassName();
+ private Class<?> toClass(final Type type) {
+ final String className;
+ if (type.getSort() == Type.ARRAY) {
+ className = type.getElementType().getClassName();
+ } else {
+ className = type.getClassName();
+ }
Class<?> result;
try {
result = Class.forName(className);
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
try {
result = getArchive().loadClass(className);
- } catch (ClassNotFoundException e1) {
+ } catch (final ClassNotFoundException e1) {
throw new RuntimeException(e1);
}
}
if (type.getSort() == Type.ARRAY) {
- int[] dims = new int[type.getDimensions()];
+ final int[] dims = new int[type.getDimensions()];
Arrays.fill(dims, 0);
result = Array.newInstance(result, dims).getClass();
}
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java Tue Feb 25 08:17:27 2014
@@ -46,42 +46,42 @@ class Inflater {
private class InfoMatcher {
final Class<? extends Info> type;
- InfoMatcher(Class<? extends Info> type) {
+ InfoMatcher(final Class<? extends Info> type) {
super();
this.type = type;
}
- boolean test(Info info) {
+ boolean test(final Info info) {
return type.isInstance(info);
}
}
private class MethodMatcher extends InfoMatcher {
- final boolean cs;
+ final boolean isCtor;
- MethodMatcher(boolean cs) {
+ MethodMatcher(final boolean isCtor) {
super(MethodInfo.class);
- this.cs = cs;
+ this.isCtor = isCtor;
}
@Override
- boolean test(Info info) {
- return super.test(info) && ((MethodInfo) info).isConstructor() == cs;
+ boolean test(final Info info) {
+ return super.test(info) && ((MethodInfo) info).isConstructor() == isCtor;
}
}
private class ParameterMatcher extends InfoMatcher {
- final boolean cs;
+ final boolean isCtor;
- ParameterMatcher(boolean cs) {
+ ParameterMatcher(final boolean isCtor) {
super(ParameterInfo.class);
- this.cs = cs;
+ this.isCtor = isCtor;
}
@Override
- boolean test(Info info) {
- return super.test(info) && ((ParameterInfo) info).getDeclaringMethod().isConstructor() == cs;
+ boolean test(final Info info) {
+ return super.test(info) && ((ParameterInfo) info).getDeclaringMethod().isConstructor() == isCtor;
}
}
@@ -93,98 +93,101 @@ class Inflater {
final Map<ParameterInfo, List<Annotation>> ctorParameterAnnotations;
final Map<ParameterInfo, List<Annotation>> methodParameterAnnotations;
- Inflater(Map<Info, List<Annotation>> m) {
+ Inflater(final Map<Info, List<Annotation>> annotationMap) {
super();
- this.packageAnnotations = subMap(m, new InfoMatcher(PackageInfo.class));
- this.classAnnotations = subMap(m, new InfoMatcher(ClassInfo.class));
- this.fieldAnnotations = subMap(m, new InfoMatcher(FieldInfo.class));
- this.ctorAnnotations = subMap(m, new MethodMatcher(true));
- this.methodAnnotations = subMap(m, new MethodMatcher(false));
- this.ctorParameterAnnotations = subMap(m, new ParameterMatcher(true));
- this.methodParameterAnnotations = subMap(m, new ParameterMatcher(false));
+ this.packageAnnotations = subMap(annotationMap, new InfoMatcher(PackageInfo.class));
+ this.classAnnotations = subMap(annotationMap, new InfoMatcher(ClassInfo.class));
+ this.fieldAnnotations = subMap(annotationMap, new InfoMatcher(FieldInfo.class));
+ this.ctorAnnotations = subMap(annotationMap, new MethodMatcher(true));
+ this.methodAnnotations = subMap(annotationMap, new MethodMatcher(false));
+ this.ctorParameterAnnotations = subMap(annotationMap, new ParameterMatcher(true));
+ this.methodParameterAnnotations = subMap(annotationMap, new ParameterMatcher(false));
}
- static <I extends Info> Map<I, List<Annotation>> subMap(Map<Info, List<Annotation>> source, InfoMatcher matcher) {
+ static <I extends Info> Map<I, List<Annotation>> subMap(final Map<Info, List<Annotation>> source,
+ final InfoMatcher matcher) {
final HashMap<I, List<Annotation>> result = new HashMap<I, List<Annotation>>();
- for (Map.Entry<Info, List<Annotation>> e : source.entrySet()) {
- if (matcher.test(e.getKey())) {
+ for (final Map.Entry<Info, List<Annotation>> entry : source.entrySet()) {
+ if (matcher.test(entry.getKey())) {
@SuppressWarnings("unchecked")
- final I key = (I) e.getKey();
- result.put(key, e.getValue());
+ final I key = (I) entry.getKey();
+ result.put(key, entry.getValue());
}
}
return result;
}
ScanResult inflate(final ScanResult scanResult) {
- for (WeavablePackage pkg : scanResult.getPackages()) {
- for (Map.Entry<PackageInfo, List<Annotation>> e : packageAnnotations.entrySet()) {
- if (e.getKey().getName().equals(pkg.getTarget().getName())) {
- pkg.addAnnotations(e.getValue());
+ for (final WeavablePackage pkg : scanResult.getPackages()) {
+ for (final Map.Entry<PackageInfo, List<Annotation>> entry : packageAnnotations.entrySet()) {
+ if (entry.getKey().getName().equals(pkg.getTarget().getName())) {
+ pkg.addAnnotations(entry.getValue());
}
}
- for (WeavableClass<?> cls : pkg.getClasses()) {
- for (Map.Entry<ClassInfo, List<Annotation>> e : classAnnotations.entrySet()) {
- if (e.getKey().getName().equals(cls.getTarget().getName())) {
- cls.addAnnotations(e.getValue());
+ for (final WeavableClass<?> cls : pkg.getClasses()) {
+ for (final Map.Entry<ClassInfo, List<Annotation>> entry : classAnnotations.entrySet()) {
+ if (entry.getKey().getName().equals(cls.getTarget().getName())) {
+ cls.addAnnotations(entry.getValue());
}
}
- for (WeavableField<?> fld : cls.getFields()) {
- for (Map.Entry<FieldInfo, List<Annotation>> e : fieldAnnotations.entrySet()) {
+ for (final WeavableField<?> fld : cls.getFields()) {
+ for (final Map.Entry<FieldInfo, List<Annotation>> entry : fieldAnnotations.entrySet()) {
try {
- if (e.getKey().get().equals(fld.getTarget())) {
- fld.addAnnotations(e.getValue());
+ if (entry.getKey().get().equals(fld.getTarget())) {
+ fld.addAnnotations(entry.getValue());
}
- } catch (ClassNotFoundException cnfe) {
- // :/
+ } catch (final ClassNotFoundException cnfe) {
+ continue;
}
}
}
- for (WeavableConstructor<?> cs : cls.getConstructors()) {
- for (Map.Entry<MethodInfo, List<Annotation>> e : ctorAnnotations.entrySet()) {
+ for (final WeavableConstructor<?> ctor : cls.getConstructors()) {
+ for (final Map.Entry<MethodInfo, List<Annotation>> entry : ctorAnnotations.entrySet()) {
try {
- if (e.getKey().get().equals(cs.getTarget())) {
- cs.addAnnotations(e.getValue());
+ if (entry.getKey().get().equals(ctor.getTarget())) {
+ ctor.addAnnotations(entry.getValue());
}
- } catch (ClassNotFoundException cnfe) {
- // :/
+ } catch (final ClassNotFoundException cnfe) {
+ continue;
}
}
- for (WeavableConstructorParameter<?> p : cs.getParameters()) {
- for (Map.Entry<ParameterInfo, List<Annotation>> e : ctorParameterAnnotations.entrySet()) {
+ for (final WeavableConstructorParameter<?> param : ctor.getParameters()) {
+ for (final Map.Entry<ParameterInfo, List<Annotation>> entry : ctorParameterAnnotations
+ .entrySet()) {
try {
- final Parameter<?> parameter = e.getKey().get();
- if (parameter.getDeclaringExecutable().equals(cs.getTarget())
- && p.getTarget().intValue() == parameter.getIndex()) {
- p.addAnnotations(e.getValue());
+ final Parameter<?> parameter = entry.getKey().get();
+ if (parameter.getDeclaringExecutable().equals(ctor.getTarget())
+ && param.getTarget().intValue() == parameter.getIndex()) {
+ param.addAnnotations(entry.getValue());
}
- } catch (ClassNotFoundException cnfe) {
- // :/
+ } catch (final ClassNotFoundException cnfe) {
+ continue;
}
}
}
}
- for (WeavableMethod<?> mt : cls.getMethods()) {
- for (Map.Entry<MethodInfo, List<Annotation>> e : methodAnnotations.entrySet()) {
+ for (final WeavableMethod<?> methd : cls.getMethods()) {
+ for (final Map.Entry<MethodInfo, List<Annotation>> entry : methodAnnotations.entrySet()) {
try {
- if (e.getKey().get().equals(mt.getTarget())) {
- mt.addAnnotations(e.getValue());
+ if (entry.getKey().get().equals(methd.getTarget())) {
+ methd.addAnnotations(entry.getValue());
}
- } catch (ClassNotFoundException cnfe) {
- // :/
+ } catch (final ClassNotFoundException cnfe) {
+ continue;
}
}
- for (WeavableMethodParameter<?> p : mt.getParameters()) {
- for (Map.Entry<ParameterInfo, List<Annotation>> e : methodParameterAnnotations.entrySet()) {
+ for (final WeavableMethodParameter<?> param : methd.getParameters()) {
+ for (final Map.Entry<ParameterInfo, List<Annotation>> entry : methodParameterAnnotations
+ .entrySet()) {
try {
- final Parameter<?> parameter = e.getKey().get();
- if (parameter.getDeclaringExecutable().equals(mt.getTarget())
- && p.getTarget().intValue() == parameter.getIndex()) {
- p.addAnnotations(e.getValue());
+ final Parameter<?> parameter = entry.getKey().get();
+ if (parameter.getDeclaringExecutable().equals(methd.getTarget())
+ && param.getTarget().intValue() == parameter.getIndex()) {
+ param.addAnnotations(entry.getValue());
}
- } catch (ClassNotFoundException cnfe) {
- // :/
+ } catch (final ClassNotFoundException cnfe) {
+ continue;
}
}
}
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java Tue Feb 25 08:17:27 2014
@@ -32,25 +32,26 @@ class LocalWeaveEnvironment extends Weav
private final File target;
- protected LocalWeaveEnvironment(File target, ClassLoader classLoader, Properties config, Logger log) {
+ protected LocalWeaveEnvironment(final File target, final ClassLoader classLoader, final Properties config,
+ final Logger log) {
super(classLoader, config, log);
Validate.notNull(target, "target");
this.target = target;
}
@Override
- public boolean deleteResource(String name) {
+ public boolean deleteResource(final String name) {
return new File(target, name).delete();
}
@Override
- protected OutputStream getOutputStream(String resourceName) throws IOException {
+ protected OutputStream getOutputStream(final String resourceName) throws IOException {
final File file = new File(target, resourceName);
final File parent = file.getParentFile();
- if (!parent.exists()) {
- Validate.validState(parent.mkdirs(), "Unable to create output directory %s", parent);
- } else {
+ if (parent.exists()) {
Validate.validState(parent.isDirectory(), "Cannot write %s to non-directory parent", file);
+ } else {
+ Validate.validState(parent.mkdirs(), "Unable to create output directory %s", parent);
}
return new FileOutputStream(file);
}
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java Tue Feb 25 08:17:27 2014
@@ -48,9 +48,9 @@ public class WeaveProcessor {
private static final List<Weaver> WEAVERS;
static {
- List<Weaver> weavers = new ArrayList<Weaver>();
- for (Weaver w : ServiceLoader.load(Weaver.class)) {
- weavers.add(w);
+ final List<Weaver> weavers = new ArrayList<Weaver>();
+ for (final Weaver weaver : ServiceLoader.load(Weaver.class)) {
+ weavers.add(weaver);
}
WEAVERS = Collections.unmodifiableList(weavers);
}
@@ -77,7 +77,7 @@ public class WeaveProcessor {
* @param target not {@code null}
* @param configuration not {@code null}
*/
- public WeaveProcessor(List<String> classpath, File target, Properties configuration) {
+ public WeaveProcessor(final List<String> classpath, final File target, final Properties configuration) {
super();
this.classpath = Validate.notNull(classpath, "classpath");
this.target = Validate.notNull(target, "target");
@@ -97,7 +97,7 @@ public class WeaveProcessor {
finderClasspath.addAll(classpath);
final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(finderClasspath));
final Finder finder = new Finder(new FileArchive(classLoader, target));
- for (Weaver weaver : WEAVERS) {
+ for (final Weaver weaver : WEAVERS) {
final WeaveEnvironment env =
new LocalWeaveEnvironment(target, classLoader, configuration, Logger.getLogger(weaver.getClass()
.getName()));
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java Tue Feb 25 08:17:27 2014
@@ -39,7 +39,7 @@ public abstract class NestedWeavable
* @param target element
* @param parent enclosing
*/
- protected NestedWeavable(TARGET target, PARENT parent) {
+ protected NestedWeavable(final TARGET target, final PARENT parent) {
super(target);
this.parent = parent;
}
@@ -54,19 +54,19 @@ public abstract class NestedWeavable
/**
* Implement {@link Comparable}.
- * @param o {@code SELF}
+ * @param obj {@code SELF}
* @return int per {@link Comparable#compareTo(Object)} contract
*/
@Override
- public final int compareTo(SELF o) {
- int result = getParent().compareTo(o.getParent());
- return result == 0 ? localCompareTo(o) : result;
+ public final int compareTo(final SELF obj) {
+ final int result = getParent().compareTo(obj.getParent());
+ return result == 0 ? localCompareTo(obj) : result;
}
/**
* Compare against {@code o} without respect to {@link #getParent()}.
- * @param o SELF{@code SELF}
+ * @param obj SELF{@code SELF}
* @return int per {@link Comparable#compareTo(Object)} contract
*/
- protected abstract int localCompareTo(SELF o);
+ protected abstract int localCompareTo(SELF obj);
}
Modified: commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java (original)
+++ commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java Tue Feb 25 08:17:27 2014
@@ -43,7 +43,7 @@ public class ScanRequest {
* @param interest {@link WeaveInterest} to add
* @return {@code this}, fluently
*/
- public ScanRequest add(WeaveInterest interest) {
+ public ScanRequest add(final WeaveInterest interest) {
if (interest == null) {
throw new NullPointerException();
}
@@ -56,7 +56,7 @@ public class ScanRequest {
* @param types {@link Class}es to add
* @return {@code this}, fluently
*/
- public ScanRequest addSupertypes(Class<?>... types) {
+ public ScanRequest addSupertypes(final Class<?>... types) {
Collections.addAll(supertypes, Validate.noNullElements(types, "null element at [%s]"));
return this;
}