Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fake #2479

Merged
merged 3 commits into from
Jul 31, 2024
Merged

fake #2479

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/receive-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Execute recipes
- name: Apply OpenRewrite recipes
run: mvn --activate-profiles openrewrite org.openrewrite.maven:rewrite-maven-plugin:run
run: ./mvnw -Dtoolchain.skip=true -Dlicense.skip=true -DskipTests=true -P openrewrite clean install

# Capture the diff
- name: Create patch
Expand Down
13 changes: 12 additions & 1 deletion core/src/test/java/feign/UtilTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 The Feign Authors
* Copyright 2012-2024 The Feign 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
Expand All @@ -20,6 +20,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.Reader;
import java.lang.reflect.Type;
import java.util.Arrays;
Expand Down Expand Up @@ -86,6 +87,16 @@ void resolveLastTypeParameterWhenNotSubtype() throws Exception {
assertThat(last).isEqualTo(listStringType);
}


@Test
void fake() throws Exception {
Type context =
LastTypeParameter.class.getDeclaredField("PARAMETERIZED_LIST_STRING").getGenericType();
Type listStringType = LastTypeParameter.class.getDeclaredField("LIST_STRING").getGenericType();
Type last = resolveLastTypeParameter(context, Parameterized.class);
assertEquals(last, listStringType);
}

@Test
void lastTypeFromInstance() throws Exception {
Parameterized<?> instance = new ParameterizedSubtype();
Expand Down
154 changes: 98 additions & 56 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,6 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<argLine>${jvm.options}</argLine>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>

Expand All @@ -492,49 +489,12 @@
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
<configuration>
<toolchains>
<jdk>
<version>${main.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
<execution>
<id>test</id>
<phase>generate-test-sources</phase>
<goals>
<goal>toolchain</goal>
</goals>
<configuration>
<toolchains>
<jdk>
<version>${latest.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
Expand Down Expand Up @@ -667,6 +627,9 @@
<exclude>etc/header.txt</exclude>
<exclude>**/.idea/**</exclude>
<exclude>**/target/**</exclude>
<exclude>**/scripts/**</exclude>
<exclude>**/src/config/**</exclude>
<exclude>**/codequality/**</exclude>
<exclude>LICENSE</exclude>
<exclude>NOTICE</exclude>
<exclude>OSSMETADATA</exclude>
Expand Down Expand Up @@ -961,43 +924,122 @@
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.35.0</version>

<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ</recipe>
<recipe>org.openrewrite.java.testing.assertj.JUnitToAssertj</recipe>
<recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>
<recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
</activeRecipes>
<exclusions>
<exclusion>**/src/main/java/**</exclusion>
<exclusion>**/pom.xml</exclusion>
</exclusions>
</configuration>
<version>5.36.0</version>

<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-testing-frameworks</artifactId>
<version>2.13.0</version>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>2.19.0</version>
<version>2.20.0</version>
</dependency>
</dependencies>

<executions>
<execution>
<id>tests</id>
<goals>
<goal>runNoFork</goal>
</goals>
<phase>verify</phase>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ</recipe>
<recipe>org.openrewrite.java.testing.assertj.JUnitToAssertj</recipe>
<recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>
<recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
</activeRecipes>
<exclusions>
<exclusion>**/src/main/java/**</exclusion>
<exclusion>pom.xml</exclusion>
</exclusions>
</configuration>
</execution>
<execution>
<id>sources</id>
<goals>
<goal>runNoFork</goal>
</goals>
<phase>verify</phase>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.UpgradeToJava8</recipe>
</activeRecipes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>toolchain</id>
<activation>
<property>
<name>!toolchain.skip</name>
</property>
</activation>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
<configuration>
<toolchains>
<jdk>
<version>${main.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
<execution>
<id>test</id>
<goals>
<goal>toolchain</goal>
</goals>
<phase>generate-test-sources</phase>
<configuration>
<toolchains>
<jdk>
<version>${latest.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down