Comments (2)
Hi,
I can't reproduce this. Please make sure your whole setup works (e.g., supressions, directories scanned correct). The following 2 test setup work with latest released version downloaded:
- Using your provided signatures.txt file wil the CLI
- Using the bundled signatures file "jdk-deprecated-19" (which contains the same signatures as they were deprecated in Java 19) also with CLI
$ cat signatures.txt
@defaultMessage Use "java.util.Locale#forLanguageTag"
java.util.Locale#<init>(java.lang.String)
java.util.Locale#<init>(java.lang.String,java.lang.String)
java.util.Locale#<init>(java.lang.String,java.lang.String,java.lang.String)
$ cat Test.java
import java.util.Locale;
public class Test {
public static Locale parseLocale(String localeString) {
String[] strings = localeString.split("_");
switch (strings.length) {
case 1:
return new Locale(strings[0]);
case 2:
return new Locale(strings[0], strings[1]);
case 3:
return new Locale(strings[0], strings[1], strings[2]);
default:
throw new AssertionError("bad locale string '" + localeString + "'");
}
}
}
$ javac Test.java
$ java -jar forbiddenapis-3.4.jar -d . -f signatures.txt
Scanning for classes to check...
Reading API signatures: C:\Users\Uwe Schindler\Desktop\forbiddentest\signatures.txt
Loading classes to check...
Scanning classes for violations...
ERROR: Forbidden method invocation: java.util.Locale#<init>(java.lang.String) [Use "java.util.Locale#forLanguageTag"]
ERROR: in Test (Test.java:9)
ERROR: Forbidden method invocation: java.util.Locale#<init>(java.lang.String,java.lang.String) [Use "java.util.Locale#forLanguageTag"]
ERROR: in Test (Test.java:11)
ERROR: Forbidden method invocation: java.util.Locale#<init>(java.lang.String,java.lang.String,java.lang.String) [Use "java.util.Locale#forLanguageTag"]
ERROR: in Test (Test.java:13)
ERROR: Scanned 1 class file(s) for forbidden API invocations (in 0.06s), 3 error(s).
ERROR: Check for forbidden API calls failed, see log.
$ java -jar forbiddenapis-3.4.jar -d . -b jdk-deprecated-19
Scanning for classes to check...
Reading bundled API signatures: jdk-deprecated-19
Loading classes to check...
Scanning classes for violations...
ERROR: Forbidden method invocation: java.util.Locale#<init>(java.lang.String) [Deprecated in Java 19]
ERROR: in Test (Test.java:9)
ERROR: Forbidden method invocation: java.util.Locale#<init>(java.lang.String,java.lang.String) [Deprecated in Java 19]
ERROR: in Test (Test.java:11)
ERROR: Forbidden method invocation: java.util.Locale#<init>(java.lang.String,java.lang.String,java.lang.String) [Deprecated in Java 19]
ERROR: in Test (Test.java:13)
ERROR: Scanned 1 class file(s) for forbidden API invocations (in 0.18s), 3 error(s).
ERROR: Check for forbidden API calls failed, see log.
So all looks fine to me. Could it be that you added some annotation to one of your test code that suppresses the error? Or excluded files?
from forbidden-apis.
yes, seems the issue was on my side, thanks for the fresh look
from forbidden-apis.
Related Issues (20)
- (Gradle) How to avoid creation of a forbiddenApisTest task HOT 2
- Unable to suppress violation in a field declaration HOT 3
- Allow to ignore failures for some signature files only HOT 3
- Improve messsages in the bundled signatures so they are actionable HOT 1
- build warning about parameter "localRepository" after upgrading to maven 3.9.1 HOT 28
- Remove HttpResponse.BodyHandlers.ofFile(Path) from banned method list in Java 21 signatures HOT 2
- Provide option to enabled DEBUG level logging when using the CLI HOT 12
- Clarify Maven configuration parameter "includes" and "excludes" HOT 2
- Consider JEP 400 for jdk-unsafe Bundled Signatures HOT 1
- Check fails with "Bundled signatures resource not found: jdk-unsafe-21" despite failOnUnsupportedJava/failOnViolation disabled HOT 7
- Remove jdk.jfr from non portable exceptions list HOT 1
- Require at least Maven 3.2.5 HOT 3
- static method hiding produces false positives when original method is forbidden HOT 28
- Please publish PGP signature for the plugin at Gradle Plugin Portal HOT 6
- Add commons-io 2.15.1 HOT 1
- Add new (default) signatures
- "Parsing signatures failed" if class is not found on classpath HOT 3
- Clarify what retention scope is required for forbiddenapis suppression annotations HOT 3
- compatibility with Gradle 9.x HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forbidden-apis.