Skip to content

Commit

Permalink
Bump the source version of org.apache.maven.plugins up to 17.
Browse files Browse the repository at this point in the history
(Will it be this simple?)

PiperOrigin-RevId: 696513911
  • Loading branch information
graememorgan authored and Error Prone Team committed Nov 14, 2024
1 parent 2124ebf commit 0942275
Show file tree
Hide file tree
Showing 151 changed files with 835 additions and 409 deletions.
18 changes: 18 additions & 0 deletions annotation/src/main/java/com/google/errorprone/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2024 The Error Prone Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** Contains the BugPattern annotation. */
package com.google.errorprone;
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public void bothMethodCalls() {
System.out.println("arrays are not equal!");
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -162,7 +163,8 @@ public void objectArray() {
System.out.println("arrays are not equal!");
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -230,7 +232,8 @@ public void secondArray() {
System.out.println("Objects are not equal!");
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -282,7 +285,8 @@ public void secondArray() {
System.out.println("arrays are not equal!");
}
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public void varargsHashCodeOnMoreThanOneArg() {
// Arrays.deepHashCode(multidimensionalStringArray))
hashCode = Objects.hashCode(obj1, obj2, multidimensionalStringArray);
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -147,7 +148,8 @@ public void varagsHashCodeOnObjectOrStringArray() {
hashCode = Objects.hashCode(objArray);
hashCode = Objects.hashCode((Object[]) stringArray);
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -193,7 +195,8 @@ public void varagsHashCodeOnObjectOrStringArray() {
hashCode = Objects.hash(objArray);
hashCode = Objects.hash((Object[]) stringArray);
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public void arrayOfArrays() {
// BUG: Diagnostic contains: Arrays.deepToString(a)
System.out.println(a);
}
}""")
}\
""")
.doTest();
}

Expand All @@ -129,7 +130,8 @@ public void objectEquals() {
System.out.println("string is not empty!");
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -305,7 +307,8 @@ public void stringVariableAddsArrayAndAssigns() {
// BUG: Diagnostic contains: += Arrays.toString(a)
b += a;
}
}""")
}\
""")
.doTest();
}

Expand All @@ -332,7 +335,8 @@ public void concatenateCompoundAssign_int() {
String b = " a string ";
b += a;
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -362,7 +366,8 @@ public void stringLiteralRightOperandIsArray() {
// BUG: Diagnostic contains: + Arrays.toString(a)
String b = "a string" + a;
}
}""")
}\
""")
.doTest();
}

Expand All @@ -388,7 +393,8 @@ public void notArray_refactored() {
String b = " a string";
String c = a + b;
}
}""")
}\
""")
.doTest();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void assertTrue() {
public void assertFalseFromCondition() {
assert 0 == 1;
}
}""")
}\
""")
.doTest();
}

Expand All @@ -70,7 +71,8 @@ public void assertFalse() {
// BUG: Diagnostic contains: throw new AssertionError()
assert false;
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public ListenableFuture<String> apply(Object input) throws Exception {
return immediateFuture(input.toString());
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -139,7 +140,8 @@ public ListenableFuture<Object> apply(String input) throws Exception {
interface MyNonAsyncFunction<I, O> {
ListenableFuture<O> apply(@Nullable I input) throws Exception;
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public int compare(File lhs, File rhs) {
return (int) (rhs.lastModified() - lhs.lastModified());
}
};
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -231,7 +232,8 @@ public char compare(byte n1, byte n2) {
return (char) (n1 - n2);
}
};
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ Builder returnRaw() {
void classLiteral() {
System.out.println(Builder.class);
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -354,7 +355,8 @@ void useNestedBuilder() {
new Builder();
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -438,7 +440,8 @@ Builder returnRaw() {
void classLiteral() {
System.out.println(Builder.class);
}
}""")
}\
""")
.addOutputLines(
"BadImportPositiveCases_expected.java",
"""
Expand Down Expand Up @@ -498,7 +501,8 @@ ImmutableList.Builder returnRaw() {
void classLiteral() {
System.out.println(ImmutableList.Builder.class);
}
}""")
}\
""")
.doTest(TestMode.AST_MATCH);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public void foo() {
// BUG: Diagnostic contains: (long) c >>> 32
result += c >>> 32;
}
}""")
}\
""")
.doTest();
}

Expand All @@ -104,7 +105,8 @@ public void foo() {
result += x >>> 3;
result += (long) (x & 0xff) >> 40;
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public static final Class<?> methodHandlesDefineClass(byte[] bytes)
// BUG: Diagnostic contains: BanClassLoader
return MethodHandles.lookup().defineClass(bytes);
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -113,7 +114,8 @@ public final Class<?> overrideClassLoader() throws ClassNotFoundException {
private class NotClassLoader {
protected void loadClass() {}
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ private Object subclassesJavaNamingcontext() throws NamingException {
// BUG: Diagnostic contains: BanJNDI
return c.lookup("hello");
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -197,7 +198,8 @@ class BanJNDIPositiveCases {
private void callsList() throws NamingException {
FakeDirContext.list(((Name) new Object()));
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -225,7 +227,8 @@ class BanJNDIPositiveCases {
private void callsList() throws NamingException {
FakeDirContext.list(((Name) new Object()));
}
}""")
}\
""")
.expectUnchanged()
.setArgs("-XepCompilingTestOnlyCode")
.doTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ void array_precededByNotAValidMethod_isFlagged() {
// BUG: Diagnostic contains: ByteBuffer.array()
buff.array();
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -248,7 +249,8 @@ void array_inLambdaExpression_precededByByteBufferAllocate_isNotFlagged() {
return null;
};
}
}""")
}\
""")
.doTest();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public void method() {
// BUG: Diagnostic contains: Mockito cannot mock
FinalClass local = Mockito.mock(FinalClass.class);
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -105,7 +106,8 @@ static class NonFinalClass {}
public void method() {
NonFinalClass local = Mockito.mock(NonFinalClass.class);
}
}""")
}\
""")
.doTest();
}

Expand All @@ -127,7 +129,8 @@ static final class FinalClass {}
public void method() {
FinalClass local = Mockito.mock(FinalClass.class);
}
}""")
}\
""")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ Foo otherFoo() {
return this;
}
}
}""")
}\
""")
.doTest();
}

Expand Down Expand Up @@ -190,7 +191,8 @@ Foo otherFoo() {
return this;
}
}
}""")
}\
""")
.doTest();
}
}
Loading

0 comments on commit 0942275

Please sign in to comment.