HBASE-16321 ensure no findbugs-jsr305

Signed-off-by: Esteban Gutierrez <esteban@apache.org>
This commit is contained in:
Sean Busbey 2016-08-02 01:17:59 -05:00
parent 4b3e45fceb
commit 60b79e2daa
17 changed files with 133 additions and 63 deletions

View File

@ -247,8 +247,8 @@
</activation>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
<optional>true</optional>
</dependency>
<dependency>
@ -259,10 +259,6 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>

View File

@ -17,8 +17,6 @@
*/
package org.apache.hadoop.hbase;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.Closeable;
import java.io.IOException;
import java.io.InterruptedIOException;
@ -34,6 +32,8 @@ import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.ServiceException;
import org.apache.commons.logging.Log;
@ -795,10 +795,10 @@ public class MetaTableAccessor {
* @return Get closest metatable region row to passed <code>row</code>
* @throws java.io.IOException
*/
@Nonnull
@NonNull
public static HRegionInfo getClosestRegionInfo(Connection connection,
@Nonnull final TableName tableName,
@Nonnull final byte[] row)
@NonNull final TableName tableName,
@NonNull final byte[] row)
throws IOException {
byte[] searchRow = HRegionInfo.createRegionName(tableName, row, HConstants.NINES, false);
Scan scan = getMetaScan(connection, 1);

View File

@ -43,7 +43,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@ -17,13 +17,13 @@
*/
package org.apache.hadoop.hbase.protobuf;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.Cell;

View File

@ -22,8 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;
import javax.annotation.Nonnull;
import edu.umd.cs.findbugs.annotations.NonNull;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.Cell;
@ -99,7 +98,7 @@ public abstract class BaseDecoder implements Codec.Decoder {
* thrown if EOF is reached prematurely. Does not return null.
* @throws IOException
*/
@Nonnull
@NonNull
protected abstract Cell parseCell() throws IOException;
@Override

View File

@ -259,8 +259,8 @@
</activation>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
<optional>true</optional>
</dependency>
<dependency>
@ -271,10 +271,6 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
@ -311,6 +307,10 @@
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

View File

@ -430,8 +430,8 @@
</dependency>
<!-- General dependencies -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
<optional>true</optional>
</dependency>
<dependency>

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.hbase.coprocessor;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
@ -26,8 +27,6 @@ import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.ipc.RpcServer;
import org.apache.hadoop.hbase.security.User;
import javax.annotation.Nullable;
/**
* Carries the execution state for a given invocation of an Observer coprocessor
* ({@link RegionObserver}, {@link MasterObserver}, or {@link WALObserver})

View File

@ -18,10 +18,10 @@
*/
package org.apache.hadoop.hbase.master;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.conf.ConfigurationObserver;
import org.apache.hadoop.conf.Configurable;

View File

@ -17,8 +17,6 @@
*/
package org.apache.hadoop.hbase.master;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -27,6 +25,8 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import com.google.common.collect.Sets;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HTableDescriptor;
@ -167,7 +167,7 @@ public class TableStateManager {
return rv;
}
@Nonnull
@NonNull
public TableState.State getTableState(TableName tableName) throws IOException {
TableState currentState = readMetaState(tableName);
if (currentState == null) {

View File

@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.util;
import javax.annotation.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Comparator;
@ -30,6 +29,7 @@ import java.util.regex.Pattern;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.primitives.Ints;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@ -47,8 +47,7 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@ -29,8 +29,7 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@ -459,4 +458,4 @@ public class TestMetaWithReplicas {
hbck = doFsck(TEST_UTIL.getConfiguration(), false);
assertErrors(hbck, new ERROR_CODE[]{});
}
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.mapreduce;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimaps;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Scan;
@ -35,7 +36,6 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.experimental.categories.Category;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

View File

@ -62,6 +62,10 @@
<version>${scala.version}</version>
<scope>provided</scope>
</dependency>
<!-- we exclude jsr305 below and then expressly relist it as
provided / optional to avoid dependency resolution possibly
bringing it back into runtime scope.
-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.binary.version}</artifactId>
@ -78,8 +82,19 @@
<groupId>org.scala-lang</groupId>
<artifactId>scalap</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>1.3.9</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.binary.version}</artifactId>
@ -181,6 +196,10 @@
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
@ -215,6 +234,10 @@
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
@ -646,6 +669,22 @@
</execution>
</executions>
</plugin>
<!-- purposefully have jsr 305 exclusion only warn in this module -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>banned-jsr305</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<fail>false</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

87
pom.xml
View File

@ -931,36 +931,52 @@
</dependency>
</dependencies>
<!-- version set by parent -->
<configuration>
<rules>
<!-- The earliest maven version we verify builds for via ASF Jenkins -->
<requireMavenVersion>
<version>[${maven.min.version},)</version>
<message>Maven is out of date.
<executions>
<execution>
<id>min-maven-and-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- The earliest maven version we verify builds for via ASF Jenkins -->
<requireMavenVersion>
<version>[${maven.min.version},)</version>
<message>Maven is out of date.
HBase requires at least version ${maven.min.version} of Maven to properly build from source.
You appear to be using an older version. You can use either "mvn -version" or
"mvn enforcer:display-info" to verify what version is active.
See the reference guide on building for more information: http://hbase.apache.org/book.html#build
</message>
</requireMavenVersion>
<!-- The earliest JVM version we verify builds for via ASF Jenkins -->
<requireJavaVersion>
<version>[${java.min.version},)</version>
<message>Java is out of date.
</message>
</requireMavenVersion>
<!-- The earliest JVM version we verify builds for via ASF Jenkins -->
<requireJavaVersion>
<version>[${java.min.version},)</version>
<message>Java is out of date.
HBase requirs at least version ${java.min.version} of the JDK to properly build from source.
You appear to be using an older version. You can use either "mvn -version" or
"mvn enforcer:display-info" to verify what version is active.
See the reference guide on building for more information: http://hbase.apache.org/book.html#build
</message>
</requireJavaVersion>
</rules>
</configuration>
<executions>
</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
<execution>
<id>enforce</id>
<id>banned-jsr305</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>com.google.code.findbugs:jsr305</exclude>
</excludes>
<message>We don't allow the JSR305 jar from the Findbugs project, see HBASE-16321.</message>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
@ -1257,7 +1273,6 @@
<httpcore.version>4.4.4</httpcore.version>
<metrics-core.version>3.1.2</metrics-core.version>
<guava.version>12.0.1</guava.version>
<jsr305.version>1.3.9</jsr305.version>
<jackson.version>1.9.13</jackson.version>
<jasper.version>5.5.23</jasper.version>
<jaxb-api.version>2.2.2</jaxb-api.version>
@ -1507,6 +1522,12 @@
<version>${project.version}</version>
</dependency>
<!-- General dependencies -->
<dependency>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
<version>${findbugs-annotations}</version>
</dependency>
<!-- General dependencies -->
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
@ -1533,11 +1554,12 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${jsr305.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
@ -1853,7 +1875,6 @@
<dependency>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
<version>${findbugs-annotations}</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -2213,6 +2234,10 @@
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@ -2247,6 +2272,10 @@
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@ -2387,6 +2416,10 @@
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@ -2426,6 +2459,10 @@
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>

View File

@ -1591,7 +1591,9 @@ value="HE_EQUALS_USE_HASHCODE",
justification="I know what I'm doing")
----
It is important to use the Apache-licensed version of the annotations.
It is important to use the Apache-licensed version of the annotations. That generally means using
annotations in the `edu.umd.cs.findbugs.annotations` package so that we can rely on the cleanroom
reimplementation rather than annotations in the `javax.annotations` package.
[[common.patch.feedback.javadoc.defaults]]
===== Javadoc - Useless Defaults