You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Task to check if a set of class files contains calls to forbidden APIs
25
+
from a given classpath and list of API signatures (either inline or as pointer to files).
26
+
In contrast to other ANT tasks, this tool does only visit the given classpath
27
+
and the system classloader, not ANT's class loader.</p>
28
+
29
+
<h2>Parameters</h2>
30
+
31
+
<table>
32
+
33
+
<tr>
34
+
<th>Name</th>
35
+
<th>Type</th>
36
+
<th>Default</th>
37
+
<th>Description</th>
38
+
</tr>
39
+
40
+
<tr>
41
+
<td>dir</td>
42
+
<td><code>File</code></td>
43
+
<td></td>
44
+
<td>Directory to scan for class files. This directory is automatically converted to a <code>FileSet</code> with <code>**/*.class</code> as include pattern.</td>
45
+
</tr>
46
+
47
+
<tr>
48
+
<td>signaturesfile</td>
49
+
<td><code>File</code></td>
50
+
<td></td>
51
+
<td>A single signatures file.</td>
52
+
</tr>
53
+
54
+
<tr>
55
+
<td>bundledsignatures</td>
56
+
<td><code>String</code></td>
57
+
<td></td>
58
+
<td>Name of a <ahref="bundled-signatures.html">built-in signatures</a> file.</td>
59
+
</tr>
60
+
61
+
<tr>
62
+
<td>classpath</td>
63
+
<td><code>Path</code></td>
64
+
<td></td>
65
+
<td>Classpath in ANT format. Should be identical to classpath used for compiling the class files.</td>
66
+
</tr>
67
+
68
+
<tr>
69
+
<td>classpathref</td>
70
+
<td><code>Reference</code></td>
71
+
<td></td>
72
+
<td>Reference to a <code>path</code> defined anywhere else. Should be identical to classpath used for compiling the class files.</td>
73
+
</tr>
74
+
75
+
<tr>
76
+
<td>failOnUnsupportedJava</td>
77
+
<td><code>boolean</code></td>
78
+
<td><code>false</code></td>
79
+
<td>Fail the build, if the bundled ASM library cannot read the class file format of the runtime library or the runtime library cannot be discovered.</td>
80
+
</tr>
81
+
82
+
<tr>
83
+
<td>failOnMissingClasses</td>
84
+
<td><code>boolean</code></td>
85
+
<td><code>true</code></td>
86
+
<td>Fail the build, if a referenced class is missing. This requires that you pass the whole classpath including all dependencies.
87
+
If you don't have all classes in the filesets, the application classes must be reachable through this classpath, too.</td>
88
+
</tr>
89
+
90
+
<tr>
91
+
<td>failOnUnresolvableSignatures</td>
92
+
<td><code>boolean</code></td>
93
+
<td><code>true</code></td>
94
+
<td>Fail the build if a signature is not resolving. If this parameter is set to to false, then such signatures are silently ignored.</td>
95
+
</tr>
96
+
97
+
<tr>
98
+
<td>internalRuntimeForbidden</td>
99
+
<td><code>boolean</code></td>
100
+
<td><code>false</code></td>
101
+
<td>Forbids calls to classes from the internal java runtime (like <code>sun.misc.Unsafe</code>).</td>
102
+
</tr>
103
+
104
+
<tr>
105
+
<td>restrictClassFilename</td>
106
+
<td><code>boolean</code></td>
107
+
<td><code>true</code></td>
108
+
<td>Automatically restrict resource names included to files with a name ending in <code>'.class'</code>. This makes filesets easier, as the <code>includes="**/*.class"</code> is not needed.</td>
109
+
</tr>
110
+
111
+
<tr>
112
+
<td>ignoreEmptyFileset</td>
113
+
<td><code>boolean</code></td>
114
+
<td><code>false</code></td>
115
+
<td>Ignore empty fileset/resource collection and print a warning instead.</td>
116
+
</tr>
117
+
118
+
</table>
119
+
120
+
<h2>Parameters specified as nested elements</h2>
121
+
122
+
<p>This task supports all resource collections Ant provides (<code>fileset</code>, <code>filelist</code>,
and uses all class files from them. It automatically adds an implcit filter to file names ending in <code>'.class'</code>,
125
+
so you don't need to add this as include attribute to those collections.</p>
126
+
127
+
<p>You can also pass one or multiple <code>classpath</code> elements to form a classpath. Ideally use the same configuration like the <code>javac</code> task.</p>
128
+
129
+
<p>To pass in signatures, you have 3 possibilities:</p>
130
+
131
+
<ul>
132
+
<li>Use <code>bundledSignatures</code> element to pass a <ahref="bundled-signatures.html">built-in signatures</a> file, e.g. <code><bundledsignatures name="jdk-unsafe-1.7"></code></li>
133
+
<li>Use <code>signaturesFileSet</code>, <code>signaturesFileList</code>, <code>signaturesFile</code> elements to pass in collections of signatures files. Those elements behave like the corresponding standard Ant types.</li>
134
+
<li>Place signatures as plain text (use CDATA sections) inside the <code>forbiddenapis</code> element.</li>
0 commit comments