Skip to content

Commit

Permalink
Upgrade JSpecify 0.2.0 -> 0.3.0
Browse files Browse the repository at this point in the history
The removed `org.jspecify.nullness` package is still supported where
possible, but `NullnessUtils#pickNullableAnnotation` now falls back to
suggesting `org.jspecify.annotations.Nullable`.

See:
- https://github.com/jspecify/jspecify/releases/tag/v0.3.0-alpha-1
- https://github.com/jspecify/jspecify/releases/tag/v0.3.0-alpha-2
- https://github.com/jspecify/jspecify/releases/tag/v0.3.0-alpha-3
- https://github.com/jspecify/jspecify/releases/tag/v0.3.0
- jspecify/jspecify@v0.2.0...v0.3.0

Fixes #4059

RELNOTES=n/a
PiperOrigin-RevId: 563128686
  • Loading branch information
Stephan202 authored and Error Prone Team committed Sep 6, 2023
1 parent 83ce08c commit 2fea215
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ private boolean enclosingAnnotationDefaultsNonTypeVariablesToNonNull(
if (hasAnnotation(sym, "com.google.protobuf.Internal$ProtoNonnullApi", state)) {
return true;
}
if (hasAnnotation(sym, "org.jspecify.annotations.NullMarked", state)
if ((hasAnnotation(sym, "org.jspecify.annotations.NullMarked", state)
// We break this string to avoid having it rewritten by Copybara.
|| hasAnnotation(sym, "org.jspecify.null" + "ness.NullMarked", state))
&& weTrustNullMarkedOn(sym, state)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ static boolean nullnessChecksShouldBeConservative(ErrorProneFlags flags) {

static boolean isInNullMarkedScope(Symbol sym, VisitorState state) {
for (; sym != null; sym = sym.getEnclosingElement()) {
if (hasAnnotation(sym, "org.jspecify.annotations.NullMarked", state)) {
if (hasAnnotation(sym, "org.jspecify.annotations.NullMarked", state)
// We break this string to avoid having it rewritten by Copybara.
|| hasAnnotation(sym, "org.jspecify.null" + "ness.NullMarked", state)) {
return true;
}
}
Expand Down Expand Up @@ -381,8 +383,9 @@ private static boolean isTypeUse(String className) {
case "org.checkerframework.checker.nullness.qual.Nullable":
case "org.jspecify.annotations.NonNull":
case "org.jspecify.annotations.Nullable":
case "org.jspecify.annotations.NonNull":
case "org.jspecify.annotations.Nullable":
// We break these strings to avoid having them rewritten by Copybara.
case "org.jspecify.null" + "ness.NonNull":
case "org.jspecify.null" + "ness.Nullable":
return true;
default:
// TODO(cpovirk): Detect type-use-ness from the class symbol if it's available?
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
<protobuf.version>3.19.6</protobuf.version>
<grpc.version>1.43.3</grpc.version>
<jspecify.version>0.2.0</jspecify.version>
<jspecify.version>0.3.0</jspecify.version>
<guice.version>5.1.0</guice.version>
</properties>

Expand Down

0 comments on commit 2fea215

Please sign in to comment.