1
+ < html >
2
+ <!--
3
+ * (C) Copyright Uwe Schindler (Generics Policeman) and others.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ -->
17
+ < head >
18
+ < META http-equiv ="Content-Type " content ="text/html; charset=UTF-8 ">
19
+ < title > Syntax of Custom Signatures Files</ title >
20
+ </ head >
21
+ < body >
22
+ < h1 > Syntax of Custom Signatures Files</ h1 >
23
+
24
+ < p > < b > Forbidden API Checker</ b > allows to define custom signatures files. Depending on
25
+ the type of task (Ant, Maven, or Gradle), you can add them via references to
26
+ local files from your project directory. Maven also supports to refer to them using
27
+ Maven coordinates.</ p >
28
+
29
+ < p > The syntax of those files is: Each line that is not empty, does not start with a
30
+ < code > #</ code > or < code > @</ code > symbol is treated as a signature. The following types
31
+ of signatures are supported:</ p >
32
+
33
+ < ul >
34
+ < li > < em > Class reference:</ em > A binary/fully-qualified class name (including package). You may
35
+ use the output of < a href ="https://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getName() ">
36
+ Class.getName()</ a > . Be sure to use correct name for inner
37
+ classes! Example: < code > java.lang.String</ code > </ li >
38
+ < li > < em > A package/class glob pattern:</ em > To forbid all classes from a package, you may use
39
+ glob patterns, like < code > sun.misc.**</ code > ("< code > **</ code > " matches against package
40
+ boundaries).</ li >
41
+ < li > < em > A field of a class:</ em > < code > package.Class#fieldName</ code > </ li >
42
+ < li > < em > A method signature:</ em > It consists of a binary class name, followed by < code > #</ code >
43
+ and a method name including method parameters: < code > java.lang.String#concat(java.lang.String)</ code >
44
+ – All method parameters need to use fully qualified class names!</ li >
45
+ </ ul >
46
+
47
+ < p > The error message displayed when the signature matches can be given at the end of each
48
+ signature line using "< code > @</ code > " as separator:</ p >
49
+
50
+ < pre >
51
+ java.lang.String @ You are crazy that you disallow strings
52
+ </ pre >
53
+
54
+ < p > To not repeat the same message after each signature, you can prepend signatures
55
+ with a default message. Use a line starting with "< code > @defaultMessage</ code > ".
56
+
57
+ < pre >
58
+ @defaultMessage You are crazy that you disallow substrings
59
+ java.lang.String#substring(int)
60
+ java.lang.String#substring(int,int)
61
+ </ pre >
62
+
63
+ </ body >
64
+ </ html >
0 commit comments