Skip to content

Commit

Permalink
Upgrade forbiddenapis to 3.4 (#11834)
Browse files Browse the repository at this point in the history
  • Loading branch information
uschindler authored Oct 2, 2022
1 parent 7333f03 commit aae2934
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions gradle/validation/forbidden-apis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 += [
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =======================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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.
Expand Down Expand Up @@ -408,7 +409,7 @@ MemorySegmentIndexInput buildSlice(String sliceDescription, long offset, long le

// 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);
Expand Down

0 comments on commit aae2934

Please sign in to comment.