harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r820236 - in /harmony/enhanced/classlib/trunk: build.xml depends/oss/ make/build-test.xml make/depends.properties make/depends.xml make/properties.xml modules/luni/build.xml modules/luni/make/findbugs-exclude-filter.xml
Date Wed, 30 Sep 2009 10:40:04 GMT
Author: tellison
Date: Wed Sep 30 10:40:03 2009
New Revision: 820236

URL: http://svn.apache.org/viewvc?rev=820236&view=rev
Log:
Create a top-level "findbugs" target for modules, to run the UMD FindBugs static analysis
tool.
Currently only extended to the LUNI module until the approach is validated.

Added:
    harmony/enhanced/classlib/trunk/modules/luni/make/findbugs-exclude-filter.xml   (with
props)
Modified:
    harmony/enhanced/classlib/trunk/build.xml
    harmony/enhanced/classlib/trunk/depends/oss/   (props changed)
    harmony/enhanced/classlib/trunk/make/build-test.xml
    harmony/enhanced/classlib/trunk/make/depends.properties
    harmony/enhanced/classlib/trunk/make/depends.xml
    harmony/enhanced/classlib/trunk/make/properties.xml
    harmony/enhanced/classlib/trunk/modules/luni/build.xml

Modified: harmony/enhanced/classlib/trunk/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/build.xml?rev=820236&r1=820235&r2=820236&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/build.xml (original)
+++ harmony/enhanced/classlib/trunk/build.xml Wed Sep 30 10:40:03 2009
@@ -191,6 +191,16 @@
         <ant antfile="make/build-test.xml" inheritall="false" target="test-jar-modules"/>
     </target>
 
+    <target name="findbugs" depends="-init-hdk"
+            description="Runs FindBugs on all modules">
+        <echo>
+========================================
+Finding bugs in all class libraries...
+========================================
+</echo>
+        <ant antfile="make/build-test.xml" inheritall="false" target="findbugs"/>
+    </target>
+
     <!-- ================================= 
           target: doc             
          ================================= -->

Propchange: harmony/enhanced/classlib/trunk/depends/oss/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep 30 10:40:03 2009
@@ -0,0 +1 @@
+findbugs-1.3.9

Modified: harmony/enhanced/classlib/trunk/make/build-test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/build-test.xml?rev=820236&r1=820235&r2=820236&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/make/build-test.xml (original)
+++ harmony/enhanced/classlib/trunk/make/build-test.xml Wed Sep 30 10:40:03 2009
@@ -54,6 +54,10 @@
         <poll-modules target="-test-module" />
     </target>
 
+    <target name="findbugs">
+        <poll-modules target="findbugs" />
+    </target>
+
     <target name="test-jar-init">
         <copy file="${basedir}/make/test.properties" tofile="${hy.hdk}/build/test/test.properties"/>
         <copy file="${basedir}/make/run-test.xml" tofile="${hy.hdk}/build/test/build.xml"/>

Modified: harmony/enhanced/classlib/trunk/make/depends.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/depends.properties?rev=820236&r1=820235&r2=820236&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/make/depends.properties (original)
+++ harmony/enhanced/classlib/trunk/make/depends.properties Wed Sep 30 10:40:03 2009
@@ -38,6 +38,11 @@
 hamcrest-library.url=${maven2.base}/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar
 hamcrest-library.md5=271f78edc4333f0f44df617676e0a874
 
+findbugs.dir=${depends.dir}/oss/findbugs-1.3.9
+findbugs.zip=${findbugs.dir}/findbugs-1.3.9.zip
+findbugs.url=http://downloads.sourceforge.net/project/findbugs/findbugs/1.3.9/findbugs-1.3.9.zip
+findbugs.md5=73702d533a505bd98d0c2c585a29a08b
+
 msvcr.dir=${depends.dir}/libs/${hy.platform}
 msvcp.dir=${depends.dir}/libs/${hy.platform}
 

Modified: harmony/enhanced/classlib/trunk/make/depends.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/depends.xml?rev=820236&r1=820235&r2=820236&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/make/depends.xml (original)
+++ harmony/enhanced/classlib/trunk/make/depends.xml Wed Sep 30 10:40:03 2009
@@ -38,6 +38,7 @@
         <check-one-file src="${xerces.url}" dest="${xerces.zip}" />
         <check-one-file src="${junit.url}" dest="${junit.jar}" />
         <check-one-file src="${hamcrest-library.url}" dest="${hamcrest-library.jar}" />
