Skip to content

Commit

Permalink
Don't use @InlineMe, which breaks javac in some clients
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Apr 7, 2024
1 parent a800bc8 commit 664009c
Show file tree
Hide file tree
Showing 8 changed files with 307 additions and 278 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- Renamed `*Plume` classes to `*P`, for brevity; for example, use `CollectionsP` instead of `CollectionsPlume`.
- Removed all deprecated classes and mehods.

## 1.9.2 (2024-04-07)

- Don't use `@InlineMe`, which breaks javac in some clients.

## 1.9.1 (2024-04-06)

- `FilesPlume`:
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ ext {
dependencies {
implementation 'org.plumelib:hashmap-util:0.0.1'
implementation 'org.plumelib:reflection-util:1.1.3'
implementation "com.google.errorprone:error_prone_annotations:${errorproneVersion}"
// Including error_prone_annotations leads to javac warnings (not errors, but
// annoying nonetheless) when a client of plume-util doesn't itself depend on
// 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'
Expand Down Expand Up @@ -98,6 +101,7 @@ tasks.withType(JavaCompile).configureEach {
options.errorprone {
// ExtendsObject does not yet exist in Error Prone 2.10.0.
// disable('ExtendsObject') // Incorrect when using the Checker Framework
disable('InlineMeSuggester') // Using `@InlineMe` requires clients to declare a dependency on error_prone_annotations
disable('ReferenceEquality') // Use Interning Checker instead.
disable('AnnotateFormatMethod') // Error Prone doesn't know about Checker Framework @FormatMethod
}
Expand Down
28 changes: 18 additions & 10 deletions gradle/mavencentral.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@

// To make a release (run on any filesystem, except the last step):
// * Make a snapshot release to Maven Central and test it on some clients:
// * Set "version" below.
// * git pull && ./gradlew javadocWeb
// * In the clients' build.gradle: set version number and use:
// repositories {
// ...
// maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
// }
// configurations.all {
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
// }
// * Approach 1:
// * Set "version" below.
// * git pull && ./gradlew clean publish
// * In the clients' build.gradle: set version number and use:
// repositories {
// ...
// maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
// }
// configurations.all {
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
// }
// * Approach 2:
// * Set "version" below.
// * git pull && ./gradlew clean PublishToMavenLocal
// * In the clients' build.gradle: set version number and use:
// repositories {
// mavenLocal()
// }
// For the Checker Framework:
// * usecf THE-BRANCH-THAT-USES-THE-SNAPSHOT
// * checker/bin-devel/test-cftests-all.sh && checker/bin-devel/test-typecheck.sh && checker/bin-devel/test-plume-lib.sh
Expand Down
61 changes: 30 additions & 31 deletions src/main/java/org/plumelib/util/ArraysPlume.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package org.plumelib.util;

import com.google.errorprone.annotations.InlineMe;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
Expand Down Expand Up @@ -2529,9 +2528,9 @@ public static boolean hasDuplicates(boolean[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(boolean[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2580,9 +2579,9 @@ public static boolean hasDuplicates(byte[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(byte[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2631,9 +2630,9 @@ public static boolean hasDuplicates(char[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(char[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2682,9 +2681,9 @@ public static boolean hasDuplicates(float[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(float[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2733,9 +2732,9 @@ public static boolean hasDuplicates(short[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(short[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2784,9 +2783,9 @@ public static boolean hasDuplicates(int[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(int[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2836,9 +2835,9 @@ public static boolean hasDuplicates(double[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(double[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2888,9 +2887,9 @@ public static boolean hasDuplicates(long[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(long[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2939,9 +2938,9 @@ public static boolean hasDuplicates(String[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(String[] a) {
return !hasDuplicates(a);
Expand Down Expand Up @@ -2990,9 +2989,9 @@ public static boolean hasDuplicates(Object[] a) {
* @deprecated use {@code hasNoDuplicates}
*/
@Deprecated // 2023-12-01
@InlineMe(
replacement = "!ArraysPlume.hasDuplicates(a)",
imports = "org.plumelib.util.ArraysPlume")
// @InlineMe(
// replacement = "!ArraysPlume.hasDuplicates(a)",
// imports = "org.plumelib.util.ArraysPlume")
@Pure
public static boolean noDuplicates(Object[] a) {
return !hasDuplicates(a);
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/org/plumelib/util/CollectionsPlume.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package org.plumelib.util;

import com.google.errorprone.annotations.InlineMe;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -110,9 +109,9 @@ public static <T> boolean hasNoDuplicates(List<T> a) {
* @deprecated use {@link #hasNoDuplicates(List)}
*/
@Deprecated // 2023-11-30
@InlineMe(
replacement = "CollectionsPlume.hasNoDuplicates(a)",
imports = "org.plumelib.util.CollectionsPlume")
// @InlineMe(
// replacement = "CollectionsPlume.hasNoDuplicates(a)",
// imports = "org.plumelib.util.CollectionsPlume")
@Pure
public static <T> boolean noDuplicates(List<T> a) {
return hasNoDuplicates(a);
Expand Down Expand Up @@ -592,9 +591,9 @@ List<TO> transform(
* @deprecated use {@link #filter} instead
*/
@Deprecated // 2023-11-30
@InlineMe(
replacement = "CollectionsPlume.filter(coll, filter)",
imports = "org.plumelib.util.CollectionsPlume")
// @InlineMe(
// replacement = "CollectionsPlume.filter(coll, filter)",
// imports = "org.plumelib.util.CollectionsPlume")
public static <T> List<T> listFilter(Collection<T> coll, Predicate<? super T> filter) {
return filter(coll, filter);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/plumelib/util/FilesPlume.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static java.nio.file.StandardOpenOption.APPEND;
import static java.nio.file.StandardOpenOption.CREATE;

import com.google.errorprone.annotations.InlineMe;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
Expand Down Expand Up @@ -985,7 +984,8 @@ public static String readerContents(Reader r) {
* @return the entire contents of the reader, as a string
* @deprecated use {@link #fileContents}
*/
@InlineMe(replacement = "FilesPlume.fileContents(file)", imports = "org.plumelib.util.FilesPlume")
// @InlineMe(replacement = "FilesPlume.fileContents(file)", imports =
// "org.plumelib.util.FilesPlume")
@Deprecated // 2023-03-02
public static String readFile(File file) {
return fileContents(file);
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/plumelib/util/MathPlume.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.plumelib.util;

import com.google.errorprone.annotations.InlineMe;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
Expand Down Expand Up @@ -802,7 +801,8 @@ public static double gcdDifferences(double[] a) {
* @deprecated use {@link #modNonnegative(int, int)}
*/
@Deprecated // 2020-02-20
@InlineMe(replacement = "MathPlume.modNonnegative(x, y)", imports = "org.plumelib.util.MathPlume")
// @InlineMe(replacement = "MathPlume.modNonnegative(x, y)", imports =
// "org.plumelib.util.MathPlume")
@Pure
@StaticallyExecutable
public static @NonNegative @LessThan("#2") @PolyUpperBound int modPositive(
Expand Down Expand Up @@ -1045,7 +1045,8 @@ public static double gcdDifferences(double[] a) {
* @deprecated use {@link #modNonnegative(long, long)}
*/
@Deprecated // 2020-02-20
@InlineMe(replacement = "MathPlume.modNonnegative(x, y)", imports = "org.plumelib.util.MathPlume")
// @InlineMe(replacement = "MathPlume.modNonnegative(x, y)", imports =
// "org.plumelib.util.MathPlume")
@Pure
@StaticallyExecutable
public static @NonNegative @LessThan("#2") @PolyUpperBound long modPositive(
Expand Down
Loading

0 comments on commit 664009c

Please sign in to comment.