Skip to content

Commit 683cacb

Browse files
authored
Merge pull request #10640 from atorralba/atorralba/fix-cartesian-product
Java: Fix cartesian product
2 parents ba83b7c + 585cbe2 commit 683cacb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,14 @@ ClassOrInterface getTaggedType(ThrowsTag tag) {
1616
result = tag.getFile().(CompilationUnit).getATypeInScope()
1717
}
1818

19-
predicate canThrow(Callable callable, Class exception) {
20-
exception instanceof UncheckedThrowableType
21-
or
22-
callable.getAnException().getType().getADescendant() = exception
23-
}
24-
2519
// Uses ClassOrInterface as type for thrownType to also cover case where erroneously an interface
2620
// type is declared as thrown exception
2721
from ThrowsTag throwsTag, ClassOrInterface thrownType, Callable docMethod
2822
where
2923
getTaggedType(throwsTag) = thrownType and
3024
docMethod.getDoc().getJavadoc().getAChild*() = throwsTag and
31-
not canThrow(docMethod, thrownType)
25+
not thrownType instanceof UncheckedThrowableType and
26+
not docMethod.getAnException().getType().getADescendant() = thrownType
3227
select throwsTag,
3328
"Javadoc for " + docMethod + " claims to throw " + thrownType.getName() +
3429
" but this is impossible."

0 commit comments

Comments
 (0)