You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/06/23 20:20:39 UTC

[lucene-solr] branch branch_8x updated: LUCENE-9411: Fail complation on warnings, 9x gradle-only

This is an automated email from the ASF dual-hosted git repository.

erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 8f9c774  LUCENE-9411: Fail complation on warnings, 9x gradle-only
8f9c774 is described below

commit 8f9c774691ea6678c3855dd49d8d07cd06121973
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Tue Jun 23 16:20:27 2020 -0400

    LUCENE-9411: Fail complation on warnings, 9x gradle-only
---
 solr/CHANGES.txt                                              |  4 ++++
 .../java/org/apache/solr/common/util/JsonSchemaValidator.java | 11 +++--------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5b0c8af..fcb13da 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -291,6 +291,10 @@ Other Changes
 
 * SOLR-13268: Clean up any test failures resulting from defaulting to async logging (Erick Erickson)
 
+* LUCENE-9411: Fail complation on warnings, 9x gradle-only (Erick Erickson, Dawid Weiss)
+  Only mentioned in 8.6 because I backported some more warning suppressions but not
+  the fail-on-warnings.
+
 ==================  8.5.2 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
index 178503e..1a2d1c7 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaValidator.java
@@ -34,21 +34,18 @@ import java.util.function.Function;
  * It validates most aspects of json schema but it is NOT A FULLY COMPLIANT JSON schema parser or validator.
  * This validator borrow some design's idea from https://github.com/networknt/json-schema-validator
  */
-@SuppressWarnings({"unchecked"})
+@SuppressWarnings({"unchecked", "rawtypes"})
 public class JsonSchemaValidator {
 
-  @SuppressWarnings({"unchecked", "rawtypes"})
   private List<Validator> validators;
   private static Set<String> KNOWN_FNAMES = new HashSet<>(Arrays.asList(
       "description","documentation","default","additionalProperties"));
 
 
-  @SuppressWarnings({"rawtypes"})
   public JsonSchemaValidator(String jsonString) {
     this((Map) Utils.fromJSONString(jsonString));
   }
 
-  @SuppressWarnings({"rawtypes"})
   public JsonSchemaValidator(Map jsonSchema) {
     this.validators = new LinkedList<>();
     for (Object fname : jsonSchema.keySet()) {
@@ -61,7 +58,6 @@ public class JsonSchemaValidator {
     }
   }
 
-  @SuppressWarnings({"rawtypes"})
   static final Map<String, Function<Pair<Map,Object>, Validator>> VALIDATORS = new HashMap<>();
 
   static {
@@ -79,7 +75,6 @@ public class JsonSchemaValidator {
     return errs.isEmpty() ? null : errs;
   }
 
-  @SuppressWarnings({"unchecked", "rawtypes"})
   boolean validate(Object data, List<String> errs) {
     if (data == null) return true;
     for (Validator validator : validators) {
@@ -93,7 +88,6 @@ public class JsonSchemaValidator {
 }
 
 abstract class Validator<T> {
-  @SuppressWarnings("unused")
   Validator(@SuppressWarnings({"rawtypes"})Map schema, T properties) {};
   abstract boolean validate(Object o, List<String> errs);
 }
@@ -182,7 +176,7 @@ class TypeValidator extends Validator<Object> {
 @SuppressWarnings({"rawtypes"})
 class ItemsValidator extends Validator<Map> {
   private JsonSchemaValidator validator;
-  ItemsValidator(@SuppressWarnings({"rawtypes"})Map schema, @SuppressWarnings({"rawtypes"})Map properties) {
+  ItemsValidator(Map schema, Map properties) {
     super(schema, properties);
     validator = new JsonSchemaValidator(properties);
   }
@@ -282,6 +276,7 @@ class PropertiesValidator extends Validator<Map<String, Map>> {
   }
 
   @Override
+  @SuppressWarnings({"rawtypes"})
   boolean validate(Object o, List<String> errs) {
     if (o instanceof Map) {
       @SuppressWarnings({"rawtypes"})