[VIVO-1737] Update Error Prone (#131)

Resolves: https://jira.lyrasis.org/browse/VIVO-1737
This commit is contained in:
Graham Triggs 2020-01-23 18:12:03 +00:00 committed by Andrew Woods
parent 87e55f063c
commit 6d64d27fe4
4 changed files with 33 additions and 12 deletions

View file

@ -20,6 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.filestorage.model.ImageInfo;
/**
* Represents a single entity record.
*/
@SuppressWarnings("ComparableType")
public class IndividualImpl extends BaseResourceBean implements Individual, Comparable<Individual> {
/**
* This can be used as a "not initialized" indicator for a property that

View file

@ -469,7 +469,7 @@ public class JSONReconcileServlet extends VitroHttpServlet {
return queryStr.replaceAll("\\s+", "\\\\ ");
}
public class SearchResult implements Comparable<Object> {
public class SearchResult implements Comparable<SearchResult> {
private String label;
private String uri;
@ -493,7 +493,7 @@ public class JSONReconcileServlet extends VitroHttpServlet {
return map;
}
public int compareTo(Object o) throws ClassCastException {
public int compareTo(SearchResult o) throws ClassCastException {
if ( !(o instanceof SearchResult) ) {
throw new ClassCastException("Error in SearchResult.compareTo(): expected SearchResult object.");
}

View file

@ -311,7 +311,7 @@ public class AutocompleteController extends VitroAjaxController {
return RDFServiceUtils.getRDFService(new VitroRequest(req));
}
public class SearchResult implements Comparable<Object> {
public class SearchResult implements Comparable<SearchResult> {
private String label;
private String uri;
private String msType;
@ -375,7 +375,7 @@ public class AutocompleteController extends VitroAjaxController {
return jsonObj;
}
public int compareTo(Object o) throws ClassCastException {
public int compareTo(SearchResult o) throws ClassCastException {
if ( !(o instanceof SearchResult) ) {
throw new ClassCastException("Error in SearchResult.compareTo(): expected SearchResult object.");
}

36
pom.xml
View file

@ -217,6 +217,34 @@
</plugins>
</build>
</profile>
<profile>
<!-- Profile for Error Prone plugin -->
<id>errorprone</id>
<activation>
<jdk>[1.8,12)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<compilerArgs combine.children="append">
<arg>-Xplugin:ErrorProne</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.3.4</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
@ -230,15 +258,7 @@
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.3.2</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>