commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1571611 [1/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/...
Date Tue, 25 Feb 2014 08:17:29 GMT
Author: mbenson
Date: Tue Feb 25 08:17:27 2014
New Revision: 1571611

URL: http://svn.apache.org/r1571611
Log:
add PMD reports

Added:
    commons/proper/weaver/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml
      - copied, changed from r1534717, commons/proper/codec/trunk/pmd.xml
Modified:
    commons/proper/weaver/trunk/ant/lib/pom.xml
    commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java
    commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java
    commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java
    commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java
    commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java
    commons/proper/weaver/trunk/maven-plugin/pom.xml
    commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java
    commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java
    commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java
    commons/proper/weaver/trunk/modules/normalizer/weaver/pom.xml
    commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java
    commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java
    commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/pom.xml
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
    commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java
    commons/proper/weaver/trunk/pom.xml
    commons/proper/weaver/trunk/processor/pom.xml
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/Weavable.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableClass.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructor.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructorParameter.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableExecutable.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableField.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethod.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethodParameter.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavablePackage.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableParameter.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveInterest.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Annotations.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Args.java
    commons/proper/weaver/trunk/processor/src/main/java/org/apache/commons/weaver/utils/URLArray.java

Modified: commons/proper/weaver/trunk/ant/lib/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/ant/lib/pom.xml?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/ant/lib/pom.xml (original)
+++ commons/proper/weaver/trunk/ant/lib/pom.xml Tue Feb 25 08:17:27 2014
@@ -150,6 +150,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/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java (original)
+++ commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java Tue Feb 25 08:17:27 2014
@@ -33,7 +33,7 @@ public abstract class AbstractWeaverTask
      * Create a new {@link AbstractWeaverTask} instance.
      * @param project owner
      */
-    protected AbstractWeaverTask(Project project) {
+    protected AbstractWeaverTask(final Project project) {
         super();
         setProject(project);
     }
@@ -42,7 +42,7 @@ public abstract class AbstractWeaverTask
      * Add a nested {@link WeaverSettings}.
      * @param settings to add
      */
-    public void add(WeaverSettings settings) {
+    public void add(final WeaverSettings settings) {
         if (this.settings != null) {
             throw new BuildException("settings already specified");
         }
@@ -61,7 +61,7 @@ public abstract class AbstractWeaverTask
      * Set a project reference to a {@link WeaverSettings} object.
      * @param refid key
      */
-    public void setSettingsRef(String refid) {
+    public void setSettingsRef(final String refid) {
         final WeaverSettings settings = new WeaverSettings(getProject());
         settings.setRefid(new Reference(getProject(), refid));
         add(settings);

Modified: commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java (original)
+++ commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java Tue Feb 25 08:17:27 2014
@@ -31,7 +31,7 @@ public class CleanTask extends AbstractW
      * Create a new {@link CleanTask} instance.
      * @param project owner
      */
-    public CleanTask(Project project) {
+    public CleanTask(final Project project) {
         super(project);
     }
 
@@ -42,10 +42,10 @@ public class CleanTask extends AbstractW
     public void execute() {
         try {
             final WeaverSettings settings = Validate.notNull(getSettings(), "settings");
-            final CleanProcessor cp =
+            final CleanProcessor cleanProcessor =
                 new CleanProcessor(settings.getClasspathEntries(), settings.getTarget(), settings.getProperties());
-            cp.clean();
-        } catch (Exception e) {
+            cleanProcessor.clean();
+        } catch (final Exception e) {
             throw new BuildException(e);
         }
     }

Modified: commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java (original)
+++ commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java Tue Feb 25 08:17:27 2014
@@ -40,7 +40,7 @@ public class InlineProperties implements
     public final class InlineProperty {
         private final String name;
 
-        private InlineProperty(String name) {
+        private InlineProperty(final String name) {
             this.name = name;
         }
 
@@ -48,7 +48,7 @@ public class InlineProperties implements
          * Add text to this property.
          * @param text to add
          */
-        public void addText(String text) {
+        public void addText(final String text) {
             final String value;
             if (properties.containsKey(name)) {
                 value = StringUtils.join(properties.getProperty(name), text);
@@ -72,7 +72,7 @@ public class InlineProperties implements
      * @return InlineProperty
      */
     @Override
-    public InlineProperty createDynamicElement(String uri, String localName, String qName) {
+    public InlineProperty createDynamicElement(final String uri, final String localName, final String qName) {
         return new InlineProperty(localName);
     }
 }
\ No newline at end of file

Modified: commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java (original)
+++ commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java Tue Feb 25 08:17:27 2014
@@ -31,7 +31,7 @@ public class WeaveTask extends AbstractW
      * Create a new {@link WeaveTask} instance.
      * @param project owner
      */
-    public WeaveTask(Project project) {
+    public WeaveTask(final Project project) {
         super(project);
     }
 
@@ -42,10 +42,10 @@ public class WeaveTask extends AbstractW
     public void execute() {
         try {
             final WeaverSettings settings = Validate.notNull(getSettings(), "settings");
-            final WeaveProcessor wp =
+            final WeaveProcessor weaveProcessor =
                 new WeaveProcessor(settings.getClasspathEntries(), settings.getTarget(), settings.getProperties());
-            wp.weave();
-        } catch (Exception e) {
+            weaveProcessor.weave();
+        } catch (final Exception e) {
             throw new BuildException(e);
         }
     }

Modified: commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java (original)
+++ commons/proper/weaver/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java Tue Feb 25 08:17:27 2014
@@ -56,7 +56,7 @@ public class WeaverSettings extends Data
      * Create a new {@link WeaverSettings} object.
      * @param project owner
      */
-    public WeaverSettings(Project project) {
+    public WeaverSettings(final Project project) {
         super();
         setProject(project);
     }
@@ -76,7 +76,7 @@ public class WeaverSettings extends Data
      * Set the {@code target} directory.
      * @param target {@link File}
      */
-    public void setTarget(File target) {
+    public void setTarget(final File target) {
         if (isReference()) {
             throw tooManyAttributes();
         }
@@ -98,7 +98,7 @@ public class WeaverSettings extends Data
      * Set the {@code classpathref}.
      * @param classpathref {@link String}
      */
-    public void setClasspathRef(String classpathref) {
+    public void setClasspathRef(final String classpathref) {
         if (isReference()) {
             throw tooManyAttributes();
         }
@@ -111,14 +111,14 @@ public class WeaverSettings extends Data
      * @return List<String>
      */
     public List<String> getClasspathEntries() {
-        final Path p = new Path(getProject());
-        final Path cp = getClasspath();
-        if (cp != null) {
-            p.add(cp);
+        final Path path = new Path(getProject());
+        final Path classpath = getClasspath();
+        if (classpath != null) {
+            path.add(classpath);
         }
-        p.add(Path.systemClasspath);
+        path.add(Path.systemClasspath);
 
-        return Arrays.asList(p.list());
+        return Arrays.asList(path.list());
     }
 
     /**
@@ -131,7 +131,7 @@ public class WeaverSettings extends Data
         }
         if (classpath == null) {
             if (getClasspathref() != null) {
-                Path ref = new Path(getProject());
+                final Path ref = new Path(getProject());
                 ref.setRefid(new Reference(getProject(), getClasspathref()));
                 return ref;
             }
@@ -145,7 +145,7 @@ public class WeaverSettings extends Data
      * Set the {@code classpath}.
      * @param classpath {@link Path}
      */
-    public void setClasspath(Path classpath) {
+    public void setClasspath(final Path classpath) {
         if (isReference()) {
             throw tooManyAttributes();
         }
@@ -203,15 +203,15 @@ public class WeaverSettings extends Data
             result.putAll(propertySet.getProperties());
         }
         if (inlineProperties != null) {
-            for (Map.Entry<Object, Object> e : inlineProperties.properties.entrySet()) {
-                result.put(e.getKey(), StringUtils.trim((String) e.getValue()));
+            for (final Map.Entry<Object, Object> entry : inlineProperties.properties.entrySet()) {
+                result.put(entry.getKey(), StringUtils.trim((String) entry.getValue()));
             }
         }
         return result;
     }
 
     private WeaverSettings getRef() {
-        return (WeaverSettings) getCheckedRef(WeaverSettings.class, "settings");
+        return getCheckedRef(WeaverSettings.class, "settings");
     }
 
 }
\ No newline at end of file

Copied: commons/proper/weaver/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml (from r1534717, commons/proper/codec/trunk/pmd.xml)
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml?p2=commons/proper/weaver/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml&p1=commons/proper/codec/trunk/pmd.xml&r1=1534717&r2=1571611&rev=1571611&view=diff
==============================================================================
--- commons/proper/codec/trunk/pmd.xml (original)
+++ commons/proper/weaver/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml Tue Feb 25 08:17:27 2014
@@ -19,8 +19,59 @@ limitations under the License.
     xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
-  <description>Excludes from default PMD rules.</description>
-  <rule ref="rulesets/java/unusedcode.xml">
-    <exclude name="UnnecessaryParentheses"/>
+  <description>Custom PMD setup for Apache Commons Weaver</description>
+
+  <rule ref="rulesets/java/basic.xml">
+    <exclude name="AvoidBranchingStatementAsLastInLoop" />
   </rule>
-</ruleset>
\ No newline at end of file
+
+  <rule ref="rulesets/java/design.xml">
+    <exclude name="AccessorClassGeneration" />
+    <exclude name="CompareObjectsWithEquals" />
+    <exclude name="NonStaticInitializer" />
+    <exclude name="ConfusingTernary" />
+    <exclude name="AvoidSynchronizedAtMethodLevel" />
+    <exclude name="UnnecessaryLocalBeforeReturn" />
+    <exclude name="PreserveStackTrace" />
+    <exclude name="EmptyMethodInAbstractClassShouldBeAbstract" />
+    <exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
+    <exclude name="GodClass" />
+  </rule>
+
+  <rule ref="rulesets/java/empty.xml" />
+  <rule ref="rulesets/java/imports.xml" />
+  <rule ref="rulesets/java/migrating.xml">
+    <exclude name="JUnit4TestShouldUseTestAnnotation" />
+  </rule>
+  <rule ref="rulesets/java/naming.xml">
+    <exclude name="AbstractNaming" />
+    <exclude name="AvoidFieldNameMatchingMethodName" />
+    <exclude name="GenericsNaming" />
+    <exclude name="LongVariable" />
+    <exclude name="ShortClassName" />
+    <exclude name="ShortMethodName" />
+  </rule>
+  <rule ref="rulesets/java/optimizations.xml">
+    <exclude name="AvoidInstantiatingObjectsInLoops" />
+    <exclude name="PrematureDeclaration" />
+  </rule>
+  <rule ref="rulesets/java/strings.xml">
+    <exclude name="AvoidDuplicateLiterals" />
+  </rule>
+  <rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
+    <properties>
+      <property name="exceptionList" value="unchecked,rawtypes" />
+    </properties>
+  </rule>
+
+  <rule ref="rulesets/java/sunsecure.xml" />
+  <rule ref="rulesets/java/typeresolution.xml" />
+  <rule ref="rulesets/java/unnecessary.xml" />
+  <rule ref="rulesets/java/unusedcode.xml" />
+
+  <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor" />
+  <rule ref="rulesets/java/controversial.xml/AssignmentInOperand" />
+  <rule ref="rulesets/java/controversial.xml/DontImportSun" />
+  <rule ref="rulesets/java/controversial.xml/UnnecessaryParentheses" />
+  <rule ref="rulesets/java/controversial.xml/BooleanInversion" />
+</ruleset>

Modified: commons/proper/weaver/trunk/maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/maven-plugin/pom.xml?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/maven-plugin/pom.xml (original)
+++ commons/proper/weaver/trunk/maven-plugin/pom.xml Tue Feb 25 08:17:27 2014
@@ -127,6 +127,15 @@ under the License.
       </plugin>
       <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/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java (original)
+++ commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java Tue Feb 25 08:17:27 2014
@@ -75,8 +75,8 @@ public abstract class AbstractPrepareMoj
         getLog().debug(String.format("classpath=%s%ntarget=%s%nconfig=%s", classpath, target, config));
 
         try {
-            final CleanProcessor cp = new CleanProcessor(classpath, target, config);
-            cp.clean();
+            final CleanProcessor cleanProcessor = new CleanProcessor(classpath, target, config);
+            cleanProcessor.clean();
         } catch (Exception e) {
             throw new MojoExecutionException("cleaning failed due to " + e.getMessage(), e);
         } finally {

Modified: commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java (original)
+++ commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java Tue Feb 25 08:17:27 2014
@@ -72,8 +72,8 @@ public abstract class AbstractWeaveMojo 
         getLog().debug(String.format("classpath=%s%ntarget=%s%nconfig=%s", classpath, target, config));
 
         try {
-            final WeaveProcessor wp = new WeaveProcessor(classpath, target, config);
-            wp.weave();
+            final WeaveProcessor weaveProcessor = new WeaveProcessor(classpath, target, config);
+            weaveProcessor.weave();
         } catch (Exception e) {
             throw new MojoExecutionException("weaving failed due to " + e.getMessage(), e);
         } finally {

Modified: commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java (original)
+++ commons/proper/weaver/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java Tue Feb 25 08:17:27 2014
@@ -28,6 +28,7 @@ import java.util.logging.LogManager;
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
 
@@ -35,19 +36,20 @@ import org.apache.maven.plugin.logging.L
  * This class redirects calls to java.util Logging to Mojo logging.
  */
 public class JavaLoggingToMojoLoggingRedirector {
-    private JDKLogHandler activeHandler;
-    private List<Handler> removedHandlers = new ArrayList<Handler>();
+    private final List<Handler> removedHandlers = new ArrayList<Handler>();
 
     /**
      * The Maven mojo logger to delegate messages to.
      */
-    private Log mojoLogger;
+    private final Log mojoLogger;
+
+    private JDKLogHandler activeHandler;
 
     /**
      * @param mojoLogger
      *            the Maven mojo logger to delegate messages to.
      */
-    public JavaLoggingToMojoLoggingRedirector(Log mojoLogger) {
+    public JavaLoggingToMojoLoggingRedirector(final Log mojoLogger) {
         this.mojoLogger = mojoLogger;
     }
 
@@ -57,9 +59,9 @@ public class JavaLoggingToMojoLoggingRed
      */
     public void activate() throws MojoExecutionException {
         try {
-            Logger rootLogger = LogManager.getLogManager().getLogger("");
+            final Logger rootLogger = LogManager.getLogManager().getLogger("");
             // remove old handlers
-            for (Handler handler : rootLogger.getHandlers()) {
+            for (final Handler handler : rootLogger.getHandlers()) {
                 rootLogger.removeHandler(handler);
                 removedHandlers.add(handler);
             }
@@ -83,15 +85,15 @@ public class JavaLoggingToMojoLoggingRed
      * again.
      */
     public void deactivate() {
-        Logger rootLogger = LogManager.getLogManager().getLogger("");
+        final Logger rootLogger = LogManager.getLogManager().getLogger("");
         // remove old handlers
-        for (Handler handler : rootLogger.getHandlers()) {
+        for (final Handler handler : rootLogger.getHandlers()) {
             if (handler == activeHandler) {
                 rootLogger.removeHandler(handler);
             }
         }
 
-        for (Handler oldHandler : removedHandlers) {
+        for (final Handler oldHandler : removedHandlers) {
             rootLogger.addHandler(oldHandler);
         }
     }
@@ -99,7 +101,7 @@ public class JavaLoggingToMojoLoggingRed
     private class JDKLogHandler extends Handler {
 
         @Override
-        public void publish(LogRecord record) {
+        public void publish(final LogRecord record) {
             final Throwable exception = record.getThrown();
             final Level level = record.getLevel();
             if (level == Level.SEVERE && mojoLogger.isErrorEnabled()) {
@@ -129,17 +131,18 @@ public class JavaLoggingToMojoLoggingRed
             }
         }
 
-        private String getMessage(LogRecord record) {
-            String message = record.getMessage();
-            ResourceBundle bundle = record.getResourceBundle();
-            Object[] params = record.getParameters();
-            if (bundle != null && bundle.containsKey(message)) {
+        private String getMessage(final LogRecord record) {
+            final ResourceBundle bundle = record.getResourceBundle();
+            final Object[] params = record.getParameters();
+            final String message;
+            if (bundle != null && bundle.containsKey(record.getMessage())) {
                 // todo: cannot enforce Locale.ENGLISH here
-                message = bundle.getString(message);
+                message = bundle.getString(record.getMessage());
+            } else {
+                message = record.getMessage();
             }
-            if (params != null && params.length > 0) {
-                MessageFormat format = new MessageFormat(message);
-                message = format.format(params);
+            if (ArrayUtils.isNotEmpty(params)) {
+                return new MessageFormat(message).format(params);
             }
             return message;
         }

Modified: commons/proper/weaver/trunk/modules/normalizer/weaver/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/normalizer/weaver/pom.xml?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/normalizer/weaver/pom.xml (original)
+++ commons/proper/weaver/trunk/modules/normalizer/weaver/pom.xml Tue Feb 25 08:17:27 2014
@@ -168,6 +168,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/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java (original)
+++ commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java Tue Feb 25 08:17:27 2014
@@ -64,6 +64,8 @@ import org.objectweb.asm.commons.SimpleR
  * Handles the work of "normalizing" anonymous class definitions.
  */
 public class Normalizer {
+    private static final String INIT = "<init>";
+
     private static final Type OBJECT_TYPE = Type.getType(Object.class);
 
     /**
@@ -77,7 +79,7 @@ public class Normalizer {
         final Class<?> wrapped;
         final boolean mustRewriteConstructor;
 
-        ClassWrapper(Class<?> wrapped, boolean mustRewriteConstructor) {
+        ClassWrapper(final Class<?> wrapped, final boolean mustRewriteConstructor) {
             this.wrapped = wrapped;
             this.mustRewriteConstructor = mustRewriteConstructor;
         }
@@ -90,12 +92,12 @@ public class Normalizer {
             super(Opcodes.ASM4, new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
         }
 
-        WriteClass(ClassReader reader) {
+        WriteClass(final ClassReader reader) {
             super(Opcodes.ASM4, new ClassWriter(reader, 0));
         }
 
         @Override
-        public void visit(int version, int access, String name, String signature, String superName, String[] intrfces) {
+        public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] intrfces) {
             super.visit(version, access, name, signature, superName, intrfces);
             className = name;
         }
@@ -111,7 +113,7 @@ public class Normalizer {
             try {
                 outputStream = classfile.getOutputStream();
                 IOUtils.write(bytecode, outputStream);
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 throw new RuntimeException(e);
             } finally {
                 IOUtils.closeQuietly(outputStream);
@@ -150,7 +152,7 @@ public class Normalizer {
      * Create a new {@link Normalizer} instance.
      * @param env {@link WeaveEnvironment}
      */
-    public Normalizer(WeaveEnvironment env) {
+    public Normalizer(final WeaveEnvironment env) {
         this.env = env;
 
         this.targetPackage =
@@ -167,21 +169,23 @@ public class Normalizer {
      * @param scanner to scan with
      * @return whether any work was done
      */
-    public boolean normalize(Scanner scanner) {
+    public boolean normalize(final Scanner scanner) {
         boolean result = false;
-        for (Class<?> supertype : normalizeTypes) {
+        for (final Class<?> supertype : normalizeTypes) {
             final Set<Class<?>> subtypes = getBroadlyEligibleSubclasses(supertype, scanner);
             try {
                 final Map<Pair<String, String>, Set<ClassWrapper>> segregatedSubtypes = segregate(subtypes);
-                for (Map.Entry<Pair<String, String>, Set<ClassWrapper>> e : segregatedSubtypes.entrySet()) {
-                    final Set<ClassWrapper> likeTypes = e.getValue();
+                for (final Map.Entry<Pair<String, String>, Set<ClassWrapper>> entry : segregatedSubtypes.entrySet()) {
+                    final Set<ClassWrapper> likeTypes = entry.getValue();
                     if (likeTypes.size() > 1) {
                         result = true;
-                        rewrite(e.getKey(), likeTypes);
+                        rewrite(entry.getKey(), likeTypes);
                     }
                 }
-            } catch (Exception e) {
-                throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
+            } catch (final RuntimeException e) {
+                throw e;
+            } catch (final Exception e) {
+                throw new RuntimeException(e);
             }
         }
         return result;
@@ -192,16 +196,16 @@ public class Normalizer {
      * @param sort values
      * @return {@link Map} of enclosing classname to {@link Map} of internal name to {@link ClassWrapper}
      */
-    private Map<String, Map<String, ClassWrapper>> byEnclosingClass(Set<ClassWrapper> sort) {
+    private Map<String, Map<String, ClassWrapper>> byEnclosingClass(final Set<ClassWrapper> sort) {
         final Map<String, Map<String, ClassWrapper>> result = new HashMap<String, Map<String, ClassWrapper>>();
-        for (ClassWrapper w : sort) {
-            final String outer = w.wrapped.getEnclosingClass().getName();
-            Map<String, ClassWrapper> m = result.get(outer);
-            if (m == null) {
-                m = new LinkedHashMap<String, Normalizer.ClassWrapper>();
-                result.put(outer, m);
+        for (final ClassWrapper wrapper : sort) {
+            final String outer = wrapper.wrapped.getEnclosingClass().getName();
+            Map<String, ClassWrapper> map = result.get(outer);
+            if (map == null) {
+                map = new LinkedHashMap<String, Normalizer.ClassWrapper>();
+                result.put(outer, map);
             }
-            m.put(w.wrapped.getName().replace('.', '/'), w);
+            map.put(wrapper.wrapped.getName().replace('.', '/'), wrapper);
         }
         return result;
     }
@@ -213,18 +217,18 @@ public class Normalizer {
      * @throws IOException on I/O error
      * @throws ClassNotFoundException if class not found
      */
-    private void rewrite(Pair<String, String> key, Set<ClassWrapper> toMerge) throws IOException,
+    private void rewrite(final Pair<String, String> key, final Set<ClassWrapper> toMerge) throws IOException,
         ClassNotFoundException {
         final String target = copy(key, toMerge.iterator().next());
         env.info("Merging %s identical %s implementations with constructor %s to type %s", toMerge.size(),
             key.getLeft(), key.getRight(), target);
 
         final Map<String, Map<String, ClassWrapper>> byEnclosingClass = byEnclosingClass(toMerge);
-        for (final Map.Entry<String, Map<String, ClassWrapper>> e : byEnclosingClass.entrySet()) {
-            final String outer = e.getKey();
-            env.debug("Normalizing %s inner classes of %s", e.getValue().size(), outer);
+        for (final Map.Entry<String, Map<String, ClassWrapper>> entry : byEnclosingClass.entrySet()) {
+            final String outer = entry.getKey();
+            env.debug("Normalizing %s inner classes of %s", entry.getValue().size(), outer);
             final Map<String, String> classMap = new HashMap<String, String>();
-            for (String merged : e.getValue().keySet()) {
+            for (final String merged : entry.getValue().keySet()) {
                 classMap.put(merged, target);
             }
             final Remapper remapper = new SimpleRemapper(classMap);
@@ -234,30 +238,32 @@ public class Normalizer {
                 enclosingBytecode = env.getClassfile(outer).getInputStream();
                 final ClassReader reader = new ClassReader(enclosingBytecode);
 
-                final ClassVisitor cv = new RemappingClassAdapter(new WriteClass(reader), remapper) {
+                final ClassVisitor cv = // NOPMD
+                        new RemappingClassAdapter(new WriteClass(reader), remapper) {
 
                     @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 (!classMap.containsKey(name)) {
                             super.visitInnerClass(name, outerName, innerName, access);
                         }
                     }
 
                     @Override
-                    public MethodVisitor visitMethod(int access, String name, String desc, String signature,
-                        String[] exceptions) {
-                        final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
+                    public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature,
+                        final String[] exceptions) {
+                        final MethodVisitor mv = // NOPMD
+                                super.visitMethod(access, name, desc, signature, exceptions);
                         return new MethodVisitor(Opcodes.ASM4, mv) {
                             @Override
-                            public void visitMethodInsn(int opcode, String owner, String name, String desc) {
+                            public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
                                 String useDescriptor = desc;
-                                if ("<init>".equals(name)) {
-                                    final ClassWrapper w = e.getValue().get(owner);
-                                    if (w != null && w.mustRewriteConstructor) {
+                                if (INIT.equals(name)) {
+                                    final ClassWrapper wrapper = entry.getValue().get(owner);
+                                    if (wrapper != null && wrapper.mustRewriteConstructor) {
                                         // simply replace first argument type with OBJECT_TYPE:
                                         final Type[] args = Type.getArgumentTypes(desc);
                                         args[0] = OBJECT_TYPE;
-                                        useDescriptor = new Method("<init>", Type.VOID_TYPE, args).getDescriptor();
+                                        useDescriptor = new Method(INIT, Type.VOID_TYPE, args).getDescriptor();
                                     }
                                 }
                                 super.visitMethodInsn(opcode, owner, name, useDescriptor);
@@ -270,7 +276,7 @@ public class Normalizer {
             } finally {
                 IOUtils.closeQuietly(enclosingBytecode);
             }
-            for (String merged : e.getValue().keySet()) {
+            for (final String merged : entry.getValue().keySet()) {
                 if (env.deleteClassfile(merged)) {
                     env.debug("Deleted class %s", merged);
                 } else {
@@ -297,24 +303,23 @@ public class Normalizer {
      * @return {@link Set} of {@link Class}
      * @see #segregate(Iterable)
      */
-    private Set<Class<?>> getBroadlyEligibleSubclasses(Class<?> supertype, Scanner scanner) {
+    private Set<Class<?>> getBroadlyEligibleSubclasses(final Class<?> supertype, final Scanner scanner) {
         final ScanResult scanResult = scanner.scan(new ScanRequest().addSupertypes(supertype));
         final Set<Class<?>> result = new LinkedHashSet<Class<?>>();
-        for (WeavableClass<?> w : scanResult.getClasses()) {
-            final Class<?> subtype = w.getTarget();
-            IneligibilityReason reason = null;
+        for (final WeavableClass<?> cls : scanResult.getClasses()) {
+            final Class<?> subtype = cls.getTarget();
+            final IneligibilityReason reason;
             if (!subtype.isAnonymousClass()) {
                 reason = IneligibilityReason.NOT_ANONYMOUS;
             } else if (subtype.getDeclaredConstructors().length != 1) {
                 reason = IneligibilityReason.TOO_MANY_CONSTRUCTORS;
             } else if (subtype.getDeclaredMethods().length > 0) {
                 reason = IneligibilityReason.IMPLEMENTS_METHODS;
-            }
-            if (reason == null) {
-                result.add(subtype);
             } else {
-                env.debug("Removed %s from consideration due to %s", subtype, reason);
+                result.add(subtype);
+                continue;
             }
+            env.debug("Removed %s from consideration due to %s", subtype, reason);
         }
         return result;
     }
@@ -338,12 +343,13 @@ public class Normalizer {
      * </p>
      * @param subtypes
      * @return Map of Pair<String, String> to Set of Classes
-     * @throws Exception
+     * @throws IOException
      */
-    private Map<Pair<String, String>, Set<ClassWrapper>> segregate(Iterable<Class<?>> subtypes) throws Exception {
+    private Map<Pair<String, String>, Set<ClassWrapper>> segregate(final Iterable<Class<?>> subtypes)
+        throws IOException {
         final Map<Pair<String, String>, Set<ClassWrapper>> classMap =
             new LinkedHashMap<Pair<String, String>, Set<ClassWrapper>>();
-        for (Class<?> subtype : subtypes) {
+        for (final Class<?> subtype : subtypes) {
             final MutablePair<String, String> key = new MutablePair<String, String>();
             final MutableBoolean ignore = new MutableBoolean(false);
             final MutableBoolean valid = new MutableBoolean(true);
@@ -356,8 +362,8 @@ public class Normalizer {
                     String superName;
 
                     @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);
                         this.superName = superName;
                         final String left;
@@ -372,7 +378,7 @@ public class Normalizer {
                     }
 
                     @Override
-                    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+                    public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
                         if (Type.getType(Marker.class).getDescriptor().equals(desc)) {
                             ignore.setValue(true);
                         }
@@ -380,19 +386,23 @@ public class Normalizer {
                     }
 
                     @Override
-                    public MethodVisitor visitMethod(int access, String name, String desc, String signature,
-                        String[] exceptions) {
-                        if ("<init>".equals(name)) {
+                    public MethodVisitor visitMethod(final int access, final String name, final String desc,
+                        final String signature, final String[] exceptions) {
+                        if (INIT.equals(name)) {
                             return new MethodVisitor(Opcodes.ASM4) {
-                                public void visitMethodInsn(int opcode, String owner, String name, String desc) {
-                                    if ("<init>".equals(name) && owner.equals(superName)) {
+                                @Override
+                                public void visitMethodInsn(final int opcode, final String owner, final String name,
+                                    final String desc) {
+                                    if (INIT.equals(name) && owner.equals(superName)) {
                                         key.setRight(desc);
                                     } else {
                                         valid.setValue(false);
                                     }
                                 }
 
-                                public void visitFieldInsn(int opcode, String owner, String name, String desc) {
+                                @Override
+                                public void visitFieldInsn(final int opcode, final String owner, final String name,
+                                    final String desc) {
                                     if ("this$0".equals(name) && opcode == Opcodes.PUTFIELD) {
                                         mustRewriteConstructor.setValue(true);
                                         return;
@@ -435,12 +445,12 @@ public class Normalizer {
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    private String copy(final Pair<String, String> key, ClassWrapper classWrapper) throws IOException,
+    private String copy(final Pair<String, String> key, final ClassWrapper classWrapper) throws IOException,
         ClassNotFoundException {
         final MessageDigest md5;
         try {
             md5 = MessageDigest.getInstance("MD5");
-        } catch (NoSuchAlgorithmException e) {
+        } catch (final NoSuchAlgorithmException e) {
             throw new RuntimeException(e);
         }
         md5.update(key.getLeft().getBytes(UTF8));
@@ -458,7 +468,7 @@ public class Normalizer {
             bytecode = env.getClassfile(classWrapper.wrapped).getInputStream();
             final ClassReader reader = new ClassReader(bytecode);
 
-            final ClassVisitor w = new WriteClass();
+            final ClassVisitor writeClass = new WriteClass();
 
             // we're doing most of this by hand; we only read the original class to hijack signature, ctor exceptions,
             // etc.:
@@ -467,34 +477,34 @@ public class Normalizer {
                 Type supertype;
 
                 @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) {
                     supertype = Type.getObjectType(superName);
-                    w.visit(version, Opcodes.ACC_PUBLIC, result, signature, superName, interfaces);
+                    writeClass.visit(version, Opcodes.ACC_PUBLIC, result, signature, superName, interfaces);
 
                     visitAnnotation(Type.getType(Marker.class).getDescriptor(), false);
                 }
 
                 @Override
-                public MethodVisitor visitMethod(int access, String name, String desc, String signature,
-                    String[] exceptions) {
-                    if ("<init>".equals(name)) {
+                public MethodVisitor visitMethod(final int access, final String name, final String desc,
+                    final String signature, final String[] exceptions) {
+                    if (INIT.equals(name)) {
 
-                        final Method staticCtor = new Method("<init>", key.getRight());
+                        final Method staticCtor = new Method(INIT, key.getRight());
                         final Type[] argumentTypes = staticCtor.getArgumentTypes();
                         final Type[] exceptionTypes = toObjectTypes(exceptions);
 
                         {
-                            final GeneratorAdapter mg =
-                                new GeneratorAdapter(Opcodes.ACC_PUBLIC, staticCtor, signature, exceptionTypes, w);
-                            mg.visitCode();
-                            mg.loadThis();
+                            final GeneratorAdapter mgen =
+                                new GeneratorAdapter(Opcodes.ACC_PUBLIC, staticCtor, signature, exceptionTypes, writeClass);
+                            mgen.visitCode();
+                            mgen.loadThis();
                             for (int i = 0; i < argumentTypes.length; i++) {
-                                mg.loadArg(i);
+                                mgen.loadArg(i);
                             }
-                            mg.invokeConstructor(supertype, staticCtor);
-                            mg.returnValue();
-                            mg.endMethod();
+                            mgen.invokeConstructor(supertype, staticCtor);
+                            mgen.returnValue();
+                            mgen.endMethod();
                         }
                         /*
                          * now declare a dummy constructor that will match, and discard,
@@ -504,17 +514,17 @@ public class Normalizer {
                          */
                         {
                             final Method instanceCtor =
-                                new Method("<init>", Type.VOID_TYPE, ArrayUtils.add(argumentTypes, 0, OBJECT_TYPE));
-                            final GeneratorAdapter mg =
-                                new GeneratorAdapter(Opcodes.ACC_PUBLIC, instanceCtor, signature, exceptionTypes, w);
-                            mg.visitCode();
-                            mg.loadThis();
+                                new Method(INIT, Type.VOID_TYPE, ArrayUtils.add(argumentTypes, 0, OBJECT_TYPE));
+                            final GeneratorAdapter mgen =
+                                new GeneratorAdapter(Opcodes.ACC_PUBLIC, instanceCtor, signature, exceptionTypes, writeClass);
+                            mgen.visitCode();
+                            mgen.loadThis();
                             for (int i = 0; i < argumentTypes.length; i++) {
-                                mg.loadArg(i + 1);
+                                mgen.loadArg(i + 1);
                             }
-                            mg.invokeConstructor(supertype, staticCtor);
-                            mg.returnValue();
-                            mg.endMethod();
+                            mgen.invokeConstructor(supertype, staticCtor);
+                            mgen.returnValue();
+                            mgen.endMethod();
                         }
                         return null;
                     }
@@ -523,7 +533,7 @@ public class Normalizer {
 
                 @Override
                 public void visitEnd() {
-                    w.visitEnd();
+                    writeClass.visitEnd();
                 }
             }, 0);
         } finally {
@@ -538,7 +548,7 @@ public class Normalizer {
      * @return {@link Type}[]
      * @see Type#getObjectType(String)
      */
-    private static Type[] toObjectTypes(String[] types) {
+    private static Type[] toObjectTypes(final String[] types) {
         if (types == null) {
             return null;
         }

Modified: commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java (original)
+++ commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java Tue Feb 25 08:17:27 2014
@@ -32,7 +32,7 @@ public class NormalizerWeaver implements
      * {@inheritDoc}
      */
     @Override
-    public boolean process(WeaveEnvironment environment, Scanner scanner) {
+    public boolean process(final WeaveEnvironment environment, final Scanner scanner) {
         return new Normalizer(environment).normalize(scanner);
     }
 

Modified: commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java (original)
+++ commons/proper/weaver/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java Tue Feb 25 08:17:27 2014
@@ -37,7 +37,7 @@ final class Utils {
      *         {@code '.'} with {@code '/'} and removed any terminating separator
      * @throws IllegalArgumentException if invalid
      */
-    static String validatePackageName(String pkg) {
+    static String validatePackageName(final String pkg) {
         if (StringUtils.isBlank(pkg)) {
             return "";
         }
@@ -47,17 +47,17 @@ final class Utils {
 
         boolean next = true;
         for (int pos = 0; pos < result.length(); pos++) {
-            final char c = result.charAt(pos);
+            final char chr = result.charAt(pos);
             if (next) {
                 next = false;
-                Validate.isTrue(Character.isJavaIdentifierStart(c), unexpected, c, pos, result);
+                Validate.isTrue(Character.isJavaIdentifierStart(chr), unexpected, chr, pos, result);
                 continue;
             }
-            if (c == '/' || c == '.') {
+            if (chr == '/' || chr == '.') {
                 next = true;
                 continue;
             }
-            Validate.isTrue(Character.isJavaIdentifierPart(c), unexpected, c, pos, result);
+            Validate.isTrue(Character.isJavaIdentifierPart(chr), unexpected, chr, pos, result);
         }
 
         result = result.replace('.', '/');
@@ -73,15 +73,15 @@ final class Utils {
      * {@link String} of fully-qualified or internal names (i.e., slashes are
      * legal).
      * @param types to parse
-     * @param cl {@link ClassLoader} to search
+     * @param classLoader {@link ClassLoader} to search
      * @return {@link Set} of {@link Class}
      */
-    static Set<Class<?>> parseTypes(String types, ClassLoader cl) {
+    static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) {
         final Set<Class<?>> result = new LinkedHashSet<Class<?>>();
-        for (String s : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) {
+        for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) {
             try {
-                result.add(ClassUtils.getClass(cl, s.trim().replace('/', '.')));
-            } catch (ClassNotFoundException e) {
+                result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.')));
+            } catch (final ClassNotFoundException e) {
                 throw new IllegalArgumentException(e);
             }
         }

Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/pom.xml?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/pom.xml (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/pom.xml Tue Feb 25 08:17:27 2014
@@ -197,6 +197,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/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java Tue Feb 25 08:17:27 2014
@@ -52,7 +52,7 @@ public enum AccessLevel {
 
     private final int flag;
 
-    private AccessLevel(int flag) {
+    private AccessLevel(final int flag) {
         this.flag = flag;
     }
 
@@ -62,7 +62,7 @@ public enum AccessLevel {
      * @return {@link AccessLevel}
      * @throws IllegalArgumentException if multiple access modifiers specified
      */
-    public static AccessLevel of(int mod) {
+    public static AccessLevel of(final int mod) {
         final Set<AccessLevel> matched = EnumSet.noneOf(AccessLevel.class);
         if (Modifier.isPublic(mod)) {
             matched.add(PUBLIC);
@@ -85,9 +85,9 @@ public enum AccessLevel {
      * @param mod input
      * @return {@code mod}, with this {@link AccessLevel}
      */
-    public int merge(int mod) {
+    public int merge(final int mod) {
         int remove = 0;
-        for (AccessLevel accessLevel : EnumSet.complementOf(EnumSet.of(this))) {
+        for (final AccessLevel accessLevel : EnumSet.complementOf(EnumSet.of(this))) {
             remove |= accessLevel.flag;
         }
         return mod & ~remove | flag;
@@ -114,13 +114,13 @@ public enum AccessLevel {
 
     /**
      * Parse from a {@link String} returning {@link #defaultValue()} for blank/null input.
-     * @param s to parse
+     * @param str to parse
      * @return {@link AccessLevel}
      */
-    public static AccessLevel parse(String s) {
-        if (StringUtils.isBlank(s)) {
+    public static AccessLevel 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/ActionGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java Tue Feb 25 08:17:27 2014
@@ -41,7 +41,7 @@ import org.objectweb.asm.signature.Signa
  */
 class ActionGenerator extends Privilizer.WriteClass implements Builder<Type> {
     final PrivilizingVisitor owner;
-    final Method m;
+    final Method methd;
     final boolean exc;
     final Type[] exceptions;
     final String simpleName;
@@ -57,25 +57,25 @@ class ActionGenerator extends Privilizer
     /**
      * Create a new {@link ActionGenerator}.
      * @param access modifier
-     * @param m {@link Method} to implement
+     * @param methd {@link Method} to implement
      * @param exceptions thrown
      * @param owner of the action class
      */
-    ActionGenerator(final int access, final Method m, final String[] exceptions, PrivilizingVisitor owner) {
+    ActionGenerator(final int access, final Method methd, final String[] exceptions, final PrivilizingVisitor owner) {
         owner.privilizer().super(new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES));
-        this.m = m;
+        this.methd = methd;
         this.exc = ArrayUtils.isNotEmpty(exceptions);
         this.exceptions = exc ? new Type[] { Type.getType(Exception.class) } : null;
         this.owner = owner;
-        this.simpleName = generateName(m);
+        this.simpleName = generateName(methd);
         this.action = Type.getObjectType(owner.className + '$' + simpleName);
 
         int privilegedAccessIndex = -1;
         String implName = null;
-        for (Map.Entry<Method, String> e : owner.privilegedMethods.entrySet()) {
+        for (final Map.Entry<Method, String> entry : owner.privilegedMethods.entrySet()) {
             privilegedAccessIndex++;
-            if (e.getKey().equals(m)) {
-                implName = e.getValue();
+            if (entry.getKey().equals(methd)) {
+                implName = entry.getValue();
                 break;
             }
         }
@@ -83,27 +83,27 @@ class ActionGenerator extends Privilizer
 
         this.index = privilegedAccessIndex;
 
-        this.impl = new Method(implName, m.getDescriptor());
+        this.impl = new Method(implName, methd.getDescriptor());
         this.implIsStatic = Modifier.isStatic(access);
-        final Type[] args = implIsStatic ? m.getArgumentTypes() : ArrayUtils.add(m.getArgumentTypes(), 0, owner.target);
-        this.helper = new Method(privilizer().generateName("access$" + index), m.getReturnType(), args);
-        this.result = privilizer().wrap(m.getReturnType());
+        final Type[] args = implIsStatic ? methd.getArgumentTypes() : ArrayUtils.add(methd.getArgumentTypes(), 0, owner.target);
+        this.helper = new Method(privilizer().generateName("access$" + index), methd.getReturnType(), args);
+        this.result = privilizer().wrap(methd.getReturnType());
         this.fields = fields(args);
         this.actionInterface = Type.getType(exc ? PrivilegedExceptionAction.class : PrivilegedAction.class);
     }
 
-    private static String generateName(Method m) {
-        final StringBuilder b = new StringBuilder(m.getName());
-        if (m.getArgumentTypes().length > 0) {
-            b.append("$$");
-            for (Type arg : m.getArgumentTypes()) {
-                b.append(arg.getDescriptor().replace("[", "arrayOf").replace('/', '_').replace(';', '$'));
+    private static String generateName(final Method methd) {
+        final StringBuilder buf = new StringBuilder(methd.getName());
+        if (methd.getArgumentTypes().length > 0) {
+            buf.append("$$");
+            for (final Type arg : methd.getArgumentTypes()) {
+                buf.append(arg.getDescriptor().replace("[", "arrayOf").replace('/', '_').replace(';', '$'));
             }
         }
-        return b.append("_ACTION").toString();
+        return buf.append("_ACTION").toString();
     }
 
-    private static Field[] fields(Type[] args) {
+    private static Field[] fields(final Type[] args) {
         final Field[] result = new Field[args.length];
 
         for (int i = 0; i < args.length; i++) {
@@ -133,18 +133,18 @@ class ActionGenerator extends Privilizer
     private void generateHelper() {
         owner.privilizer().env.debug("Generating static helper method %s.%s to call %s", owner.target.getClassName(),
             helper, impl);
-        final GeneratorAdapter mg =
+        final GeneratorAdapter mgen =
             new GeneratorAdapter(Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, helper, null, exceptions, owner);
 
-        mg.visitCode();
-        mg.loadArgs();
+        mgen.visitCode();
+        mgen.loadArgs();
         if (implIsStatic) {
-            mg.invokeStatic(owner.target, impl);
+            mgen.invokeStatic(owner.target, impl);
         } else {
-            mg.invokeVirtual(owner.target, impl);
+            mgen.invokeVirtual(owner.target, impl);
         }
-        mg.returnValue();
-        mg.endMethod();
+        mgen.returnValue();
+        mgen.endMethod();
     }
 
     private void begin() {
@@ -155,7 +155,7 @@ class ActionGenerator extends Privilizer
         final SignatureVisitor actionImplemented = type.visitInterface();
         actionImplemented.visitClassType(actionInterface.getInternalName());
         final SignatureVisitor visitTypeArgument = actionImplemented.visitTypeArgument('=');
-        final SignatureReader result = new SignatureReader(privilizer().wrap(m.getReturnType()).getDescriptor());
+        final SignatureReader result = new SignatureReader(privilizer().wrap(methd.getReturnType()).getDescriptor());
         result.accept(visitTypeArgument);
         actionImplemented.visitEnd();
 
@@ -170,39 +170,39 @@ class ActionGenerator extends Privilizer
      * Add fields and generate constructor.
      */
     private void init() {
-        for (Field field : fields) {
+        for (final Field field : fields) {
             visitField(field.access, field.name, field.type.getDescriptor(), null, null).visitEnd();
         }
         final Method init = new Method("<init>", Type.VOID_TYPE, helper.getArgumentTypes());
 
-        final GeneratorAdapter mg =
+        final GeneratorAdapter mgen =
             new GeneratorAdapter(0, init, null, Privilizer.EMPTY_TYPE_ARRAY, this);
 
-        mg.visitCode();
-        final Label begin = mg.mark();
+        mgen.visitCode();
+        final Label begin = mgen.mark();
 
         // invoke super constructor
-        mg.loadThis();
-        mg.invokeConstructor(Type.getType(Object.class), Method.getMethod("void <init> ()"));
+        mgen.loadThis();
+        mgen.invokeConstructor(Type.getType(Object.class), Method.getMethod("void <init> ()"));
         // assign remaining fields
 
         int arg = 0;
-        for (Field field : fields) {
-            mg.loadThis();
-            mg.loadArg(arg++);
-            mg.putField(action, field.name, field.type);
+        for (final Field field : fields) {
+            mgen.loadThis();
+            mgen.loadArg(arg++);
+            mgen.putField(action, field.name, field.type);
         }
 
-        mg.returnValue();
-        final Label end = mg.mark();
+        mgen.returnValue();
+        final Label end = mgen.mark();
 
         // declare local vars
-        mg.visitLocalVariable("this", action.getDescriptor(), null, begin, end, 0);
+        mgen.visitLocalVariable("this", action.getDescriptor(), null, begin, end, 0);
         arg = 1;
-        for (Field field : fields) {
-            mg.visitLocalVariable("arg" + arg, field.type.getDescriptor(), null, begin, end, arg++);
+        for (final Field field : fields) {
+            mgen.visitLocalVariable("arg" + arg, field.type.getDescriptor(), null, begin, end, arg++);
         }
-        mg.endMethod();
+        mgen.endMethod();
     }
 
     /**
@@ -211,22 +211,22 @@ class ActionGenerator extends Privilizer
     private void impl() {
         final Method run = Method.getMethod("Object run()");
 
-        final GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, run, null, exceptions, this);
+        final GeneratorAdapter mgen = new GeneratorAdapter(Opcodes.ACC_PUBLIC, run, null, exceptions, this);
 
-        for (Field field : fields) {
-            mg.loadThis();
-            mg.getField(action, field.name, field.type);
+        for (final Field field : fields) {
+            mgen.loadThis();
+            mgen.getField(action, field.name, field.type);
         }
 
-        mg.invokeStatic(owner.target, helper);
+        mgen.invokeStatic(owner.target, helper);
 
-        if (m.getReturnType().getSort() < Type.ARRAY) {
-            mg.valueOf(m.getReturnType());
+        if (methd.getReturnType().getSort() < Type.ARRAY) {
+            mgen.valueOf(methd.getReturnType());
         }
 
-        mg.returnValue();
+        mgen.returnValue();
 
-        mg.endMethod();
+        mgen.endMethod();
     }
 
 }

Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java Tue Feb 25 08:17:27 2014
@@ -70,28 +70,30 @@ class BlueprintingVisitor extends Privil
      * @param cv wrapped
      * @param config annotation
      */
-    BlueprintingVisitor(Privilizer privilizer, ClassVisitor cv, Privilizing config) {
+    BlueprintingVisitor(final Privilizer privilizer,
+        final ClassVisitor cv, //NOPMD
+        final Privilizing config) {
         privilizer.super(new ClassNode(Opcodes.ASM4));
         this.next = cv;
 
         // load up blueprint methods:
-        for (Privilizing.CallTo callTo : config.value()) {
+        for (final Privilizing.CallTo callTo : config.value()) {
             final Type blueprintType = Type.getType(callTo.value());
             blueprintTypes.add(blueprintType);
-            for (Map.Entry<Method, MethodNode> e : getMethods(blueprintType).entrySet()) {
+            for (final Map.Entry<Method, MethodNode> entry : getMethods(blueprintType).entrySet()) {
                 boolean found = false;
                 if (callTo.methods().length == 0) {
                     found = true;
                 } else {
-                    for (String name : callTo.methods()) {
-                        if (e.getKey().getName().equals(name)) {
+                    for (final String name : callTo.methods()) {
+                        if (entry.getKey().getName().equals(name)) {
                             found = true;
                             break;
                         }
                     }
                 }
                 if (found) {
-                    blueprintRegistry.put(Pair.of(blueprintType, e.getKey()), e.getValue());
+                    blueprintRegistry.put(Pair.of(blueprintType, entry.getKey()), entry.getValue());
                 }
             }
         }
@@ -107,7 +109,7 @@ class BlueprintingVisitor extends Privil
         @SuppressWarnings("unchecked")
         final List<MethodNode> methods = classNode.methods;
 
-        for (MethodNode methodNode : methods) {
+        for (final MethodNode methodNode : methods) {
             if (Modifier.isStatic(methodNode.access) && !"<clinit>".equals(methodNode.name)) {
                 result.put(new Method(methodNode.name, methodNode.desc), methodNode);
             }
@@ -116,13 +118,13 @@ class BlueprintingVisitor extends Privil
         return result;
     }
 
-    private ClassNode read(String className) {
+    private ClassNode read(final String className) {
         final ClassNode result = new ClassNode(Opcodes.ASM4);
         InputStream bytecode = null;
         try {
             bytecode = privilizer().env.getClassfile(className).getInputStream();
             new ClassReader(bytecode).accept(result, ClassReader.SKIP_DEBUG | ClassReader.EXPAND_FRAMES);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new RuntimeException(e);
         } finally {
             IOUtils.closeQuietly(bytecode);
@@ -131,24 +133,26 @@ class BlueprintingVisitor extends Privil
     }
 
     @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) {
         Validate.isTrue(!blueprintTypes.contains(Type.getObjectType(name)),
             "Class %s cannot declare itself as a blueprint!", name);
         super.visit(version, access, name, signature, superName, interfaces);
     }
 
     @Override
-    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
-        final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
-        return new MethodInvocationHandler(mv) {
+    public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature,
+        final String[] exceptions) {
+        final MethodVisitor toWrap = super.visitMethod(access, name, desc, signature, exceptions);
+        return new MethodInvocationHandler(toWrap) {
             @Override
-            boolean shouldImport(Pair<Type, Method> methodKey) {
+            boolean shouldImport(final Pair<Type, Method> methodKey) {
                 return blueprintRegistry.containsKey(methodKey);
             }
         };
     }
 
-    private String importMethod(Pair<Type, Method> key) {
+    private String importMethod(final Pair<Type, Method> key) {
         if (importedMethods.containsKey(key)) {
             return importedMethods.get(key);
         }
@@ -169,8 +173,8 @@ class BlueprintingVisitor extends Privil
 
         source.accept(new MethodVisitor(Opcodes.ASM4) {
             @Override
-            public void visitFieldInsn(int opcode, String owner, String name, String desc) {
-                final FieldAccess fieldAccess = fieldAccess(Type.getObjectType(owner), name, Type.getType(desc));
+            public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) {
+                final FieldAccess fieldAccess = fieldAccess(Type.getObjectType(owner), name);
 
                 super.visitFieldInsn(opcode, owner, name, desc);
                 if (!Modifier.isPublic(fieldAccess.access)) {
@@ -183,7 +187,7 @@ class BlueprintingVisitor extends Privil
             new MethodNode(access, result, source.desc, source.signature, exceptions);
 
         // spider own methods:
-        MethodVisitor mv = new NestedMethodInvocationHandler(withAccessibleAdvice, key.getLeft());
+        MethodVisitor mv = new NestedMethodInvocationHandler(withAccessibleAdvice, key.getLeft()); //NOPMD
 
         if (!fieldAccesses.isEmpty()) {
             // accessesNonPublicFields = true;
@@ -192,9 +196,8 @@ class BlueprintingVisitor extends Privil
 
         source.accept(mv);
 
-        if (Modifier.isPrivate(source.access)) {
-            // can only be called by other privileged methods, so no need to mark as privileged
-        } else {
+        // private can only be called by other privileged methods, so no need to mark as privileged
+        if (!Modifier.isPrivate(source.access)) {
             withAccessibleAdvice.visitAnnotation(Type.getType(Privileged.class).getDescriptor(), false).visitEnd();
         }
 
@@ -203,7 +206,7 @@ class BlueprintingVisitor extends Privil
         return result;
     }
 
-    private FieldAccess fieldAccess(final Type owner, String name, Type desc) {
+    private FieldAccess fieldAccess(final Type owner, final String name) {
         final Pair<Type, String> key = Pair.of(owner, name);
         if (!fieldAccessMap.containsKey(key)) {
             try {
@@ -216,20 +219,20 @@ class BlueprintingVisitor extends Privil
                         bytecode = privilizer().env.getClassfile(next.getValue().getInternalName()).getInputStream();
                         new ClassReader(bytecode).accept(privilizer().new PrivilizerClassVisitor() {
                             @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);
                                 next.setValue(Type.getObjectType(superName));
                             }
 
                             @Override
-                            public FieldVisitor visitField(int access, String name, String desc, String signature,
-                                Object value) {
-                                for (Type type : stk) {
-                                    final Pair<Type, String> k = Pair.of(type, name);
+                            public FieldVisitor visitField(final int access, final String name, final String desc,
+                                final String signature, final Object value) {
+                                for (final Type type : stk) {
+                                    final Pair<Type, String> key = Pair.of(type, name);
                                     // skip shadowed fields:
-                                    if (!fieldAccessMap.containsKey(k)) {
-                                        fieldAccessMap.put(k,
+                                    if (!fieldAccessMap.containsKey(key)) {
+                                        fieldAccessMap.put(key,
                                             new FieldAccess(access, target, name, Type.getType(desc)));
                                     }
                                 }
@@ -243,7 +246,7 @@ class BlueprintingVisitor extends Privil
                         break;
                     }
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new RuntimeException(e);
             }
             Validate.isTrue(fieldAccessMap.containsKey(key), "Could not locate %s.%s", owner.getClassName(), name);
@@ -258,15 +261,15 @@ class BlueprintingVisitor extends Privil
     }
 
     private abstract class MethodInvocationHandler extends MethodVisitor {
-        MethodInvocationHandler(MethodVisitor mv) {
-            super(Opcodes.ASM4, mv);
+        MethodInvocationHandler(final MethodVisitor mvr) {
+            super(Opcodes.ASM4, mvr);
         }
 
         @Override
-        public void visitMethodInsn(int opcode, String owner, String name, String desc) {
+        public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
             if (opcode == Opcodes.INVOKESTATIC) {
-                final Method m = new Method(name, desc);
-                final Pair<Type, Method> methodKey = Pair.of(Type.getObjectType(owner), m);
+                final Method methd = new Method(name, desc);
+                final Pair<Type, Method> methodKey = Pair.of(Type.getObjectType(owner), methd);
                 if (shouldImport(methodKey)) {
                     final String importedName = importMethod(methodKey);
                     super.visitMethodInsn(opcode, className, importedName, desc);
@@ -282,13 +285,13 @@ class BlueprintingVisitor extends Privil
     class NestedMethodInvocationHandler extends MethodInvocationHandler {
         final Type owner;
 
-        NestedMethodInvocationHandler(MethodVisitor mv, Type owner) {
-            super(mv);
+        NestedMethodInvocationHandler(final MethodVisitor mvr, final Type owner) {
+            super(mvr);
             this.owner = owner;
         }
 
         @Override
-        boolean shouldImport(Pair<Type, Method> methodKey) {
+        boolean shouldImport(final Pair<Type, Method> methodKey) {
             // call anything called within a class hierarchy:
             final Type called = methodKey.getLeft();
             // "I prefer the short cut":
@@ -299,13 +302,13 @@ class BlueprintingVisitor extends Privil
                 final Class<?> inner = load(called);
                 final Class<?> outer = load(owner);
                 return inner.isAssignableFrom(outer);
-            } catch (ClassNotFoundException e) {
+            } catch (final ClassNotFoundException e) {
                 return false;
             }
         }
 
-        private Class<?> load(Type t) throws ClassNotFoundException {
-            return privilizer().env.classLoader.loadClass(t.getClassName());
+        private Class<?> load(final Type type) throws ClassNotFoundException {
+            return privilizer().env.classLoader.loadClass(type.getClassName());
         }
     }
 
@@ -326,8 +329,9 @@ class BlueprintingVisitor extends Privil
         int bitSet;
         int fieldCounter;
 
-        AccessibleAdvisor(MethodVisitor mv, int access, String name, String desc, List<FieldAccess> fieldAccesses) {
-            super(ASM4, mv, access, name, desc);
+        AccessibleAdvisor(final MethodVisitor mvr, final int access, final String name, final String desc,
+            final List<FieldAccess> fieldAccesses) {
+            super(ASM4, mvr, access, name, desc);
             this.fieldAccesses = fieldAccesses;
         }
 
@@ -352,14 +356,14 @@ class BlueprintingVisitor extends Privil
             // populate localFieldArray
             push(0);
             storeLocal(fieldCounter);
-            for (FieldAccess access : fieldAccesses) {
+            for (final FieldAccess access : fieldAccesses) {
                 prehandle(access);
                 iinc(fieldCounter, 1);
             }
             mark(begin);
         }
 
-        private void prehandle(FieldAccess access) {
+        private void prehandle(final FieldAccess access) {
             // push owner.class literal
             visitLdcInsn(access.owner);
             push(access.name);
@@ -397,7 +401,7 @@ class BlueprintingVisitor extends Privil
         }
 
         @Override
-        public void visitFieldInsn(int opcode, String owner, String name, String desc) {
+        public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) {
             final Pair<Type, String> key = Pair.of(Type.getObjectType(owner), name);
             final FieldAccess fieldAccess = fieldAccessMap.get(key);
             Validate.isTrue(fieldAccesses.contains(fieldAccess), "Cannot find field %s", key);
@@ -437,19 +441,19 @@ class BlueprintingVisitor extends Privil
         }
 
         @Override
-        public void visitMaxs(int maxStack, int maxLocals) {
+        public void visitMaxs(final int maxStack, final int maxLocals) {
             // put try-finally around the whole method
-            final Label fy = mark();
+            final Label fny = mark();
             // null exception type signifies finally block:
             final Type exceptionType = null;
-            catchException(begin, fy, exceptionType);
+            catchException(begin, fny, exceptionType);
             onFinally();
             throwException();
             super.visitMaxs(maxStack, maxLocals);
         }
 
         @Override
-        protected void onMethodExit(int opcode) {
+        protected void onMethodExit(final int opcode) {
             if (opcode != ATHROW) {
                 onFinally();
             }

Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java Tue Feb 25 08:17:27 2014
@@ -48,7 +48,7 @@ public class Field {
      * @param name of field
      * @param type of field
      */
-    public Field(int access, String name, Type type) {
+    public Field(final int access, final String name, final Type type) {
         super();
         this.access = access;
         this.name = Validate.notNull(name);
@@ -60,8 +60,9 @@ public class Field {
      * @param obj to check for equality
      * @return whether equal
      */
+    @SuppressWarnings("deprecation")
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (obj == this) {
             return true;
         }

Modified: commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java
URL: http://svn.apache.org/viewvc/commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java?rev=1571611&r1=1571610&r2=1571611&view=diff
==============================================================================
--- commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java (original)
+++ commons/proper/weaver/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java Tue Feb 25 08:17:27 2014
@@ -37,7 +37,7 @@ public class FieldAccess extends Field {
      * @param name of field
      * @param type of field
      */
-    public FieldAccess(int access, Type owner, String name, Type type) {
+    public FieldAccess(final int access, final Type owner, final String name, final Type type) {
         super(access, name, type);
         this.owner = owner;
     }
@@ -48,7 +48,7 @@ public class FieldAccess extends Field {
      * @return whether Objects are equal
      */
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (obj == this) {
             return true;
         }



Mime
View raw message