File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
java/ql/src/Advisory/Documentation Expand file tree Collapse file tree 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) {
1616 exists ( ImportType i | i .getFile ( ) = tag .getFile ( ) | i .getImportedType ( ) = result )
1717}
1818
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
3022where
3123 getTaggedType ( throwsTag ) = thrownType and
3224 docMethod .getDoc ( ) .getJavadoc ( ) .getAChild * ( ) = throwsTag and
33- not canThrow ( docMethod , thrownType )
25+ not thrownType instanceof UncheckedThrowableType and
26+ not docMethod .getAnException ( ) .getType ( ) .getADescendant ( ) = thrownType
3427select throwsTag ,
3528 "Javadoc for " + docMethod + " claims to throw " + thrownType .getName ( ) +
3629 " but this is impossible."
You can’t perform that action at this time.
0 commit comments