You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by jm...@apache.org on 2018/05/09 14:44:51 UTC
[accumulo] branch master updated: ACCUMULO-2537 Add @Override
Annotations
This is an automated email from the ASF dual-hosted git repository.
jmark99 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/master by this push:
new 64e6da0 ACCUMULO-2537 Add @Override Annotations
64e6da0 is described below
commit 64e6da08cdc3258af03754a291dabeec3af3e5e3
Author: Mark Owens <jm...@apache.org>
AuthorDate: Mon May 7 10:59:46 2018 -0400
ACCUMULO-2537 Add @Override Annotations
Added a profile 'use-errorprone' to enforce use of the override annotation on
required methods. Uses google errorprone to handle enforcement. It
ignores the generated code in the project. Findbugs/Spotbugs do not
currently enable enforcement of the annotation, thus the use of
errorprone. Initially setup as a profile to verify it works as expected
and satifies the goal of the annotation enforcement.
Addressed some issues brought up via Github review. Included removal of
some unnecessary tags and the addition of a comment explaining the
profile. Also renamed to 'use-errorprone'.
---
.../core/client/impl/TableOperationsHelper.java | 1 +
.../core/iterators/user/SeekingFilter.java | 1 +
.../org/apache/accumulo/core/summary/Gatherer.java | 1 +
.../testcases/InstantiationTestCase.java | 1 +
.../testcases/OutputVerifyingTestCase.java | 1 +
pom.xml | 34 ++++++++++++++++++++++
.../accumulo/test/GenerateSequentialRFile.java | 1 +
.../test/functional/ConcurrentDeleteTableIT.java | 1 +
.../test/functional/SessionBlockVerifyIT.java | 1 +
.../apache/accumulo/test/functional/SummaryIT.java | 1 +
10 files changed, 43 insertions(+)
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
index c84139b..421b51a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
@@ -175,6 +175,7 @@ public abstract class TableOperationsHelper implements TableOperations {
checkIteratorConflicts(iteratorProps, setting, scopes);
}
+ @Override
public int addConstraint(String tableName, String constraintClassName)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
TreeSet<Integer> constraintNumbers = new TreeSet<>();
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java
index 79ee0ba..b3ef9bc 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/SeekingFilter.java
@@ -77,6 +77,7 @@ public abstract class SeekingFilter extends WrappingIterator {
return accept ? PASSES.get(advance) : FAILS.get(advance);
}
+ @Override
public String toString() {
return "Acc: " + accept + " Adv: " + advance;
}
diff --git a/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java b/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java
index 8163cd1..9d99078 100644
--- a/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java
+++ b/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java
@@ -656,6 +656,7 @@ public class Gatherer {
return endRow;
}
+ @Override
public String toString() {
return startRow + " " + endRow;
}
diff --git a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java
index 65f93e2..a36650c 100644
--- a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java
+++ b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/InstantiationTestCase.java
@@ -43,6 +43,7 @@ public class InstantiationTestCase implements IteratorTestCase {
return new IteratorTestOutput(TestOutcome.PASSED);
}
+ @Override
public boolean verify(IteratorTestOutput expected, IteratorTestOutput actual) {
// Ignore what the user provided as expected output, just check that we instantiated the
// iterator successfully.
diff --git a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/OutputVerifyingTestCase.java b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/OutputVerifyingTestCase.java
index f5e966b..84ba2be 100644
--- a/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/OutputVerifyingTestCase.java
+++ b/iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/testcases/OutputVerifyingTestCase.java
@@ -24,6 +24,7 @@ import org.apache.accumulo.iteratortest.IteratorTestOutput;
*/
public abstract class OutputVerifyingTestCase implements IteratorTestCase {
+ @Override
public boolean verify(IteratorTestOutput expected, IteratorTestOutput actual) {
return expected.equals(actual);
}
diff --git a/pom.xml b/pom.xml
index 6f0c6ba..f7b13f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1770,6 +1770,40 @@
<findbugs.excludeFilterFile>src/main/findbugs/exclude-filter.xml</findbugs.excludeFilterFile>
</properties>
</profile>
+ <profile>
+ <!-- This profile uses the google errorprone compiler to enforce use of the Override
+ annotation where needed. Auto-generated code is not checked. -->
+ <id>use-errorprone</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerId>javac-with-errorprone</compilerId>
+ <forceJavacCompilerUse>true</forceJavacCompilerUse>
+ <compilerArgs>
+ <arg>-XepDisableAllChecks</arg>
+ <arg>-Xep:MissingOverride:ERROR</arg>
+ <arg>-XepExcludedPaths:.*/(proto|thrift|generated-sources)/.*</arg>
+ </compilerArgs>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.errorprone</groupId>
+ <artifactId>error_prone_core</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-javac-errorprone</artifactId>
+ <version>2.8</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<!-- Active by default, build against Hadoop 2 -->
<profile>
<id>hadoop-default</id>
diff --git a/test/src/main/java/org/apache/accumulo/test/GenerateSequentialRFile.java b/test/src/main/java/org/apache/accumulo/test/GenerateSequentialRFile.java
index 416f3c2..8c90ae3 100644
--- a/test/src/main/java/org/apache/accumulo/test/GenerateSequentialRFile.java
+++ b/test/src/main/java/org/apache/accumulo/test/GenerateSequentialRFile.java
@@ -53,6 +53,7 @@ public class GenerateSequentialRFile implements Runnable {
long valuesPerRow = 42000;
}
+ @Override
public void run() {
try {
final Configuration conf = new Configuration();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
index aa43b50..8c7c7f1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
@@ -125,6 +125,7 @@ public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
this.cdl = cdl;
}
+ @Override
public void run() {
try {
cdl.countDown();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
index 9fa9397..5f34ac9 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
@@ -80,6 +80,7 @@ public class SessionBlockVerifyIT extends ScanSessionTimeOutIT {
ExecutorService service = Executors.newFixedThreadPool(10);
@Test
+ @Override
public void run() throws Exception {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
index 66d3689..fdfa975 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
@@ -446,6 +446,7 @@ public class SummaryIT extends AccumuloClusterHarness {
return true;
}
+ @Override
public void gatherInformation(MajorCompactionRequest request) throws IOException {
List<Summary> summaries = request.getSummaries(request.getFiles().keySet(),
conf -> conf.getClassName().contains("FooCounter"));
--
To stop receiving notification emails like this one, please contact
jmark99@apache.org.