Skip to content

Commit e8750e8

Browse files
authored
Merge pull request #1 from google/master
更新local
2 parents 9e4e0e1 + 0cd4e9f commit e8750e8

File tree

497 files changed

+3196
-3275
lines changed

Some content is hidden

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

497 files changed

+3196
-3275
lines changed

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Guava: Google Core Libraries for Java
22

3+
[![Latest release](https://img.shields.io/github/release/google/guava.svg)](https://github.com/google/guava/releases/latest)
34
[![Build Status](https://travis-ci.org/google/guava.svg?branch=master)](https://travis-ci.org/google/guava)
4-
[![Maven Central](https://img.shields.io/maven-central/v/com.google.guava/guava.svg)](https://mvnrepository.com/artifact/com.google.guava/guava/latest)
55

66
Guava is a set of core libraries that includes new collection types (such as
77
multimap and multiset), immutable collections, a graph library, functional
@@ -16,37 +16,37 @@ Guava comes in two flavors.
1616

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

19-
## Latest release
19+
## Adding Guava to your build
2020

21-
The most recent release is [Guava 24.1][current release], released 2018-03-14.
22-
23-
The Maven group ID is `com.google.guava`, and the artifact ID is `guava`. Use
24-
version `24.1-jre` for the JRE flavor, or `24.1-android` for the Android flavor.
21+
Guava's Maven group ID is `com.google.guava` and its artifact ID is `guava`.
22+
Guava provides two different "flavors": one for use on a (Java 8+) JRE and one
23+
for use on Android or Java 7 or by any library that wants to be compatible with
24+
either of those. These flavors are specified in the Maven version field as
25+
either `25.1-jre` or `25.1-android`. For more about depending on
26+
Guava, see [using Guava in your build].
2527

2628
To add a dependency on Guava using Maven, use the following:
2729

2830
```xml
2931
<dependency>
3032
<groupId>com.google.guava</groupId>
3133
<artifactId>guava</artifactId>
32-
<version>24.1-jre</version>
34+
<version>25.1-jre</version>
3335
<!-- or, for Android: -->
34-
<version>24.1-android</version>
36+
<version>25.1-android</version>
3537
</dependency>
3638
```
3739

3840
To add a dependency using Gradle:
3941

4042
```
4143
dependencies {
42-
compile 'com.google.guava:guava:24.1-jre'
44+
compile 'com.google.guava:guava:25.1-jre'
4345
// or, for Android:
44-
compile 'com.google.guava:guava:24.1-android'
46+
api 'com.google.guava:guava:25.1-android'
4547
}
4648
```
4749

48-
For more about depending on Guava, see [Using Guava in your build].
49-
5050
## Snapshots
5151

5252
Snapshots of Guava built from the `master` branch are available through Maven
@@ -98,14 +98,13 @@ Linux. Some features, especially in `com.google.common.io`, may not work
9898
correctly in other environments. For the Android flavor, our unit tests run on
9999
API level 15 (Ice Cream Sandwich).
100100

101-
[current release]: https://github.com/google/guava/releases/tag/v24.1
102-
[guava-snapshot-api-docs]: http://google.github.io/guava/releases/snapshot-jre/api/docs/
103-
[guava-snapshot-api-diffs]: http://google.github.io/guava/releases/snapshot-jre/api/diffs/
101+
[guava-snapshot-api-docs]: https://google.github.io/guava/releases/snapshot-jre/api/docs/
102+
[guava-snapshot-api-diffs]: https://google.github.io/guava/releases/snapshot-jre/api/diffs/
104103
[Guava Explained]: https://github.com/google/guava/wiki/Home
105104
[Guava Beta Checker]: https://github.com/google/guava-beta-checker
106105

107106
<!-- References -->
108107

109-
[Using Guava in your build]: https://github.com/google/guava/wiki/UseGuavaInYourBuild
108+
[using Guava in your build]: https://github.com/google/guava/wiki/UseGuavaInYourBuild
110109
[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
111110

android/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java

100755100644
File mode changed.

android/guava-testlib/src/com/google/common/escape/testing/package-info.java

100755100644
File mode changed.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ private static <T> T invoke(Invokable<?, ? extends T> factory, List<?> args)
767767
T returnValue = factory.invoke(null, args.toArray());
768768
if (returnValue == null) {
769769
Assert.assertTrue(
770-
factory + " returns null but it's not annotated with @NullableDecl", isNullable(factory));
770+
factory + " returns null but it's not annotated with @Nullable", isNullable(factory));
771771
}
772772
return returnValue;
773773
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* <p>Here's an example that uses a user-defined finalization predicate:
6767
*
6868
* <pre>{@code
69-
* final WeakHashMap<Object, Object> map = new WeakHashMap<Object, Object>();
69+
* final WeakHashMap<Object, Object> map = new WeakHashMap<>();
7070
* map.put(new Object(), Boolean.TRUE);
7171
* GcFinalization.awaitDone(new FinalizationPredicate() {
7272
* public boolean isDone() {
@@ -82,7 +82,7 @@
8282
* // Helper function keeps victim stack-unreachable.
8383
* private WeakReference<Foo> fooWeakRef() {
8484
* Foo x = ....;
85-
* WeakReference<Foo> weakRef = new WeakReference<Foo>(x);
85+
* WeakReference<Foo> weakRef = new WeakReference<>(x);
8686
* // ... use x ...
8787
* x = null; // Hint to the JIT that x is stack-unreachable
8888
* return weakRef;

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@
5252
/**
5353
* A test utility that verifies that your methods and constructors throw {@link
5454
* NullPointerException} or {@link UnsupportedOperationException} whenever null is passed to a
55-
* parameter that isn't annotated with {@link javax.annotation.Nullable}, {@link
56-
* javax.annotation.CheckForNull}, or {@link
57-
* org.checkerframework.checker.nullness.compatqual.NullableDecl}.
55+
* parameter that isn't annotated with an annotation with the simple name {@code Nullable}, {@lcode
56+
* CheckForNull}, {@link NullableType}, or {@link NullableDecl}.
5857
*
5958
* <p>The tested methods and constructors are invoked -- each time with one parameter being null and
6059
* the rest not null -- and the test fails if no expected exception is thrown. {@code
@@ -474,15 +473,12 @@ static boolean isPrimitiveOrNullable(Parameter param) {
474473
return param.getType().getRawType().isPrimitive() || isNullable(param);
475474
}
476475

477-
private static final ImmutableSet<String> NULLABLE_ANNOTATIONS =
478-
ImmutableSet.of(
479-
"javax.annotation.CheckForNull",
480-
"javax.annotation.Nullable",
481-
"org.checkerframework.checker.nullness.compatqual.NullableDecl");
476+
private static final ImmutableSet<String> NULLABLE_ANNOTATION_SIMPLE_NAMES =
477+
ImmutableSet.of("CheckForNull", "Nullable", "NullableDecl", "NullableType");
482478

483479
static boolean isNullable(AnnotatedElement e) {
484480
for (Annotation annotation : e.getAnnotations()) {
485-
if (NULLABLE_ANNOTATIONS.contains(annotation.annotationType().getName())) {
481+
if (NULLABLE_ANNOTATION_SIMPLE_NAMES.contains(annotation.annotationType().getSimpleName())) {
486482
return true;
487483
}
488484
}

android/guava-testlib/test/com/google/common/testing/ClassSanityTesterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ public void testInstantiate_factoryMethodReturnsNullButNotAnnotated() throws Exc
477477
try {
478478
tester.instantiate(FactoryMethodReturnsNullButNotAnnotated.class);
479479
} catch (AssertionFailedError expected) {
480-
assertThat(expected.getMessage()).contains("@NullableDecl");
480+
assertThat(expected.getMessage()).contains("@Nullable");
481481
return;
482482
}
483483
fail("should have failed");

android/guava-testlib/test/com/google/common/testing/NullPointerTesterTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public static void staticOneArgCheckForNullCorrectlyDoesNotThrowNPE(
8585
// null? no problem
8686
}
8787

88-
public static void staticOneArgJsr305NullableCorrectlyDoesNotThrowNPE(
89-
@javax.annotation.Nullable String s) {
88+
public static void staticOneArgJsr305NullableCorrectlyDoesNotThrowNPE(@NullableDecl String s) {
9089
// null? no problem
9190
}
9291

@@ -498,7 +497,7 @@ public void twoMixedArgsThrows(@NullableDecl Integer i, String s) {
498497
doThrow(i);
499498
}
500499

501-
public void twoNullableArgs(@NullableDecl String s, @javax.annotation.Nullable Integer i) {}
500+
public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) {}
502501

503502
public void twoNullableArgsThrowsFirstArg(@NullableDecl String s, @NullableDecl Integer i) {
504503
doThrow(s);

android/guava-tests/benchmark/com/google/common/base/WhitespaceMatcherBenchmark.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.caliper.BeforeExperiment;
2020
import com.google.caliper.Benchmark;
2121
import com.google.caliper.Param;
22-
import com.google.caliper.runner.CaliperMain;
2322
import java.util.BitSet;
2423
import java.util.Random;
2524

@@ -51,10 +50,6 @@ public boolean matches(char c) {
5150
private String teststring;
5251
private CharMatcher matcher;
5352

54-
public static void main(String[] args) throws Exception {
55-
CaliperMain.main(WhitespaceMatcherBenchmark.class, new String[] {});
56-
}
57-
5853
@BeforeExperiment
5954
protected void setUp() {
6055
BitSet bitSet = new BitSet();

android/guava-tests/benchmark/com/google/common/eventbus/EventBusBenchmark.java

100755100644
File mode changed.

0 commit comments

Comments
 (0)