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:21:18 UTC
[lucene-solr] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 9c1772f LUCENE-9411: Fail complation on warnings, 9x gradle-only
9c1772f is described below
commit 9c1772f0946f2a2b2424caf09283b8add4770095
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Tue Jun 23 16:10:49 2020 -0400
LUCENE-9411: Fail complation on warnings, 9x gradle-only
---
build.gradle | 2 +
gradle/defaults-java.gradle | 1 +
gradle/hacks/findbugs.gradle | 45 ++++++++++++++++++++++
gradle/validation/jar-checks.gradle | 4 +-
lucene/CHANGES.txt | 3 ++
solr/CHANGES.txt | 7 ++++
.../handler/dataimport/TestZKPropertiesWriter.java | 1 +
.../solr/common/util/JsonSchemaValidator.java | 11 ++----
versions.lock | 4 +-
9 files changed, 68 insertions(+), 10 deletions(-)
diff --git a/build.gradle b/build.gradle
index 5fc3609..668c345 100644
--- a/build.gradle
+++ b/build.gradle
@@ -150,3 +150,5 @@ apply from: file('gradle/documentation/documentation.gradle')
apply from: file('gradle/documentation/changes-to-html.gradle')
apply from: file('gradle/documentation/markdown.gradle')
apply from: file('gradle/render-javadoc.gradle')
+
+apply from: file('gradle/hacks/findbugs.gradle')
diff --git a/gradle/defaults-java.gradle b/gradle/defaults-java.gradle
index 584054c..4d0fae7 100644
--- a/gradle/defaults-java.gradle
+++ b/gradle/defaults-java.gradle
@@ -33,6 +33,7 @@ allprojects {
"-Xdoclint:-missing",
"-Xdoclint:-accessibility",
"-proc:none", // proc:none was added because of LOG4J2-1925 / JDK-8186647
+ "-Werror",
]
}
}
diff --git a/gradle/hacks/findbugs.gradle b/gradle/hacks/findbugs.gradle
new file mode 100644
index 0000000..bdbdb7e
--- /dev/null
+++ b/gradle/hacks/findbugs.gradle
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// See LUCENE-9411. This hack adds compile-time only dependencies
+// on findbugs annotations. Otherwise javac generates odd warnings about missing
+// type information.
+
+configure([project(":solr:core"),
+ project(":solr:solrj"),
+ project(":solr:contrib:prometheus-exporter")]) {
+ plugins.withType(JavaPlugin) {
+ dependencies {
+ // Use versionless variants because these libraries are in versions.lock.
+ compileOnly 'com.google.errorprone:error_prone_annotations'
+ testCompileOnly 'com.google.errorprone:error_prone_annotations'
+ compileOnly 'com.google.code.findbugs:jsr305'
+ testCompileOnly 'com.google.code.findbugs:jsr305'
+
+ // This one isn't.
+ compileOnly 'com.google.code.findbugs:annotations:3.0.1'
+ testCompileOnly 'com.google.code.findbugs:annotations:3.0.1'
+ }
+
+ // Exclude these from jar validation and license checks.
+ configurations.jarValidation {
+ exclude group: "com.google.code.findbugs", module: "jsr305"
+ exclude group: "com.google.code.findbugs", module: "annotations"
+ exclude group: "com.google.errorprone", module: "error_prone_annotations"
+ }
+ }
+}
diff --git a/gradle/validation/jar-checks.gradle b/gradle/validation/jar-checks.gradle
index b369b06..61db9a1 100644
--- a/gradle/validation/jar-checks.gradle
+++ b/gradle/validation/jar-checks.gradle
@@ -115,7 +115,9 @@ subprojects {
ArrayDeque<ResolvedDependency> queue = new ArrayDeque<>()
configurations.jarValidation.extendsFrom.each { conf ->
if (excludeRules) {
- conf = configurations.detachedConfiguration().extendsFrom(conf)
+ conf = conf.copyRecursive()
+ conf.canBeResolved = true
+ conf.canBeConsumed = true
conf.excludeRules = excludeRules
}
if (conf.canBeResolved) {
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 69c9bfb..fdcd597 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -148,6 +148,9 @@ Other
* LUCENE-9267: Update MatchingQueries documentation to correct
time unit. (Pierre-Luc Perron via Mike Drob)
+* LUCENE-9411: Fail complation on warnings, 9x gradle-only (Erick Erickson, Dawid Weiss)
+ Deserves mention here as well as Lucene CHANGES.txt since it affects both.
+
======================= Lucene 8.6.0 =======================
API Changes
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 7e86211..745fba9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -79,6 +79,9 @@ Other Changes
* SOLR-12823: Remove /clusterstate.json support, including support for collections created with stateFormat=1,
as well as support for Collection API MIGRATESTATEFORMAT action and support for the legacyCloud flag (Ilan Ginzburg).
+* LUCENE-9411: Fail complation on warnings, 9x gradle-only (Erick Erickson, Dawid Weiss)
+ Deserves mention here as well as Lucene CHANGES.txt since it affects both.
+
Bug Fixes
---------------------
* SOLR-14546: Fix for a relatively hard to hit issue in OverseerTaskProcessor that could lead to out of order execution
@@ -373,6 +376,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/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java
index 08abce8..c4f3f7a 100644
--- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java
+++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java
@@ -181,6 +181,7 @@ public class TestZKPropertiesWriter extends SolrCloudTestCase {
/**
* Code copied with some adaptations from {@link org.apache.solr.util.TestHarness.LocalRequestFactory#makeRequest(String...)}.
*/
+ @SuppressWarnings({"unchecked"})
private static LocalSolrQueryRequest localMakeRequest(SolrCore core, String ... q) {
if (q.length==1) {
Map<String, String> args = new HashMap<>();
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"})
diff --git a/versions.lock b/versions.lock
index cbd7a0b..3a72965 100644
--- a/versions.lock
+++ b/versions.lock
@@ -20,7 +20,8 @@ com.github.jnr:jnr-posix:3.0.49 (2 constraints: f0161b5b)
com.github.jnr:jnr-unixsocket:0.20 (1 constraints: 4a09d497)
com.github.virtuald:curvesapi:1.06 (1 constraints: db04f530)
com.github.zafarkhaja:java-semver:0.9.0 (1 constraints: 0b050636)
-com.google.code.findbugs:jsr305:3.0.2 (1 constraints: 170aecb4)
+com.google.code.findbugs:annotations:3.0.1 (1 constraints: 0605fb35)
+com.google.code.findbugs:jsr305:3.0.2 (2 constraints: cd195721)
com.google.errorprone:error_prone_annotations:2.1.3 (1 constraints: 180aebb4)
com.google.guava:guava:25.1-jre (1 constraints: 4a06b047)
com.google.j2objc:j2objc-annotations:1.1 (1 constraints: b609eba0)
@@ -81,6 +82,7 @@ joda-time:joda-time:2.9.9 (1 constraints: 8a0972a1)
junit:junit:4.12 (2 constraints: 3e1e6104)
net.arnx:jsonic:1.2.7 (2 constraints: db10d4d1)
net.hydromatic:eigenbase-properties:1.1.5 (1 constraints: 0905f835)
+net.jcip:jcip-annotations:1.0 (1 constraints: 560ff165)
net.sourceforge.argparse4j:argparse4j:0.8.1 (1 constraints: 0b050436)
net.sourceforge.nekohtml:nekohtml:1.9.17 (1 constraints: 4405503b)
net.thisptr:jackson-jq:0.0.8 (1 constraints: 0a05f335)