Upgrade forbiddenapis to 3.4 (#11834)

This commit is contained in:
Uwe Schindler 2022-10-02 16:42:36 +02:00 committed by GitHub
parent 7333f0329b
commit aae293437f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 9 deletions

View File

@ -22,7 +22,7 @@ plugins {
id "base"
id "com.palantir.consistent-versions" version "2.11.0"
id "org.owasp.dependencycheck" version "7.2.0"
id 'de.thetaphi.forbiddenapis' version '3.3' apply false
id 'de.thetaphi.forbiddenapis' version '3.4' apply false
id "de.undercouch.download" version "5.2.0" apply false
id "net.ltgt.errorprone" version "2.0.2" apply false
id 'com.diffplug.spotless' version "6.5.2" apply false

View File

@ -57,7 +57,7 @@ allprojects { prj ->
}
// Configure defaults for sourceSets.main
forbiddenApisMain {
tasks.matching { it.name in ["forbiddenApisMain", "forbiddenApisMain19"] }.all {
bundledSignatures += [
'jdk-unsafe',
'jdk-deprecated',
@ -73,6 +73,13 @@ allprojects { prj ->
doFirst dynamicSignatures.curry(configurations.compileClasspath, "lucene")
}
// Configure defaults for the MR-JAR feature sourceSets by setting java version and ignore missing classes
// TODO: Get hold of warning messages, see https://github.com/policeman-tools/forbidden-apis/issues/207
tasks.matching { it.name == "forbiddenApisMain19" }.all {
failOnMissingClasses = false
targetCompatibility = 19
}
// Configure defaults for sourceSets.test
tasks.matching { it.name in ["forbiddenApisTest", "forbiddenApisTestFixtures"] }.all {
bundledSignatures += [
@ -115,11 +122,6 @@ allprojects { prj ->
inputs.dir(file(resources))
}
// TODO: Remove this when forbiddenapis supports Java 19 class files
tasks.matching { it.name == "forbiddenApisMain19" }.all {
enabled = false
}
// We rely on resolved configurations to compute the relevant set of rule
// files for forbiddenApis. Since we don't want to resolve these configurations until
// the task is executed, we can't really use them as task inputs properly. This is a

View File

@ -140,7 +140,9 @@ Other
---------------------
* LUCENE-10423: Remove usages of System.currentTimeMillis() from tests. (Marios Trivyzas)
* GITHUB#11811: upgrade google java format to 1.15.0 (Dawid Weiss)
* GITHUB#11811: Upgrade google java format to 1.15.0 (Dawid Weiss)
* GITHUB#11834: Upgrade forbiddenapis to version 3.4. (Uwe Schindler)
======================== Lucene 9.4.0 =======================

View File

@ -24,6 +24,7 @@ import java.lang.foreign.ValueLayout;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Objects;
import org.apache.lucene.util.ArrayUtil;
/**
* Base IndexInput implementation that uses an array of MemorySegments to represent a file.
@ -408,7 +409,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements RandomAcces
// we always allocate one more slice, the last one may be a 0 byte one after truncating with
// asSlice():
final MemorySegment slices[] = Arrays.copyOfRange(segments, startIndex, endIndex + 1);
final MemorySegment slices[] = ArrayUtil.copyOfSubArray(segments, startIndex, endIndex + 1);
// set the last segment's limit for the sliced view.
slices[slices.length - 1] = slices[slices.length - 1].asSlice(0L, sliceEnd & chunkSizeMask);