Skip to content

Commit

Permalink
Merge ../plume-util into dont-support-java-8
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Oct 6, 2024
2 parents bdd33f1 + 5036387 commit e286c26
Show file tree
Hide file tree
Showing 34 changed files with 650 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
java: [ '11', '17', '21', '22' ]
java: [ '11', '17', '21', '23-ea' ]

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
- Renamed `*Plume` classes to `*P`, for brevity; for example, use `CollectionsP` instead of `CollectionsPlume`.
- Removed all deprecated classes and mehods.

## 1.10.0 (2024-??-??)

- `OrderedPairIterator`: uses `IPair` instead of `MPair`
- `ArraysPlume`: deprecated `sorted()` in favor of `isSorted()`
- `StringsPlume`:
* `firstLineSeparator()` can return null
* new method `isVersionNumberLE()`
* new class `VersionNumberComparator`
- `CollectionsPlume`: new methods `anyMatch()`, `allMatch()`, `noneMatch`

## 1.9.3 (2024-04-19)

- `CollectionsPlume`:
Expand Down
77 changes: 39 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@ plugins {
id 'java-library'

// To create a fat jar build/libs/...-all.jar, run: ./gradlew shadowJar
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.gradleup.shadow' version '8.3.3'

// Code formatting; defines targets "spotlessApply" and "spotlessCheck"
id 'com.diffplug.spotless' version '6.23.3'
// Version 6.14.0 and later requires JRE 11+, but version 6.13.0 doesn't work on JRE 21.
id 'com.diffplug.spotless' version '6.25.0'

// Error Prone linter
id('net.ltgt.errorprone') version '3.1.0'
id('net.ltgt.errorprone') version '4.0.1'

// Checker Framework pluggable type-checking
id 'org.checkerframework' version '0.6.37'
id 'org.checkerframework' version '0.6.45'
}

repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}

ext.errorproneVersion = '2.23.0'

ext {
errorproneVersion = '2.33.0'
isJava17orHigher = JavaVersion.current() >= JavaVersion.VERSION_17
isJava21orHigher = JavaVersion.current() >= JavaVersion.VERSION_21
}

Expand All @@ -34,8 +36,8 @@ dependencies {
// error_prone_annotations. (Even if the dependency is "compileOnly".)
// implementation "com.google.errorprone:error_prone_annotations:${errorproneVersion}"

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.2'
}

// To upload to Maven Central, see instructions in the file.
Expand All @@ -58,33 +60,31 @@ test {
}
}