+        <check-one-file src="${findbugs.url}" dest="${findbugs.zip}" />
         <check-one-file src="${bcprov.url}" dest="${bcprov.jar}" />
         <check-one-file src="${jetty.url}" dest="${jetty.jar}" />
         <check-one-file src="${jetty-util.url}" dest="${jetty-util.jar}" />
@@ -54,7 +55,7 @@
     </target>
 
     <target name="-extract"
-         depends="-extract-props,-extract-xerces,-fix-xalan-manifest" />
+         depends="-extract-props,-extract-xerces,-fix-xalan-manifest,-extract-findbugs" />
 
     <target name="-extract-props">
         <uptodate property="xerces.uptodate"
@@ -63,6 +64,9 @@
         <uptodate property="xalan.uptodate"
                   srcfile="${xalan.orig.jar}"
                   targetfile="${xalan.jar}" />
+        <uptodate property="findbugs.uptodate"
+                  srcfile="${findbugs.zip}"
+                  targetfile="${findbugs.dir}/uptodate" />
     </target>
 
     <target name="-extract-xerces" unless="xerces.uptodate">
@@ -89,6 +93,12 @@
         <delete dir="${xalan.dir}.tmp" />
     </target>
 
+    <target name="-extract-findbugs" unless="findbugs.uptodate">
+        <!-- Note that FindBugs contains a top level dir name -->
+        <unzip src="${findbugs.zip}" dest="${findbugs.dir}/.." />
+        <touch file="${findbugs.dir}/uptodate" />
+    </target>
+
     <target name="download" description="Download required jars"
             depends="-download,-download-win" />
 
@@ -111,6 +121,11 @@
                            dest="${hamcrest-library.jar}"
                            md5="${hamcrest-library.md5}" />
 
+        <mkdir dir="${findbugs.dir}" />
+        <download-one-file src="${findbugs.url}"
+                           dest="${findbugs.zip}"
+                           md5="${findbugs.md5}" />
+
         <mkdir dir="${bcprov.dir}" />
         <download-one-file src="${bcprov.url}" dest="${bcprov.jar}"
                            md5="${bcprov.md5}" />

Modified: harmony/enhanced/classlib/trunk/make/properties.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/properties.xml?rev=820236&r1=820235&r2=820236&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/make/properties.xml (original)
+++ harmony/enhanced/classlib/trunk/make/properties.xml Wed Sep 30 10:40:03 2009
@@ -64,6 +64,18 @@
     <property name="hy.test.timeout" value="900000" />
     <property name="hy.test.vmargs" value="" />
 
+    <!-- FindBugs properties -->
+    <property name="findbugs.home" location="${basedir}/../../depends/oss/findbugs-1.3.9"/>
+    <available
+       classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+       classpath="${findbugs.home}/lib/findbugs-ant.jar"
+       property="findbugs.available"/>
+    <taskdef
+       name="findbugs"
+       classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+       classpath="${findbugs.home}/lib/findbugs-ant.jar"
+       onerror="ignore"/>
+
     <!-- Conditions for operating systems -->
     <condition property="is.windows">
         <os family="Windows" />
@@ -367,6 +379,7 @@
     hy.test.timeout = ${hy.test.timeout}
     hy.test.vm.name = ${hy.test.vm.name}
     hy.test.vmargs = ${hy.test.vmargs}
+    findbugs.available = ${findbugs.available}
 
 Harmony platform properties:
 
@@ -900,4 +913,27 @@
         </sequential>
     </macrodef>
 
+    <macrodef name="run-findBugs">
+       <attribute name="outputFile"/>
+       <attribute name="excludeFilter"/>
+       <attribute name="jarFile"/>
+       <sequential>
+          <fail message="FindBugs is unavailable" unless="findbugs.available"/>
+          <findbugs home="${findbugs.home}"
+            output="xml"
+            outputFile="@{outputFile}"
+            excludeFilter="@{excludeFilter}"
+            jvmargs="-Xmx512M"
+            workhard="true">
+            <auxClasspath>
+                <fileset dir="${hy.jdk}/jre/lib/boot">
+                    <include name="**/*.jar" />
+                </fileset>
+            </auxClasspath>
+            <sourcePath path="src/main/java" />
+            <class location="@{jarFile}" />
+        </findbugs>
+       </sequential>
+    </macrodef>
+
 </project>

