Skip to content

Commit

Permalink
Merge pull request #29568 from geoand/rr-forbidden-apis
Browse files Browse the repository at this point in the history
Introduce forbidden-apis to RESTEasy Reactive
  • Loading branch information
geoand authored Nov 30, 2022
2 parents d4e7ef7 + 7fbd565 commit 7a7b6ce
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .forbiddenapis/banned-signatures-common.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@defaultMessage Never use Type#toString() as it's almost always the wrong thing to do. Usually org.jboss.jandex.DotName#toString() is what is needed
org.jboss.jandex.Type#toString()
18 changes: 18 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,24 @@
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>${forbiddenapis-maven-plugin.version}</version>
<executions>
<execution>
<id>verify-forbidden-apis</id>
<configuration>
<!-- if the used Java version is too new, don't fail, just do nothing: -->
<failOnUnsupportedJava>false</failOnUnsupportedJava>
<signaturesFiles>
<signaturesFile>${maven.multiModuleProjectDirectory}/.forbiddenapis/banned-signatures-common.txt</signaturesFile>
</signaturesFiles>
<failOnMissingClasses>false</failOnMissingClasses>
<ignoreSignaturesOfMissingClasses>true</ignoreSignaturesOfMissingClasses>
</configuration>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Expand Down
9 changes: 1 addition & 8 deletions core/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,11 @@
<execution>
<id>verify-forbidden-apis</id>
<configuration>
<!-- if the used Java version is too new, don't fail, just do nothing: -->
<failOnUnsupportedJava>false</failOnUnsupportedJava>
<signaturesFiles>
<signaturesFile>./banned-signatures.txt</signaturesFile>
<signaturesFile>${maven.multiModuleProjectDirectory}/.forbiddenapis/banned-signatures-common.txt</signaturesFile>
</signaturesFiles>
<failOnMissingClasses>false</failOnMissingClasses>
<ignoreSignaturesOfMissingClasses>true</ignoreSignaturesOfMissingClasses>
</configuration>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@

</dependencies>

<build>
<plugins>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,30 +364,4 @@ public static boolean isSubclassOf(IndexView index, ClassInfo info, DotName pare
return isSubclassOf(index, superClass, parentName);
}

@SuppressWarnings("incomplete-switch")
public static String getBoxedTypeName(Type type) {
switch (type.kind()) {
case PRIMITIVE:
switch (type.asPrimitiveType().primitive()) {
case BOOLEAN:
return "java.lang.Boolean";
case BYTE:
return "java.lang.Byte";
case CHAR:
return "java.lang.Character";
case DOUBLE:
return "java.lang.Double";
case FLOAT:
return "java.lang.Float";
case INT:
return "java.lang.Integer";
case LONG:
return "java.lang.Long";
case SHORT:
return "java.lang.Short";
}
}
return type.toString();
}

}
26 changes: 26 additions & 0 deletions independent-projects/resteasy-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<jakarta.json.bind-api.version>1.0.2</jakarta.json.bind-api.version>
<awaitility.version>4.2.0</awaitility.version>
<smallrye-mutiny-vertx-core.version>2.25.0</smallrye-mutiny-vertx-core.version>

<!-- Forbidden API checks -->
<forbiddenapis-maven-plugin.version>3.1</forbiddenapis-maven-plugin.version>
</properties>

<modules>
Expand Down Expand Up @@ -484,6 +487,29 @@
</transformations>
</configuration>
</plugin>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>${forbiddenapis-maven-plugin.version}</version>
<executions>
<execution>
<id>verify-forbidden-apis</id>
<configuration>
<!-- if the used Java version is too new, don't fail, just do nothing: -->
<failOnUnsupportedJava>false</failOnUnsupportedJava>
<signaturesFiles>
<signaturesFile>${maven.multiModuleProjectDirectory}/.forbiddenapis/banned-signatures-common.txt</signaturesFile>
</signaturesFiles>
<failOnMissingClasses>false</failOnMissingClasses>
<ignoreSignaturesOfMissingClasses>true</ignoreSignaturesOfMissingClasses>
</configuration>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@

</dependencies>

<build>
<plugins>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jakarta-rewrite</id>
Expand Down

0 comments on commit 7a7b6ce

Please sign in to comment.