Skip to content

Commit d292289

Browse files
Merge branch 'master' into feature/remove_beta_annotation_from_HashingInputStream
2 parents 6a8e275 + b0cc461 commit d292289

File tree

816 files changed

+5244
-3440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

816 files changed

+5244
-3440
lines changed

.github/workflows/ci.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
steps:
2828
# Cancel any previous runs for the same branch that are still running.
2929
- name: 'Cancel previous runs'
30-
uses: styfle/cancel-workflow-action@0.11.0
30+
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5
3131
with:
3232
access_token: ${{ github.token }}
3333
- name: 'Check out repository'
34-
uses: actions/checkout@v3
34+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
3535
- name: 'Set up JDK ${{ matrix.java }}'
36-
uses: actions/setup-java@v3.6.0
36+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
3737

3838
with:
3939
java-version: ${{ matrix.java }}
@@ -58,9 +58,9 @@ jobs:
5858
runs-on: ubuntu-latest
5959
steps:
6060
- name: 'Check out repository'
61-
uses: actions/checkout@v3
61+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
6262
- name: 'Set up JDK 11'
63-
uses: actions/setup-java@v3.6.0
63+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
6464

6565
with:
6666
java-version: 11
@@ -84,9 +84,9 @@ jobs:
8484
runs-on: ubuntu-latest
8585
steps:
8686
- name: 'Check out repository'
87-
uses: actions/checkout@v3
87+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
8888
- name: 'Set up JDK 11'
89-
uses: actions/setup-java@v3.6.0
89+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
9090

9191
with:
9292
java-version: 11

.github/workflows/scorecard.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '45 9 * * 0'
14+
push:
15+
branches: [ "master" ]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: ubuntu-latest
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
# Uncomment the permissions below if installing in a private repository.
30+
# contents: read
31+
# actions: read
32+
33+
steps:
34+
- name: "Checkout code"
35+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
36+
with:
37+
persist-credentials: false
38+
39+
- name: "Run analysis"
40+
uses: ossf/scorecard-action@80e868c13c90f172d68d1f4501dee99e2479f7af # v2.1.3
41+
with:
42+
results_file: results.sarif
43+
results_format: sarif
44+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
45+
# - you want to enable the Branch-Protection check on a *public* repository, or
46+
# - you are installing Scorecard on a *private* repository
47+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
48+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
49+
50+
# Public repositories:
51+
# - Publish results to OpenSSF REST API for easy access by consumers
52+
# - Allows the repository to include the Scorecard badge.
53+
# - See https://github.com/ossf/scorecard-action#publishing-results.
54+
# For private repositories:
55+
# - `publish_results` will always be set to `false`, regardless
56+
# of the value entered here.
57+
publish_results: true
58+
59+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
60+
# format to the repository Actions tab.
61+
- name: "Upload artifact"
62+
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
63+
with:
64+
name: SARIF file
65+
path: results.sarif
66+
retention-days: 5
67+
68+
# Upload the results to GitHub's code scanning dashboard.
69+
- name: "Upload to code-scanning"
70+
uses: github/codeql-action/upload-sarif@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
71+
with:
72+
sarif_file: results.sarif

COPYING LICENSE

