Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Oct 11, 2023
1 parent 31120c6 commit 4d0b55b
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
final class AutowiredConstructorTest {
@Test
void identification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

final class ImmutablesSortedSetComparatorTest {
@Test
Expand Down Expand Up @@ -140,6 +142,7 @@ void replacement() {
.doTest(TestMode.TEXT_MATCH);
}

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
@Test
void replacementWithImportClash() {
BugCheckerRefactoringTestHelper.newInstance(ImmutablesSortedSetComparator.class, getClass())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
final class JUnitClassModifiersTest {
@Test
void identification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

final class LexicographicalAnnotationAttributeListingTest {
@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
@Test
void identification() {
CompilationTestHelper.newInstance(LexicographicalAnnotationAttributeListing.class, getClass())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
final class RequestMappingAnnotationTest {
@Test
void identification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
final class RequestParamTypeTest {
@Test
void identification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
final class SpringMvcAnnotationTest {
@Test
void identification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

final class StaticImportTest {
@Test
Expand All @@ -26,6 +28,7 @@ void exemptedMembersAreNotRedundant() {
.doesNotContainAnyElementsOf(StaticImport.STATIC_IMPORT_EXEMPTED_IDENTIFIERS);
}

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
@Test
void identification() {
CompilationTestHelper.newInstance(StaticImport.class, getClass())
Expand Down Expand Up @@ -111,6 +114,7 @@ void identification() {
.doTest();
}

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
@Test
void replacement() {
BugCheckerRefactoringTestHelper.newInstance(StaticImport.class, getClass())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import com.google.common.collect.ImmutableSet;
import java.util.stream.Stream;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -73,19 +75,36 @@ final class RefasterRulesTest {
TimeRules.class,
WebClientRules.class);

// XXX: Drop all logic related to this collection once we drop support for
// JDKs prior to version 17.
private static final ImmutableSet<Class<?>> JDK_17_PLUS_RULE_COLLECTIONS =
ImmutableSet.of(WebClientRules.class);

// XXX: Create a JUnit extension to automatically discover the rule collections in a given context
// to make sure the list is exhaustive.
private static Stream<Arguments> validateRuleCollectionTestCases() {
// XXX: Drop the filter once we have added tests for AssertJ! We can then also replace this
// method with `@ValueSource(classes = {...})`.
return RULE_COLLECTIONS.stream()
.filter(not(AssertJRules.class::equals))
.filter(not(WebClientRules.class::equals))
.map(Arguments::arguments);
}

@MethodSource("validateRuleCollectionTestCases")
@ParameterizedTest
void validateRuleCollection(Class<?> clazz) {
RefasterRuleCollection.validate(clazz);
if (!JDK_17_PLUS_RULE_COLLECTIONS.contains(clazz)) {
RefasterRuleCollection.validate(clazz);
}
}

@DisabledForJreRange(max = JRE.JAVA_16 /* Spring targets JDK 17. */)
@MethodSource("validateRuleCollectionTestCases")
@ParameterizedTest
void validateRuleCollectionWithJdk17AndAbove(Class<?> clazz) {
if (JDK_17_PLUS_RULE_COLLECTIONS.contains(clazz)) {
RefasterRuleCollection.validate(clazz);
}
}
}
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,10 @@
</banDynamicVersions>
<dependencyConvergence />
<enforceBytecodeVersion>
<ignoredScopes>
<ignoredScope>provided</ignoredScope>
<ignoredScope>test</ignoredScope>
</ignoredScopes>
<maxJdkVersion>${version.jdk.target}</maxJdkVersion>
</enforceBytecodeVersion>
<requireEncoding>
Expand Down

0 comments on commit 4d0b55b

Please sign in to comment.