LUCENE-9411: Fail complation on warnings, 9x gradle-only

This commit is contained in:
Erick Erickson 2020-06-23 16:10:49 -04:00
parent b0333ab5c8
commit 9c1772f094
9 changed files with 68 additions and 10 deletions

View File

@ -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')

View File

@ -33,6 +33,7 @@ allprojects {
"-Xdoclint:-missing",
"-Xdoclint:-accessibility",
"-proc:none", // proc:none was added because of LOG4J2-1925 / JDK-8186647
"-Werror",
]
}
}

View File

@ -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"
}
}
}

View File

@ -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) {

View File

@ -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

View File

@ -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.

View File

@ -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<>();

View File

@ -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"})

View File

@ -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)