Skip to content

Commit

Permalink
Adapt to CF's type argument inference improvements. (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
smillst authored Dec 18, 2023
1 parent 68e7ba4 commit ab472b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions guava/src/com/google/common/io/ByteSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ public boolean isEmpty() throws IOException {
}

@Override
@SuppressWarnings("value:return") // off is at most equal to unslicedSize and length is non-negative
@SuppressWarnings({
// off is at most equal to unslicedSize and length is non-negative.
"value:return",
// poly + inference problem.
"type.arguments.not.inferred"})
public Optional<@NonNegative Long> sizeIfKnown() {
Optional<@NonNegative Long> optionalUnslicedSize = ByteSource.this.sizeIfKnown();
if (optionalUnslicedSize.isPresent()) {
Expand Down Expand Up @@ -708,7 +712,7 @@ public boolean isEmpty() throws IOException {
}

@Override
@SuppressWarnings("value:return") // Long.MAX_VALUE is non-negative
@SuppressWarnings("value:type.arguments.not.inferred") // Long.MAX_VALUE is non-negative
public Optional<@NonNegative Long> sizeIfKnown() {
if (!(sources instanceof Collection)) {
// Infinite Iterables can cause problems here. Of course, it's true that most of the other
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- Override this with -Dtest.include="**/SomeTest.java" on the CLI -->
<test.include>%regex[.*.class]</test.include>
<truth.version>1.1.2</truth.version>
<checker-framework.version>3.41.0</checker-framework.version>
<checker-framework.version>3.43.0-SNAPSHOT</checker-framework.version>
<animal.sniffer.version>1.20</animal.sniffer.version>
<maven-javadoc-plugin.version>3.1.0</maven-javadoc-plugin.version>
<!-- Empty for all JDKs but 9-12 -->
Expand Down Expand Up @@ -255,6 +255,14 @@
<url>scp://dummy.server/dontinstall/usestaging</url>
</site>
</distributionManagement>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
Expand Down

0 comments on commit ab472b3

Please sign in to comment.