Skip to content

Commit

Permalink
Update for typetools/checker-framework 3.36.0 release (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdietl authored Oct 9, 2023
2 parents 6e927db + b701f07 commit 8be42dd
Show file tree
Hide file tree
Showing 1,640 changed files with 38,580 additions and 19,372 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
# TODO(b/170636568): Enable Maven updates? Perhaps wait until we can more
# easily import the generated PRs into our internal repo.
# - package-ecosystem: "maven"
# directory: "/"
# schedule:
# interval: "daily"
# - package-ecosystem: "maven"
# directory: "/android"
# schedule:
# interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
30 changes: 19 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,34 @@ jobs:
name: "${{ matrix.root-pom }} on JDK ${{ matrix.java }}"
strategy:
matrix:
java: [ 8, 11 ]
java: [ 11, 17 ]
root-pom: [ 'pom.xml', 'android/pom.xml' ]
runs-on: ubuntu-latest
env:
ROOT_POM: ${{ matrix.root-pom }}
steps:
# Cancel any previous runs for the same branch that are still running.
- name: 'Cancel previous runs'
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: 'Check out repository'
uses: actions/checkout@v2
uses: actions/checkout@v2.4.0
- name: 'Cache local Maven repository'
uses: actions/[email protected].4
uses: actions/[email protected].7
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: 'Install'
shell: bash
run: mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn install -U -DskipTests=true -f $ROOT_POM
run: mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn install -U -Dmaven.test.skip -Dmaven.javadoc.skip -f $ROOT_POM
- name: 'Test'
shell: bash
run: MAVEN_OPTS=-Xmx6g mvn -B -P!standard-with-extra-repos verify -U -Dmaven.javadoc.skip=true -f $ROOT_POM
Expand All @@ -51,18 +57,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
uses: actions/checkout@v2.4.0
- name: 'Cache local Maven repository'
uses: actions/[email protected].4
uses: actions/[email protected].7
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: 'Set up JDK 11'
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
server-id: sonatype-nexus-snapshots
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
Expand All @@ -79,18 +86,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
uses: actions/checkout@v2.4.0
- name: 'Cache local Maven repository'
uses: actions/[email protected].4
uses: actions/[email protected].7
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: 'Set up JDK 11'
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
- name: 'Generate latest docs'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
37 changes: 33 additions & 4 deletions README-typetools.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,34 @@ To create file `guava/target/guava-HEAD-jre-SNAPSHOT.jar`:
(cd guava && mvn -B package -Dmaven.test.skip=true -Danimal.sniffer.skip=true)
```

To use a locally-built Checker Framework, add `-P checkerframework-local`,
To use a locally-built Checker Framework:
```
(cd guava && mvn -B package -Dmaven.test.skip=true -Danimal.sniffer.skip=true -P checkerframework-local)
```
or change `guava/pom.xml`.


To run the Guava test suite
---------------------------

This not strictly necessary as the CI process will run them. But if you wish to do so,
it is a two step process. This can take a long time: 20-30 minutes for the compile step
and 30-35 minutes for the test step. In order to shorten it a bit, the command lines
below only run a single format checker. First, you must run maven with the install
target to get a copy of all the generated jar files in your local maven repository:

mvn -V -B -U clean install -Dcheckerframework.checkers=org.checkerframework.checker.formatter.FormatterChecker \
-Dcheck.value.phase=skip -Dmaven.test.skip -Dmaven.javadoc.skip

Then you run the test suite:

MAVEN_OPTS=-Xmx6g mvn -V -B -U verify -Dcheckerframework.checkers=org.checkerframework.checker.formatter.FormatterChecker \
-Dcheck.value.phase=skip -Dmaven.javadoc.skip

Running with the single FormatterChecker gets the total time down to about 20-25 minutes,
almost all testing. (Over 850,000 tests are run.)


Typechecking
------------

Expand Down Expand Up @@ -68,6 +92,10 @@ Whenever a Checker Framework release is made:
To update to a newer version of the upstream library
----------------------------------------------------

First, update to use the latest Checker Framework by editing file
`pom.xml` (for `checker-qual`) and `guava/pom.xml` (for `checker`).
Make a pull request to ensure that type-checking succeeds.

Check for a release at
https://github.com/google/guava/releases
. If there has been one since the last time this repository was pulled,
Expand All @@ -80,8 +108,9 @@ git pull https://github.com/google/guava
```

and then re-build to ensure that typechecking still works.
Doing this `git pull` permits incremental resolution of merge conflicts,
but makes it difficult to re-release a given version of Guava.
Note: Doing this `git pull` command
makes it difficult to re-release a given version of Guava,
compared to pulling in the tag corresponding to a release.

If you wish to see a simplified diff between this fork of Guava and upstream (to make sure that you did not make any mistakes when resolving merge conflicts):

Expand Down Expand Up @@ -143,7 +172,7 @@ yet written.
2. Pull in the latest Guava version (https://github.com/google/guava/releases):
```
git fetch --tags https://github.com/google/guava
git pull https://github.com/google/guava v30.1.1
git pull https://github.com/google/guava v31.1
```

3. Ensure that the project still builds:
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ utilities for concurrency, I/O, hashing, caching, primitives, strings, and more!
is widely used on most Java projects within Google, and widely used by many
other companies as well.

Guava comes in two flavors.
Guava comes in two flavors:

* The JRE flavor requires JDK 1.8 or higher.
* If you need support for JDK 1.7 or Android, use the Android flavor. You can
find the Android Guava source in the [`android` directory].
* If you need support for Android, use the Android flavor. You can find the
Android Guava source in the [`android` directory].

[`android` directory]: https://github.com/google/guava/tree/master/android

## Adding Guava to your build

Guava's Maven group ID is `com.google.guava`, and its artifact ID is `guava`.
Guava provides two different "flavors": one for use on a (Java 8+) JRE and one
for use on Android or Java 7 or by any library that wants to be compatible with
either of those. These flavors are specified in the Maven version field as
either `30.1-jre` or `30.1-android`. For more about depending on Guava, see
for use on Android or by any library that wants to be compatible with Android.
These flavors are specified in the Maven version field as either `31.1-jre` or
`31.1-android`. For more about depending on Guava, see
[using Guava in your build].

To add a dependency on Guava using Maven, use the following:
Expand All @@ -32,9 +32,9 @@ To add a dependency on Guava using Maven, use the following:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1-jre</version>
<version>31.1-jre</version>
<!-- or, for Android: -->
<version>30.1-android</version>
<version>31.1-android</version>
</dependency>
```

Expand All @@ -45,16 +45,16 @@ dependencies {
// Pick one:
// 1. Use Guava in your implementation only:
implementation("com.google.guava:guava:30.1-jre")
implementation("com.google.guava:guava:31.1-jre")
// 2. Use Guava types in your public API:
api("com.google.guava:guava:30.1-jre")
api("com.google.guava:guava:31.1-jre")
// 3. Android - Use Guava in your implementation only:
implementation("com.google.guava:guava:30.1-android")
implementation("com.google.guava:guava:31.1-android")
// 4. Android - Use Guava types in your public API:
api("com.google.guava:guava:30.1-android")
api("com.google.guava:guava:31.1-android")
}
```

Expand Down Expand Up @@ -101,8 +101,10 @@ flavor.
plans to start removing things again, but officially, we're leaving our
options open in case of surprises (like, say, a serious security problem).

3. Guava has one dependency that is needed at runtime:
`com.google.guava:failureaccess:1.0.1`
3. Guava has one dependency that is needed for linkage at runtime:
`com.google.guava:failureaccess:1.0.1`. It also has
[some annotation-only dependencies][guava-deps], which we discuss in more
detail at that link.

4. Serialized forms of ALL objects are subject to change unless noted
otherwise. Do not persist these and assume they can be read by a future
Expand All @@ -111,10 +113,10 @@ flavor.
5. Our classes are not designed to protect against a malicious caller. You
should not use them for communication between trusted and untrusted code.

6. For the mainline flavor, we unit-test the libraries using only OpenJDK 1.8
on Linux. Some features, especially in `com.google.common.io`, may not work
correctly in other environments. For the Android flavor, our unit tests run
on API level 15 (Ice Cream Sandwich).
6. For the mainline flavor, we test the libraries using only OpenJDK 8 and
OpenJDK 11 on Linux. Some features, especially in `com.google.common.io`,
may not work correctly in other environments. For the Android flavor, our
unit tests also run on API level 15 (Ice Cream Sandwich).

[guava-snapshot-api-docs]: https://guava.dev/releases/snapshot-jre/api/docs/
[guava-snapshot-api-diffs]: https://guava.dev/releases/snapshot-jre/api/diffs/
Expand All @@ -125,3 +127,4 @@ flavor.

[using Guava in your build]: https://github.com/google/guava/wiki/UseGuavaInYourBuild
[repackage]: https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-if-i-want-to-use-beta-apis-from-a-library-that-people-use-as-a-dependency
[guava-deps]: https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies
2 changes: 1 addition & 1 deletion android/guava-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.google.guava</groupId>
<artifactId>guava-bom</artifactId>
<version>HEAD-android-SNAPSHOT</version>
<version>31.1-android</version>
<packaging>pom</packaging>

<parent>
Expand Down
6 changes: 1 addition & 5 deletions android/guava-testlib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.google.guava</groupId>
<artifactId>guava-parent</artifactId>
<version>HEAD-android-SNAPSHOT</version>
<version>31.1-android</version>
</parent>
<artifactId>guava-testlib</artifactId>
<name>Guava Testing Library</name>
Expand All @@ -18,10 +18,6 @@
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-compat-qual</artifactId>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected ArrayWithDuplicate<E> createArrayWithDuplicateElement() {
E[] elements = createSamplesArray();
E duplicate = elements[(elements.length / 2) - 1];
elements[(elements.length / 2) + 1] = duplicate;
return new ArrayWithDuplicate<E>(elements, duplicate);
return new ArrayWithDuplicate<>(elements, duplicate);
}

// Helper methods to improve readability of derived classes
Expand All @@ -211,7 +211,7 @@ protected Collection<E> getSampleElements() {
* requirement {@link com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER}.
*/
protected List<E> getOrderedElements() {
List<E> list = new ArrayList<E>();
List<E> list = new ArrayList<>();
for (E e : getSubjectGenerator().order(new ArrayList<E>(getSampleElements()))) {
list.add(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ protected void expectMissingValues(V... elements) {
/** @return an array of the proper size with {@code null} as the key of the middle element. */
protected Entry<K, V>[] createArrayWithNullKey() {
Entry<K, V>[] array = createSamplesArray();
final int nullKeyLocation = getNullLocation();
final Entry<K, V> oldEntry = array[nullKeyLocation];
int nullKeyLocation = getNullLocation();
Entry<K, V> oldEntry = array[nullKeyLocation];
array[nullKeyLocation] = entry(null, oldEntry.getValue());
return array;
}
Expand All @@ -97,8 +97,8 @@ private Entry<K, V> getEntryNullReplaces() {
/** @return an array of the proper size with {@code null} as the value of the middle element. */
protected Entry<K, V>[] createArrayWithNullValue() {
Entry<K, V>[] array = createSamplesArray();
final int nullValueLocation = getNullLocation();
final Entry<K, V> oldEntry = array[nullValueLocation];
int nullValueLocation = getNullLocation();
Entry<K, V> oldEntry = array[nullValueLocation];
array[nullValueLocation] = entry(oldEntry.getKey(), null);
return array;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ protected List<TestSuite> createDerivedSuites(
.named(getName() + " reserialized")
.withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
.createTestSuite());
}
return derivedSuites;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public static class MapKeySetGenerator<K, V> implements TestSetGenerator<K>, Der

public MapKeySetGenerator(OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> mapGenerator) {
this.mapGenerator = mapGenerator;
final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples();
SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples();
this.samples =
new SampleElements<K>(
new SampleElements<>(
mapSamples.e0().getKey(),
mapSamples.e1().getKey(),
mapSamples.e2().getKey(),
Expand Down Expand Up @@ -203,9 +203,9 @@ public static class MapValueCollectionGenerator<K, V>
public MapValueCollectionGenerator(
OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> mapGenerator) {
this.mapGenerator = mapGenerator;
final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples();
SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples();
this.samples =
new SampleElements<V>(
new SampleElements<>(
mapSamples.e0().getValue(),
mapSamples.e1().getValue(),
mapSamples.e2().getValue(),
Expand Down Expand Up @@ -239,14 +239,13 @@ public Collection<V> create(Object... elements) {
@Override
public V[] createArray(int length) {
// noinspection UnnecessaryLocalVariable
final V[] vs =
((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length);
V[] vs = ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length);
return vs;
}

@Override
public Iterable<V> order(List<V> insertionOrder) {
final List<Entry<K, V>> orderedEntries =
List<Entry<K, V>> orderedEntries =
castOrCopyToList(mapGenerator.order(castOrCopyToList(mapGenerator.getSampleElements(5))));
sort(
insertionOrder,
Expand Down
Loading

0 comments on commit 8be42dd

Please sign in to comment.