diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameter.java b/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameter.java
index bca48066a80d..4354141414bf 100644
--- a/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameter.java
+++ b/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameter.java
@@ -248,7 +248,9 @@ private boolean enclosingAnnotationDefaultsNonTypeVariablesToNonNull(
if (hasAnnotation(sym, "com.google.protobuf.Internal$ProtoNonnullApi", state)) {
return true;
}
- if (hasAnnotation(sym, "org.jspecify.nullness.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;
}
diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessUtils.java b/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessUtils.java
index 90f8ce83125b..e1dbc7e815fb 100644
--- a/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessUtils.java
+++ b/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessUtils.java
@@ -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.nullness.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;
}
}
@@ -353,7 +355,7 @@ private static NullableAnnotationToUse pickNullableAnnotation(VisitorState state
.orElse(
state.isAndroidCompatible()
? "androidx.annotation.Nullable"
- : "org.jspecify.nullness.Nullable");
+ : "org.jspecify.annotations.Nullable");
if (sym != null) {
ClassSymbol classSym = (ClassSymbol) sym;
if (classSym.isAnnotationType()) {
@@ -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.nullness.NonNull":
- case "org.jspecify.nullness.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?
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/NullableOptionalTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/NullableOptionalTest.java
index 8da09a598abf..f4e5ff320b4d 100644
--- a/core/src/test/java/com/google/errorprone/bugpatterns/NullableOptionalTest.java
+++ b/core/src/test/java/com/google/errorprone/bugpatterns/NullableOptionalTest.java
@@ -79,7 +79,7 @@ public void methodReturnsOptionalWithAnotherNullableAnnotation_showsError() {
.addSourceLines(
"Test.java",
"import java.util.Optional;",
- "import org.jspecify.nullness.Nullable;",
+ "import org.jspecify.annotations.Nullable;",
"final class Test {",
" @Nullable",
" // BUG: Diagnostic contains:",
@@ -136,7 +136,7 @@ public void methodReturnsNonOptionalWithAnotherNullableAnnotation_noError() {
compilationHelper
.addSourceLines(
"Test.java",
- "import org.jspecify.nullness.Nullable;",
+ "import org.jspecify.annotations.Nullable;",
"final class Test {",
" @Nullable",
" private Object foo() {",
@@ -151,7 +151,7 @@ public void methodHasNullableNonOptionalAsParameter_noError() {
compilationHelper
.addSourceLines(
"Test.java",
- "import org.jspecify.nullness.Nullable;",
+ "import org.jspecify.annotations.Nullable;",
"final class Test {",
" private void foo(@Nullable Object object) {}",
"}")
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsMissingNullableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsMissingNullableTest.java
index f1eb363284ed..ce01e9f80396 100644
--- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsMissingNullableTest.java
+++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/EqualsMissingNullableTest.java
@@ -125,7 +125,7 @@ public void positiveConservativeNullMarked() {
conservativeHelper
.addSourceLines(
"Foo.java",
- "import org.jspecify.nullness.NullMarked;",
+ "import org.jspecify.annotations.NullMarked;",
"@NullMarked",
"abstract class Foo {",
" // BUG: Diagnostic contains: @Nullable",
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/FieldMissingNullableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/FieldMissingNullableTest.java
index 651d854e6f01..49f85147d761 100644
--- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/FieldMissingNullableTest.java
+++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/FieldMissingNullableTest.java
@@ -457,7 +457,7 @@ public void nonAnnotationNullable() {
.addOutputLines(
"out/Test.java",
"class T {",
- " private final @org.jspecify.nullness.Nullable Object obj2 = null;",
+ " private final @org.jspecify.annotations.Nullable Object obj2 = null;",
" class Nullable {}",
"}")
.doTest();
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameterTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameterTest.java
index 362cb5578088..8718f94aeae0 100644
--- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameterTest.java
+++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/NullArgumentForNonNullParameterTest.java
@@ -177,7 +177,7 @@ public void positiveNullMarkedOtherPackageAggressive() {
aggressiveHelper
.addSourceLines(
"Foo.java",
- "import org.jspecify.nullness.NullMarked;",
+ "import org.jspecify.annotations.NullMarked;",
"@NullMarked",
"class Foo {",
" void consume(String s) {}",
@@ -194,7 +194,7 @@ public void negativeNullMarkedNonComGoogleCommonPackageConservative() {
conservativeHelper
.addSourceLines(
"Foo.java",
- "import org.jspecify.nullness.NullMarked;",
+ "import org.jspecify.annotations.NullMarked;",
"@NullMarked",
"class Foo {",
" void consume(String s) {}",
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullableTest.java
index 77a756d17f0c..fb85ffc548ef 100644
--- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullableTest.java
+++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullableTest.java
@@ -840,7 +840,7 @@ public void removeSuppressWarnings_removeNullnessReturnWarning() {
.addOutputLines(
"com/google/errorprone/bugpatterns/nullness/LiteralNullReturnTest.java",
"package com.google.errorprone.bugpatterns.nullness;",
- "import org.jspecify.nullness.Nullable;",
+ "import org.jspecify.annotations.Nullable;",
"public class LiteralNullReturnTest {",
"",
" public @Nullable String getMessage(boolean b) {",
@@ -1689,8 +1689,8 @@ public void nonAnnotationNullable() {
.addOutputLines(
"out/Test.java",
"class T {",
- " @org.jspecify.nullness.Nullable private final Object method(boolean b) { return b ?"
- + " null : 0; }",
+ " @org.jspecify.annotations.Nullable private final Object method(boolean b) { return b"
+ + " ? null : 0; }",
" class Nullable {}",
"}")
.doTest();
@@ -1712,7 +1712,7 @@ public void multipleNullReturns() {
"}")
.addOutputLines(
"out/Test.java",
- "import org.jspecify.nullness.Nullable;",
+ "import org.jspecify.annotations.Nullable;",
"class T {",
" private final @Nullable Object method(boolean b) {",
" if (b) {",
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/VoidMissingNullableTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/VoidMissingNullableTest.java
index 749c88f9bf64..8cf45b61b605 100644
--- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/VoidMissingNullableTest.java
+++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/VoidMissingNullableTest.java
@@ -334,7 +334,7 @@ public void positiveConservativeNullMarked() {
.addSourceLines(
"Test.java",
"import javax.annotation.Nullable;",
- "import org.jspecify.nullness.NullMarked;",
+ "import org.jspecify.annotations.NullMarked;",
"@NullMarked",
"class Test {",
" // BUG: Diagnostic contains: @Nullable",
diff --git a/pom.xml b/pom.xml
index 248c8b26c22b..c6501498e517 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
1.6.13
3.19.6
1.43.3
- 0.2.0
+ 0.3.0
5.1.0