File renamed without changes.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Latest release](https://img.shields.io/github/release/google/guava.svg)](https://github.com/google/guava/releases/latest)
44
[![Build Status](https://github.com/google/guava/workflows/CI/badge.svg?branch=master)](https://github.com/google/guava/actions)
5+
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7197/badge)](https://bestpractices.coreinfrastructure.org/projects/7197)
56

67
Guava is a set of core Java libraries from Google that includes new collection types
78
(such as multimap and multiset), immutable collections, a graph library, and

android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Set;
3232
import java.util.Stack;
3333
import junit.framework.AssertionFailedError;
34+
import org.checkerframework.checker.nullness.qual.Nullable;
3435

3536
/**
3637
* Most of the logic for {@link IteratorTester} and {@link ListIteratorTester}.
@@ -148,7 +149,7 @@ protected final class MultiExceptionListIterator implements ListIterator<E> {
148149
* this to determine which stack to pop from on a call to {@code remove()} (or to pop from and
149150
* push to on a call to {@code set()}).
150151
*/
151-
Stack<E> stackWithLastReturnedElementAtTop = null;
152+
@Nullable Stack<E> stackWithLastReturnedElementAtTop = null;
152153

153154
MultiExceptionListIterator(List<E> expectedElements) {
154155
Helpers.addAll(nextElements, Helpers.reverse(expectedElements));
@@ -363,7 +364,7 @@ private static List<Object> subListCopy(Object[] source, int size) {
363364
}
364365

365366
private interface IteratorOperation {
366-
Object execute(Iterator<?> iterator);
367+
@Nullable Object execute(Iterator<?> iterator);
367368
}
368369

369370
/**
@@ -449,7 +450,7 @@ private <T extends Iterator<E>> void internalExecuteAndCompare(
449450
private static final IteratorOperation REMOVE_METHOD =
450451
new IteratorOperation() {
451452
@Override
452-
public Object execute(Iterator<?> iterator) {
453+
public @Nullable Object execute(Iterator<?> iterator) {
453454
iterator.remove();
454455
return null;
455456
}
@@ -475,7 +476,7 @@ private final IteratorOperation newAddMethod() {
475476
final Object toInsert = elementsToInsert.next();
476477
return new IteratorOperation() {
477478
@Override
478-
public Object execute(Iterator<?> iterator) {
479+
public @Nullable Object execute(Iterator<?> iterator) {
479480
@SuppressWarnings("unchecked")
480481
ListIterator<Object> rawIterator = (ListIterator<Object>) iterator;
481482
rawIterator.add(toInsert);
@@ -488,7 +489,7 @@ private final IteratorOperation newSetMethod() {
488489
final E toInsert = elementsToInsert.next();
489490
return new IteratorOperation() {
490491
@Override
491-
public Object execute(Iterator<?> iterator) {
492+
public @Nullable Object execute(Iterator<?> iterator) {
492493
@SuppressWarnings("unchecked")
493494
ListIterator<E> li = (ListIterator<E>) iterator;
494495
li.set(toInsert);

android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.ListIterator;
2424
import java.util.Map;
2525
import java.util.Map.Entry;
26+
import org.checkerframework.checker.nullness.qual.Nullable;
2627
import org.junit.Ignore;
2728

2829
/**
@@ -167,7 +168,7 @@ protected void expectMissing(Entry<K, V>... entries) {
167168
}
168169
}
169170

170-
private static boolean equal(Object a, Object b) {
171+
private static boolean equal(@Nullable Object a, @Nullable Object b) {
171172
return a == b || (a != null && a.equals(b));
172173
}
173174

android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.google.common.annotations.GwtCompatible;
2020
import junit.framework.TestCase;
21+
import org.checkerframework.checker.nullness.qual.Nullable;
2122

2223
/**
2324
* This abstract base class for testers allows the framework to inject needed information after
@@ -34,8 +35,8 @@
3435
public class AbstractTester<G> extends TestCase {
3536
private G subjectGenerator;
3637
private String suiteName;
37-
private Runnable setUp;
38-
private Runnable tearDown;
38+
private @Nullable Runnable setUp;
39+
private @Nullable Runnable tearDown;
3940

4041
// public so that it can be referenced in generated GWT tests.
4142
@Override
@@ -54,7 +55,8 @@ public void tearDown() throws Exception {
5455
}
5556

5657
// public so that it can be referenced in generated GWT tests.
57-
public final void init(G subjectGenerator, String suiteName, Runnable setUp, Runnable tearDown) {
58+
public final void init(
59+
G subjectGenerator, String suiteName, @Nullable Runnable setUp, @Nullable Runnable tearDown) {
5860
this.subjectGenerator = subjectGenerator;
5961
this.suiteName = suiteName;
6062
this.setUp = setUp;

android/guava-testlib/src/com/google/common/collect/testing/BaseComparable.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.google.common.annotations.GwtCompatible;
2020
import java.io.Serializable;
21+
import org.checkerframework.checker.nullness.qual.Nullable;
2122

2223
/**
2324
* Simple base class to verify that we handle generics correctly.
@@ -38,7 +39,7 @@ public int hashCode() { // delegate to 's'
3839
}
3940

4041
@Override
41-
public boolean equals(Object other) {
42+
public boolean equals(@Nullable Object other) {
4243
if (other == null) {
4344
return false;
4445
} else if (other instanceof BaseComparable) {

android/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import junit.framework.Test;
4040
import junit.framework.TestCase;
4141
import junit.framework.TestSuite;
42+
import org.checkerframework.checker.nullness.qual.Nullable;
4243

4344
/**
4445
* Creates, based on your criteria, a JUnit test suite that exhaustively tests the object generated
@@ -62,7 +63,7 @@ protected B self() {
6263

6364
// Test Data
6465

65-
private G subjectGenerator;
66+
private @Nullable G subjectGenerator;
6667
// Gets run before every test.
6768
private Runnable setUp;
6869
// Gets run at the conclusion of every test.
@@ -125,7 +126,7 @@ public Set<Feature<?>> getFeatures() {
125126

126127
// Name
127128

128-
private String name;
129+
private @Nullable String name;
129130

130131
/** Configures this builder produce a TestSuite with the given name. */
131132
@CanIgnoreReturnValue

android/guava-testlib/src/com/google/common/collect/testing/Helpers.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@
4040
import java.util.Set;
4141
import junit.framework.Assert;
4242
import junit.framework.AssertionFailedError;
43+
import org.checkerframework.checker.nullness.qual.Nullable;
4344

4445
@GwtCompatible(emulated = true)
4546
public class Helpers {
4647
// Clone of Objects.equal
47-
static boolean equal(Object a, Object b) {
48+
static boolean equal(@Nullable Object a, @Nullable Object b) {
4849
return a == b || (a != null && a.equals(b));
4950
}
5051

@@ -253,7 +254,7 @@ static void fail(Throwable cause, Object message) {
253254
}
254255

255256
public static <K, V> Comparator<Entry<K, V>> entryComparator(
256-
Comparator<? super K> keyComparator) {
257+
@Nullable Comparator<? super K> keyComparator) {
257258
return new Comparator<Entry<K, V>>() {
258259
@Override
259260
@SuppressWarnings("unchecked") // no less safe than putting it in the map!
@@ -384,7 +385,7 @@ public V setValue(V value) {
384385

385386
@SuppressWarnings("unchecked")
386387
@Override
387-
public boolean equals(Object o) {
388+
public boolean equals(@Nullable Object o) {
388389
if (o instanceof Entry) {
389390
Entry<K, V> e = (Entry<K, V>) o;
390391
e.setValue(value); // muhahaha!
@@ -462,7 +463,7 @@ protected NullsBefore(String justAfterNull) {
462463
}
463464

464465
@Override
465-
public int compare(String lhs, String rhs) {
466+
public int compare(@Nullable String lhs, @Nullable String rhs) {
466467
if (lhs == rhs) {
467468
return 0;
468469
}
@@ -486,7 +487,7 @@ public int compare(String lhs, String rhs) {
486487
}
487488

488489
@Override
489-
public boolean equals(Object obj) {
490+
public boolean equals(@Nullable Object obj) {
490491
if (obj instanceof NullsBefore) {
491492
NullsBefore other = (NullsBefore) obj;
492493
return justAfterNull.equals(other.justAfterNull);

android/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Arrays;
2121
import java.util.Collection;
2222
import java.util.Iterator;
23+
import org.checkerframework.checker.nullness.qual.Nullable;
2324

2425
/**
2526
* An implementation of {@code Iterable} which throws an exception on all invocations of the {@link
@@ -63,7 +64,7 @@ public static <E> MinimalIterable<E> from(Collection<E> elements) {
6364
return (MinimalIterable) of(elements.toArray());
6465
}
6566

66-
private Iterator<E> iterator;
67+
private @Nullable Iterator<E> iterator;
6768

6869
private MinimalIterable(Iterator<E> iterator) {
6970
this.iterator = iterator;

android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.Collection;
2323
import java.util.List;
2424
import java.util.Set;
25+
import org.checkerframework.checker.nullness.qual.Nullable;
2526

2627
/**
2728
* A simplistic set which implements the bare minimum so that it can be used in tests without
@@ -63,7 +64,7 @@ private MinimalSet(Class<? super E> type, E... contents) {
6364
*/
6465

6566
@Override
66-
public boolean equals(Object object) {
67+
public boolean equals(@Nullable Object object) {
6768
if (object instanceof Set) {
6869
Set<?> that = (Set<?>) object;
6970
return (this.size() == that.size()) && this.containsAll(that);

0 commit comments

Comments
 (0)