4040import org .apache .bcel .classfile .Method ;
4141
4242/**
43- * A tool to find static linkage errors for a class path.
43+ * A tool to find linkage errors in a class path.
4444 */
4545public class ClasspathChecker {
4646
@@ -130,11 +130,11 @@ JarLinkageReport generateLinkageReport(
130130 }
131131
132132 private static <R extends SymbolReference >
133- ImmutableList <StaticLinkageError <R >> errorsFromSymbolReferences (
133+ ImmutableList <SymbolNotResolvable <R >> errorsFromSymbolReferences (
134134 Set <R > symbolReferences ,
135135 Set <String > classesDefinedInJar ,
136- Function <R , Optional <StaticLinkageError <R >>> checkFunction ) {
137- ImmutableList <StaticLinkageError <R >> linkageErrors =
136+ Function <R , Optional <SymbolNotResolvable <R >>> checkFunction ) {
137+ ImmutableList <SymbolNotResolvable <R >> linkageErrors =
138138 symbolReferences .stream ()
139139 .filter (reference -> !classesDefinedInJar .contains (reference .getTargetClassName ()))
140140 .map (checkFunction )
@@ -155,7 +155,7 @@ ImmutableList<StaticLinkageError<R>> errorsFromSymbolReferences(
155155 * Virtual Machine Specification: 5.4.3.4. Interface Method Resolution</a>
156156 */
157157 @ VisibleForTesting
158- Optional <StaticLinkageError <MethodSymbolReference >> checkLinkageErrorMissingMethodAt (
158+ Optional <SymbolNotResolvable <MethodSymbolReference >> checkLinkageErrorMissingMethodAt (
159159 MethodSymbolReference reference ) {
160160 String targetClassName = reference .getTargetClassName ();
161161 String sourceClassName = reference .getSourceClassName ();
@@ -172,13 +172,13 @@ Optional<StaticLinkageError<MethodSymbolReference>> checkLinkageErrorMissingMeth
172172 Path classFileLocation = classDumper .findClassLocation (targetClassName );
173173 if (!isClassAccessibleFrom (targetJavaClass , sourceClassName )) {
174174 return Optional .of (
175- StaticLinkageError .errorInaccessibleClass (
175+ SymbolNotResolvable .errorInaccessibleClass (
176176 reference , classFileLocation , isSourceClassReachable ));
177177 }
178178
179179 if (targetJavaClass .isInterface () != reference .isInterfaceMethod ()) {
180180 return Optional .of (
181- StaticLinkageError .errorIncompatibleClassChange (
181+ SymbolNotResolvable .errorIncompatibleClassChange (
182182 reference , classFileLocation , isSourceClassReachable ));
183183 }
184184
@@ -197,7 +197,7 @@ Optional<StaticLinkageError<MethodSymbolReference>> checkLinkageErrorMissingMeth
197197 && method .getSignature ().equals (reference .getDescriptor ())) {
198198 if (!isMemberAccessibleFrom (javaClass , method , sourceClassName )) {
199199 return Optional .of (
200- StaticLinkageError .errorInaccessibleMember (
200+ SymbolNotResolvable .errorInaccessibleMember (
201201 reference , classFileLocation , isSourceClassReachable ));
202202 }
203203 // The method is found and accessible. Returning no error.
@@ -208,14 +208,14 @@ Optional<StaticLinkageError<MethodSymbolReference>> checkLinkageErrorMissingMeth
208208
209209 // The class is in class path but the symbol is not found
210210 return Optional .of (
211- StaticLinkageError .errorMissingMember (
211+ SymbolNotResolvable .errorMissingMember (
212212 reference , classFileLocation , isSourceClassReachable ));
213213 } catch (ClassNotFoundException ex ) {
214214 if (classDumper .catchesNoClassDefFoundError (reference )) {
215215 return Optional .empty ();
216216 }
217217 return Optional .of (
218- StaticLinkageError .errorMissingTargetClass (reference , isSourceClassReachable ));
218+ SymbolNotResolvable .errorMissingTargetClass (reference , isSourceClassReachable ));
219219 }
220220 }
221221
@@ -225,7 +225,7 @@ Optional<StaticLinkageError<MethodSymbolReference>> checkLinkageErrorMissingMeth
225225 * Optional}.
226226 */
227227 @ VisibleForTesting
228- Optional <StaticLinkageError <FieldSymbolReference >> checkLinkageErrorMissingFieldAt (
228+ Optional <SymbolNotResolvable <FieldSymbolReference >> checkLinkageErrorMissingFieldAt (
229229 FieldSymbolReference reference ) {
230230 String targetClassName = reference .getTargetClassName ();
231231 String sourceClassName = reference .getSourceClassName ();
@@ -236,7 +236,7 @@ Optional<StaticLinkageError<FieldSymbolReference>> checkLinkageErrorMissingField
236236 Path classFileLocation = classDumper .findClassLocation (targetClassName );
237237 if (!isClassAccessibleFrom (targetJavaClass , sourceClassName )) {
238238 return Optional .of (
239- StaticLinkageError .errorInaccessibleClass (
239+ SymbolNotResolvable .errorInaccessibleClass (
240240 reference , classFileLocation , isSourceClassReachable ));
241241 }
242242
@@ -245,7 +245,7 @@ Optional<StaticLinkageError<FieldSymbolReference>> checkLinkageErrorMissingField
245245 if (field .getName ().equals (fieldName )) {
246246 if (!isMemberAccessibleFrom (javaClass , field , sourceClassName )) {
247247 return Optional .of (
248- StaticLinkageError .errorInaccessibleMember (
248+ SymbolNotResolvable .errorInaccessibleMember (
249249 reference , classFileLocation , isSourceClassReachable ));
250250 }
251251 // The field is found and accessible. Returning no error.
@@ -255,14 +255,14 @@ Optional<StaticLinkageError<FieldSymbolReference>> checkLinkageErrorMissingField
255255 }
256256 // The field was not found in the class from the classpath
257257 return Optional .of (
258- StaticLinkageError .errorMissingMember (
258+ SymbolNotResolvable .errorMissingMember (
259259 reference , classFileLocation , isSourceClassReachable ));
260260 } catch (ClassNotFoundException ex ) {
261261 if (classDumper .catchesNoClassDefFoundError (reference )) {
262262 return Optional .empty ();
263263 }
264264 return Optional .of (
265- StaticLinkageError .errorMissingTargetClass (reference , isSourceClassReachable ));
265+ SymbolNotResolvable .errorMissingTargetClass (reference , isSourceClassReachable ));
266266 }
267267 }
268268
@@ -315,7 +315,7 @@ private boolean isMemberAccessibleFrom(
315315 * Optional}.
316316 */
317317 @ VisibleForTesting
318- Optional <StaticLinkageError <ClassSymbolReference >> checkLinkageErrorMissingClassAt (
318+ Optional <SymbolNotResolvable <ClassSymbolReference >> checkLinkageErrorMissingClassAt (
319319 ClassSymbolReference reference ) {
320320 String sourceClassName = reference .getSourceClassName ();
321321 String targetClassName = reference .getTargetClassName ();
@@ -328,13 +328,13 @@ Optional<StaticLinkageError<ClassSymbolReference>> checkLinkageErrorMissingClass
328328 && !classDumper .hasValidSuperclass (
329329 classDumper .loadJavaClass (sourceClassName ), targetClass )) {
330330 return Optional .of (
331- StaticLinkageError .errorIncompatibleClassChange (
331+ SymbolNotResolvable .errorIncompatibleClassChange (
332332 reference , classFileLocation , isSourceClassReachable ));
333333 }
334334
335335 if (!isClassAccessibleFrom (targetClass , sourceClassName )) {
336336 return Optional .of (
337- StaticLinkageError .errorInaccessibleClass (
337+ SymbolNotResolvable .errorInaccessibleClass (
338338 reference , classFileLocation , isSourceClassReachable ));
339339 }
340340 return Optional .empty ();
@@ -345,7 +345,7 @@ Optional<StaticLinkageError<ClassSymbolReference>> checkLinkageErrorMissingClass
345345 return Optional .empty ();
346346 }
347347 return Optional .of (
348- StaticLinkageError .errorMissingTargetClass (reference , isSourceClassReachable ));
348+ SymbolNotResolvable .errorMissingTargetClass (reference , isSourceClassReachable ));
349349 }
350350 }
351351
0 commit comments