File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ private CharSequenceRules() {}
1919 // below.
2020 static final class CharSequenceIsEmpty {
2121 @ BeforeTemplate
22+ @ SuppressWarnings ("java:S7158" /* This violation will be rewritten. */ )
2223 boolean before (CharSequence charSequence ) {
2324 return Refaster .anyOf (
2425 charSequence .length () == 0 , charSequence .length () <= 0 , charSequence .length () < 1 );
Original file line number Diff line number Diff line change 1313import com .google .errorprone .refaster .annotation .BeforeTemplate ;
1414import com .google .errorprone .refaster .annotation .UseImportPolicy ;
1515import java .util .Objects ;
16+ import org .jspecify .annotations .Nullable ;
1617import tech .picnic .errorprone .refaster .annotation .OnlineDocumentation ;
1718
1819/** Refaster templates related to statements dealing with {@link Preconditions}. */
@@ -89,7 +90,7 @@ T after(T object) {
8990 }
9091
9192 /** Prefer {@link Objects#requireNonNull(Object)} over more verbose alternatives. */
92- static final class RequireNonNullStatement <T > {
93+ static final class RequireNonNullStatement <T extends @ Nullable Object > {
9394 @ BeforeTemplate
9495 @ SuppressWarnings ("java:S1695" /* This violation will be rewritten. */ )
9596 void before (T object ) {
@@ -120,7 +121,7 @@ T after(T object, String message) {
120121 }
121122
122123 /** Prefer {@link Objects#requireNonNull(Object, String)} over more verbose alternatives. */
123- static final class RequireNonNullWithMessageStatement <T > {
124+ static final class RequireNonNullWithMessageStatement <T extends @ Nullable Object > {
124125 @ BeforeTemplate
125126 @ SuppressWarnings ("java:S1695" /* This violation will be rewritten. */ )
126127 void before (T object , String message ) {
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ private StringRules() {}
3434 */
3535 static final class EmptyString {
3636 @ BeforeTemplate
37+ @ SuppressWarnings ("java:S2129" /* This violation will be rewritten. */ )
3738 String before () {
3839 return Refaster .anyOf (
3940 new String (),
@@ -54,6 +55,7 @@ String after() {
5455 // instead of this Refaster rule.
5556 static final class StringIdentity {
5657 @ BeforeTemplate
58+ @ SuppressWarnings ("java:S2129" /* This violation will be rewritten. */ )
5759 String before (String str ) {
5860 return new String (str );
5961 }
@@ -72,7 +74,11 @@ String after(String str) {
7274 // rule selection based on some annotation, or a separate Maven module.
7375 static final class StringIsEmpty {
7476 @ BeforeTemplate
75- @ SuppressWarnings ("CharSequenceIsEmpty" /* This is a more specific template. */ )
77+ @ SuppressWarnings ({
78+ "CharSequenceIsEmpty" /* This is a more specific template. */ ,
79+ "java:S7158" /* This violation will be rewritten. */ ,
80+ "key-to-resolve-AnnotationUseStyle-and-TrailingComment-check-conflict"
81+ })
7682 boolean before (String str ) {
7783 return Refaster .anyOf (str .length () == 0 , str .length () <= 0 , str .length () < 1 );
7884 }
You can’t perform that action at this time.
0 commit comments