Skip to content

Commit

Permalink
[VIVO-1737] Update Error Prone (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamtriggs authored and Andrew Woods committed Jan 23, 2020
1 parent 87e55f0 commit 6d64d27
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ private String escapeWhitespaceInQueryString(String queryStr) {
return queryStr.replaceAll("\\s+", "\\\\ ");
}

public class SearchResult implements Comparable<Object> {
public class SearchResult implements Comparable<SearchResult> {
private String label;
private String uri;

Expand All @@ -493,7 +493,7 @@ Map<String, String> toMap() {
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.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private RDFService getRdfService(HttpServletRequest req) {
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;
Expand Down Expand Up @@ -375,7 +375,7 @@ ObjectNode toJSONObject() {
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.");
}
Expand Down
36 changes: 28 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit 6d64d27

Please sign in to comment.