Modified: harmony/enhanced/classlib/trunk/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/build.xml?rev=820236&r1=820235&r2=820236&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/build.xml Wed Sep 30 10:40:03 2009
@@ -221,6 +221,15 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <property name="findBugs.report" location="../../build/findbugs_report" />
+        <mkdir dir="${findBugs.report}" />
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/luni.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/luni.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/luni.jar"
              manifest="META-INF/MANIFEST.MF"

Added: harmony/enhanced/classlib/trunk/modules/luni/make/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/findbugs-exclude-filter.xml?rev=820236&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/make/findbugs-exclude-filter.xml (added)
+++ harmony/enhanced/classlib/trunk/modules/luni/make/findbugs-exclude-filter.xml Wed Sep
30 10:40:03 2009
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!-- Exclusion filter for running FindBugs against Apache Harmony -->
+
+<FindBugsFilter>
+     
+       <!-- Number classes should be able to call Number constructors -->
+       <Match>
+       <Or>
+         <Class name="java.lang.Byte" />
+         <Class name="java.lang.Character" />
+         <Class name="java.lang.Integer" />
+         <Class name="java.lang.Long" />
+         <Class name="java.lang.Short" />
+       </Or>
+       <Bug code="Dm" />
+     </Match>
+     
+     <!-- OK to use signed right shift instead of unsigned because numbers used are positive
-->
+     <Match>
+       <Class name="java.lang.Character$UnicodeBlock" />
+       <Method name="of" />
+       <Bug code="IM" />
+     </Match>
+             
+     <!-- Javadoc specifies that ByteArrayInputStream's constructors are designed to take
a mutable byte array as an argument and not copy it -->
+     <Match>
+       <Class name="java.io.ByteArrayInputStream" />
+       <Bug code="EI2" />
+     </Match>
+             
+     <!-- Javadoc specifies that CharArrayReader's constructors are designed to take a
mutable char array as an argument and not copy it -->
+     <Match>
+       <Class name="java.io.CharArrayReader" />
+       <Bug code="EI2" />
+     </Match>   
+
+     <!-- Fallthrough in switch statement is meant to be there -->
+     <Match>
+       <Class name="java.io.LineNumberInputStream" />
+       <Method name="read" />
+       <Bug code="SF" />
+     </Match>
+     
+     <!-- Fallthrough in switch statement is meant to be there -->
+     <Match>
+       <Class name="java.io.LineNumberReader" />
+       <Method name="read" />
+       <Bug code="SF" />
+     </Match>
+     
+     <!-- OK to compare Strings using  using == or != in the String class itself -->
+     <Match>
+       <Class name="java.lang.String" />
+       <Bug code="ES" />
+     </Match>
+     
+     <!-- Ignore this unused private method -->
+     <Match>
+       <Class name="java.lang.String" />
+       <Method name="indexOf" />
+       <Bug code="UPM" />
+     </Match>
+     
+     <!-- Field h is required to be non-transient as part of the serialized form specification
for Proxy -->
+     <Match>
+       <Class name="java.lang.reflect.Proxy" />
+       <Field name="h" />
+       <Bug code="Se" />
+     </Match>
+     
+     <!-- Exceptions have to be ignored because method doesn't throw an Exception in the
spec -->
+     <Match>
+       <Class name="java.lang.SecurityManager" />
+       <Method name="checkTopLevelWindow" />
+       <Bug code="DE" />
+     </Match>
+     
+     <!-- OK to use mutable Objects for DatagramPacket -->
+     <Match>
+       <Class name="java.net.DatagramPacket" />
+       <Or>
+         <Method name="setData" />
+         <Method name="getData" />
+       </Or>
+       <Bug code="EI2, EI" />
+     </Match>
+     
+     <!-- Method is not static in the spec, so can't change it -->
+     <Match>
+       <Class name="java.net.URLConnection" />
+       <Method name="setDefaultUseCaches" />
+       <Bug code="ST" />
+     </Match>
+     
+     <!-- Exceptions are supposed to be ignored -->
+     <Match>
+       <Class name="java.net.URLConnection" />
+       <Method name="getContentHandler" />
+       <Bug code="DE" />
+     </Match>
+     
+     <!-- Exceptions are supposed to be ignored -->
+     <Match>
+       <Class name="java.net.URL" />
+       <Method name="setupStreamHandler" />
+       <Bug code="DE" />
+     </Match>
+     
+     <!-- URLClassLoader needs to use URL.equals() method -->
+     <Match>
+       <Class name="java.net.URLClassLoader" />
+       <Bug code="Dm" />
+     </Match>
+
+     <!-- Load of known null value is intended (line 409) -->
+     <Match>
+       <Class name="java.net.URL" />
+       <Bug code="NP" />
+     </Match>
+     
+     <!-- It does make sense for AbstractList to have a transient field because it has
serializable subclasses -->
+     <Match>
+       <Class name="java.util.AbstractList" />
+       <Bug code="Se" />
+     </Match>
+     
+     <!-- False positive caused by compiler -->
+     <Match>
+       <Class name="java.util.AbstractList" />
+       <Method name="addAll" />
+       <Bug code="DLS" />
+     </Match>
+          
+     <!-- GregorianCalendar.equals does not need to check for null because it delegates
to its superclass, which does -->
+     <Match>
+       <Class name="java.util.GregorianCalendar" />
+       <Method name="equals" />
+       <Bug code="NP" />
+     </Match>
+     
+     <!-- PropertyPermission.equals does not need to check for null because it delegates
to its superclass, which does -->
+     <Match>
+       <Class name="java.util.PropertyPermission" />
+       <Method name="equals" />
+       <Bug code="NP" />
+     </Match>
+     
+     <!-- The comparator field is part of the serialized form specification for both TreeMap
and PriorityQueue -->
+     <Match>
+       <Or>
+         <Class name="java.util.TreeMap" />
+         <Class name="java.util.PriorityQueue" />
+       </Or>
+       <Field name="comparator" />
+       <Bug code="Se" />
+     </Match>
+     
+     <!-- Ignore this unread field -->
+     <Match>
+       <Class name="java.util.Timer" />
+       <Field name="finalizer" />
+       <Bug code="UrF" />
+     </Match>
+     
+     <!-- Exception is ignored on purpose -->
+     <Match>
+       <Class name="java.util.Timer$TimerImpl" />
+       <Method name="run" />
+       <Bug code="DE" />
+     </Match>
+     
+     <!-- Access is synchronized - looks like FindBugs got it wrong here -->
+     <Match>
+       <Class name="java.util.Timer$TimerImpl" />
+       <Field name="cancelled" />
+       <Bug code="IS" />
+     </Match>
+     
+     <!-- Initialization of Locale.availableLocales doesn't need to be synchronized as
it won't matter if it is initialized twice -->
+     <Match>
+       <Class name="java.util.Locale" />
+       <Method name="getAvailableLocales" />
+       <Bug code="LI" />
+     </Match>
+     
+     <!-- OK to use signed right shift instead of unsigned because all numbers are positive
-->
+     <Match>
+       <Class name="java.util.Arrays" />
+       <Bug code="IM" />
+     </Match>     
+     
+     <!-- OK to use unsynchronized access in Hashtable.HashIterator and Hashtable.HashEnumerator
-->
+     <!-- NOTE - it would be good to be able to make this exclusion a bit more specific
-->
+     <Match>
+       <Class name="java.util.Hashtable" />
+       <Bug code="IS" />
+     </Match>
+     
+     <!-- Comparators are generally Serializable so it's OK for this field not to be transient
-->
+     <Match>
+       <Class name="java.util.Collections$ReverseComparatorWithComparator" />
+       <Bug code="Se" />
+     </Match>
+     
+     <!-- Fallthrough in switch statements are meant to be there -->
+     <Match>
+       <Class name="org.apache.harmony.luni.util.FloatingPointParser" />
+       <Or>
+       	 <Method name="parseDblName" />
+       	 <Method name="parseFltName" />
+       </Or>
+       <Bug code="SF" />
+     </Match>
+     
+     <!-- OK to throw a NullPointerException if one key is null -->
+     <Match>
+       <Class name="org.apache.harmony.luni.util.TwoKeyHashMap" />
+       <Bug code="NP" />
+     </Match>
+          
+     <!-- Unread fields are used by native code -->
+     <Match>
+     <Class name="org.apache.harmony.luni.net.GenericIPMreq" />
+       <Or>
+       	 <Field name="interfaceAddr" />
+       	 <Field name="isIPV6Address" />
+       	 <Field name="interfaceIdx" />
+       </Or>
+       <Bug code="UrF" />
+     </Match>
+
+     <!-- Ignored result is not important in this case -->
+     <Match>
+       <Class name="org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection"
/>
+       <Method name="getReply" />
+       <Bug code="RR" />
+     </Match>           
+     
+     <!-- Invocation of inherited method is intended -->
+     <Match>
+       <Class name="org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine"
/>
+       <Bug code="IA" />
+     </Match>
+            
+</FindBugsFilter>
+

Propchange: harmony/enhanced/classlib/trunk/modules/luni/make/findbugs-exclude-filter.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message