File tree 1 file changed +5
-12
lines changed
java/ql/src/Advisory/Documentation
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -16,21 +16,14 @@ RefType getTaggedType(ThrowsTag tag) {
16
16
exists ( ImportType i | i .getFile ( ) = tag .getFile ( ) | i .getImportedType ( ) = result )
17
17
}
18
18
19
- predicate canThrow ( Callable callable , RefType exception ) {
20
- exists ( string uncheckedException |
21
- uncheckedException = "RuntimeException" or uncheckedException = "Error"
22
- |
23
- exception .getAnAncestor ( ) .hasQualifiedName ( "java.lang" , uncheckedException )
24
- )
25
- or
26
- callable .getAnException ( ) .getType ( ) .getADescendant ( ) = exception
27
- }
28
-
29
- from ThrowsTag throwsTag , RefType thrownType , Callable docMethod
19
+ // Uses ClassOrInterface as type for thrownType to also cover case where erroneously an interface
20
+ // type is declared as thrown exception
21
+ from ThrowsTag throwsTag , ClassOrInterface thrownType , Callable docMethod
30
22
where
31
23
getTaggedType ( throwsTag ) = thrownType and
32
24
docMethod .getDoc ( ) .getJavadoc ( ) .getAChild * ( ) = throwsTag and
33
- not canThrow ( docMethod , thrownType )
25
+ not thrownType instanceof UncheckedThrowableType and
26
+ not docMethod .getAnException ( ) .getType ( ) .getADescendant ( ) = thrownType
34
27
select throwsTag ,
35
28
"Javadoc for " + docMethod + " claims to throw " + thrownType .getName ( ) +
36
29
" but this is impossible."
You can’t perform that action at this time.
0 commit comments