Skip to content

Commit

Permalink
Remove swathes of assume()s on the current runtime version.
Browse files Browse the repository at this point in the history
EP is targetting 17, so these are all trivially true for all builds.

Except one, which was trivially false, so I removed the test.

PiperOrigin-RevId: 697616719
  • Loading branch information
graememorgan authored and Error Prone Team committed Nov 18, 2024
1 parent b222ea8 commit fc5aade
Show file tree
Hide file tree
Showing 33 changed files with 0 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -51,7 +49,6 @@ String formatMe(String formatString, Object... args) {

@Test
public void formatted() {
assume().that(Runtime.version().feature()).isAtLeast(15);
compilationHelper
.addSourceLines(
"AnnotateFormatMethodPositiveCases.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;
import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
Expand Down Expand Up @@ -418,7 +417,6 @@ interface Test {
// TODO(b/168625474): 'sealed' doesn't have a TokenKind
@Test
public void sealedInterface() {
assume().that(Runtime.version().feature()).isAtLeast(15);
refactoringHelper
.addInputLines(
"Test.java",
Expand Down Expand Up @@ -623,7 +621,6 @@ void m() {

@Test
public void recordAnnotation() {
assume().that(Runtime.version().feature()).isAtLeast(16);
refactoringHelper
.addInputLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -63,8 +61,6 @@ public void method() {

@Test
public void positiveCase_record() {
assume().that(Runtime.version().feature()).isAtLeast(16);

compilationHelper
.addSourceLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -545,7 +543,6 @@ class Inner {}

@Test
public void nestedInLocal_static() {
assume().that(Runtime.version().feature()).isAtLeast(16);
compilationHelper
.addSourceLines(
"A.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
import com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers;
import com.google.errorprone.CompilationTestHelper;
Expand Down Expand Up @@ -588,7 +586,6 @@ void f() throws Exception {

@Test
public void withVar() {
assume().that(Runtime.version().feature()).isAtLeast(15);
refactoringTest()
.addInputLines(
"in/Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.google.errorprone.bugpatterns;

import static com.google.common.base.Predicates.containsPattern;
import static com.google.common.truth.TruthJUnit.assume;
import static com.google.errorprone.bugpatterns.DefaultLocale.onlyContainsSpecifiersInAllowList;
import static java.util.function.Predicate.not;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -143,7 +142,6 @@ public void formatMethods_negative() {

@Test
public void stringFormatted() {
assume().that(Runtime.version().feature()).isAtLeast(15);
compilationHelper
.addSourceLines(
"Test.java",
Expand Down Expand Up @@ -233,7 +231,6 @@ void f(DateTimeFormatterBuilder dtfb) throws Exception {

@Test
public void factoryMethodsJdk12plus() {
assume().that(Runtime.version().feature()).isAtLeast(12);
compilationHelper
.addSourceLines(
"Test.java",
Expand Down Expand Up @@ -311,7 +308,6 @@ public void resourceBundle() {

@Test
public void resourceBundleJdk9plus() {
assume().that(Runtime.version().feature()).isAtLeast(9);
compilationHelper
.addSourceLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Ignore;
import org.junit.Test;
Expand Down Expand Up @@ -340,7 +338,6 @@ void f(char c, boolean b) {

@Test
public void arrowSwitch() {
assume().that(Runtime.version().feature()).isAtLeast(14);
testHelper
.addSourceLines(
"Test.java",
Expand All @@ -366,7 +363,6 @@ void m(Case c) {
@Ignore("https://github.com/google/error-prone/issues/2638")
@Test
public void i2118() {
assume().that(Runtime.version().feature()).isAtLeast(14);
testHelper
.addSourceLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
Expand Down Expand Up @@ -351,7 +349,6 @@ class L {

@Test
public void inner_static() {
assume().that(Runtime.version().feature()).isAtLeast(16);
compilationHelper
.addSourceLines(
"Test.java",
Expand Down Expand Up @@ -394,7 +391,6 @@ class L {

@Test
public void record() {
assume().that(Runtime.version().feature()).isAtLeast(16);
compilationHelper
.addSourceLines(
"ExampleClass.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.common.collect.ImmutableList;
import com.google.errorprone.BugCheckerRefactoringTestHelper;
import com.google.errorprone.CompilationTestHelper;
Expand Down Expand Up @@ -422,7 +420,6 @@ private int incr(int x) {

@Test
public void innerClass_static() {
assume().that(Runtime.version().feature()).isAtLeast(16);
testHelper
.addSourceLines(
"Test.java",
Expand Down Expand Up @@ -491,7 +488,6 @@ private void foo() {}

@Test
public void positiveLocal() {
assume().that(Runtime.version().feature()).isAtLeast(16);
testHelper
.addSourceLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;
import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
Expand All @@ -34,8 +33,6 @@ public final class MisformattedTestDataTest {

@Test
public void alreadyFormatted_noFinding() {
assume().that(Runtime.version().feature()).isAtLeast(14);

compilationHelper
.addSourceLines(
"Test.java",
Expand Down Expand Up @@ -63,8 +60,6 @@ void method() {

@Test
public void onlyDiffersByFinalNewline_noFinding() {
assume().that(Runtime.version().feature()).isAtLeast(14);

compilationHelper
.addSourceLines(
"Test.java",
Expand All @@ -91,8 +86,6 @@ void method() {
@Test
public void misformatted_suggestsFix() {
assume().that(Runtime.version().feature()).isAtLeast(14);
refactoringHelper
.addInputLines(
"Test.java",
Expand Down Expand Up @@ -141,8 +134,6 @@ void method() {
@Test
public void onlyDiffersByIndentation_notReindented() {
assume().that(Runtime.version().feature()).isAtLeast(14);
refactoringHelper
.addInputLines(
"Test.java",
Expand Down Expand Up @@ -171,8 +162,6 @@ void method() {

@Test
public void escapesSpecialCharacters() {
assume().that(Runtime.version().feature()).isAtLeast(14);

refactoringHelper
.addInputLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -30,8 +28,6 @@ public final class MisleadingEscapedSpaceTest {

@Test
public void misleadingEscape() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -46,8 +42,6 @@ class Test {

@Test
public void literalBackslashS() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -61,8 +55,6 @@ class Test {

@Test
public void asSingleCharacter_misleading() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -77,8 +69,6 @@ class Test {

@Test
public void withinTextBlock_notAtEndOfLine_misleading() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -100,8 +90,6 @@ class Test {

@Test
public void atEndOfLine_notMisleading() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -118,8 +106,6 @@ class Test {

@Test
public void multipleAtEndOfLine_notMisleading() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -135,8 +121,6 @@ class Test {

@Test
public void withinCommentInBrokenUpString_noFinding() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -150,8 +134,6 @@ class Test {

@Test
public void atEndOfString_noFinding() {
assume().that(Runtime.version().feature()).isAtLeast(14);

testHelper
.addSourceLines(
"Test.class",
Expand All @@ -168,8 +150,6 @@ class Test {
@Test
public void escapedSpaceAtEndOfString() {
assume().that(Runtime.version().feature()).isAtLeast(14);
testHelper
.addSourceLines(
"Test.class",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ boolean f(int i) {

@Test
public void arrowSwitch() {
assume().that(Runtime.version().feature()).isAtLeast(14);
compilationHelper
.addSourceLines(
"Test.java",
Expand All @@ -277,7 +276,6 @@ void m(int i) {

@Test
public void arrowSwitchNegative() {
assume().that(Runtime.version().feature()).isAtLeast(14);
compilationHelper
.addSourceLines(
"Test.java",
Expand All @@ -297,7 +295,6 @@ void m(int i) {

@Test
public void arrowComment() {
assume().that(Runtime.version().feature()).isAtLeast(14);
compilationHelper
.addSourceLines(
"Test.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone.bugpatterns;

import static com.google.common.truth.TruthJUnit.assume;

import com.google.common.collect.ImmutableList;
import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
Expand Down Expand Up @@ -195,8 +193,6 @@ public interface Test extends Super {

@Test
public void explicitRecordAccessor() {
assume().that(Runtime.version().feature()).isAtLeast(16);

compilationHelper
.addSourceLines(
"Baz.java",
Expand All @@ -219,8 +215,6 @@ public int y() {

@Test
public void explicitRecordAccessor_doesNotFlagConstructors() {
assume().that(Runtime.version().feature()).isAtLeast(16);

compilationHelper
.addSourceLines(
"Test.java",
Expand Down
Loading

0 comments on commit fc5aade

Please sign in to comment.