Skip to content

Commit c1654ce

Browse files
authored
Revert "Java: Fix cartesian product"
1 parent 2593120 commit c1654ce

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@ 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+
1925
// Uses ClassOrInterface as type for thrownType to also cover case where erroneously an interface
2026
// type is declared as thrown exception
2127
from ThrowsTag throwsTag, ClassOrInterface thrownType, Callable docMethod
2228
where
2329
getTaggedType(throwsTag) = thrownType and
2430
docMethod.getDoc().getJavadoc().getAChild*() = throwsTag and
25-
not thrownType instanceof UncheckedThrowableType and
26-
not docMethod.getAnException().getType().getADescendant() = thrownType
31+
not canThrow(docMethod, thrownType)
2732
select throwsTag,
2833
"Javadoc for " + docMethod + " claims to throw " + thrownType.getName() +
2934
" but this is impossible."

0 commit comments

Comments
 (0)