if (! isJava21orHigher) {
spotless {
format 'misc', {
// define the files to apply `misc` to
target '*.md', '.gitignore'
spotless {
format 'misc', {
// define the files to apply `misc` to
target '*.md', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
java {
targetExclude('**/WeakIdentityHashMap.java')
googleJavaFormat()
formatAnnotations()
}
groovyGradle {
target '**/*.gradle'
greclipse() // which formatter Spotless should use to format .gradle files.
indentWithSpaces(2)
trimTrailingWhitespace()
// endWithNewline() // Don't want to end empty files with a newline
}
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
java {
targetExclude('**/WeakIdentityHashMap.java')
googleJavaFormat()
formatAnnotations()
}
groovyGradle {
target '**/*.gradle'
greclipse() // which formatter Spotless should use to format .gradle files.
indentWithSpaces(2)
trimTrailingWhitespace()
// endWithNewline() // Don't want to end empty files with a newline
}
}

/// Error Prone linter
// Error Prone linter

dependencies {
errorprone("com.google.errorprone:error_prone_core:${errorproneVersion}")
Expand All @@ -93,6 +93,7 @@ tasks.withType(JavaCompile).configureEach {
// "-processing" avoids javac warning "No processor claimed any of these annotations".
// "-options" is because starting in JDK 20, javac warns about using -source 8.
options.compilerArgs << '-Xlint:all,-processing,-options' << '-Werror'
options.forkOptions.jvmArgs += '-Xmx2g'
if (isJava21orHigher) {
options.compilerArgs << '-Xlint:-this-escape'
}
Expand All @@ -104,11 +105,10 @@ tasks.withType(JavaCompile).configureEach {
// Code copied from the JDK that we don't want to change gratuitously.
excludedPaths = '.*/Weak.*Hash(er)?Map.java'
}
options.forkOptions.jvmArgs += '-Xmx2g'
options.release = 11
options.errorprone.enabled = isJava17orHigher
}

/// Checker Framework pluggable type-checking
// Checker Framework pluggable type-checking

apply plugin: 'org.checkerframework'

Expand Down Expand Up @@ -140,7 +140,7 @@ checkerFramework {
// To use a snapshot version of the Checker Framework.
if (true) {
// TODO: Change the above test to false when CF is released.
ext.checkerFrameworkVersion = '3.43.0-SNAPSHOT'
ext.checkerFrameworkVersion = '3.48.0'
dependencies {
compileOnly "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
testCompileOnly "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
Expand All @@ -159,7 +159,8 @@ if (project.hasProperty('cfLocal')) {
checkerFramework files(cfHome + '/checker/dist/checker.jar')
}
}
/// Javadoc

// Javadoc

// Turn Javadoc warnings into errors.
javadoc {
Expand Down Expand Up @@ -212,7 +213,7 @@ task requireJavadoc(type: JavaExec) {
check.dependsOn requireJavadoc
javadocWeb.dependsOn requireJavadoc

/// Emacs support
// Emacs support

/* Make Emacs TAGS table */
task tags(type: Exec) {
Expand All @@ -221,7 +222,7 @@ task tags(type: Exec) {
}


/// Debugging support
// Debugging support

task printCompileClasspaths {
description 'Print the compile-time classpaths'
Expand Down
10 changes: 5 additions & 5 deletions gradle/mavencentral.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// ossrhUsername=YOUR_USER_NAME_HERE
// ossrhPassword=YOUR_PASSWORD_HERE

// To make a release (run on any filesystem, except the last step):
// To make a release (run on any filesystem, except the `javadocWeb` step):
// * Make a snapshot release and test it on some clients:
// * Approach 1: to Maven Central
// * Set "version" below.
// * Set "version" (below) to end in "-SNAPSHOT".
// * git pull && ./gradlew clean publish
// * In the clients' build.gradle: set version number and use:
// repositories {
Expand All @@ -17,7 +17,7 @@
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
// }
// * Approach 2: to Maven Local
// * Set "version" below.
// * Set "version" (below) to end in "-SNAPSHOT".
// * git pull && ./gradlew PublishToMavenLocal
// * In the clients' build.gradle: set version number and use:
// repositories {
Expand Down Expand Up @@ -45,7 +45,7 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'

group 'org.plumelib'
version '1.9.3'
version '1.10.0-SNAPSHOT'

final isSnapshot = version.contains('SNAPSHOT')

Expand All @@ -65,7 +65,7 @@ publishing {

pom {
name = 'Plume Util'
description = 'Utility libraries for Java. Complements Guava, Apache Commons, etc.'
description = 'Utility libraries for Java. Complements Guava, Apache Commons, Eclipse Collections, etc.'
url = 'https://github.com/plume-lib/plume-util'

scm {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/plumelib/util/ArrayMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public final void forEach(Consumer<? super Map.Entry<@KeyFor("ArrayMap.this") K,
}
}

///////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////

// iterators

Expand Down Expand Up @@ -879,7 +879,7 @@ public int hashCode(ArrayMap<K, V>.Entry this) {
}
}

///////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////

// Comparison and hashing: equals and hashCode are inherited from AbstractSet.

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/plumelib/util/ArraySet.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void clear() {
}
}

///////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////

// iterators

Expand Down Expand Up @@ -409,7 +409,7 @@ public final void remove() {
}
}

///////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////

// Comparison and hashing: equals and hashCode are inherited from AbstractSet.

Expand Down
Loading

0 comments on commit e286c26

Please sign in to comment.