From 585cbe2b95867156f82706b57a77462b5cc9a1e2 Mon Sep 17 00:00:00 2001 From: Tony Torralba Date: Fri, 30 Sep 2022 10:47:22 +0200 Subject: [PATCH] Fix cartesian product --- .../Advisory/Documentation/ImpossibleJavadocThrows.ql | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql b/java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql index 3111c704b4d3..42fd2049289c 100644 --- a/java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql +++ b/java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql @@ -16,19 +16,14 @@ ClassOrInterface getTaggedType(ThrowsTag tag) { result = tag.getFile().(CompilationUnit).getATypeInScope() } -predicate canThrow(Callable callable, Class exception) { - exception instanceof UncheckedThrowableType - or - callable.getAnException().getType().getADescendant() = exception -} - // Uses ClassOrInterface as type for thrownType to also cover case where erroneously an interface // type is declared as thrown exception from ThrowsTag throwsTag, ClassOrInterface thrownType, Callable docMethod where getTaggedType(throwsTag) = thrownType and docMethod.getDoc().getJavadoc().getAChild*() = throwsTag and - not canThrow(docMethod, thrownType) + not thrownType instanceof UncheckedThrowableType and + not docMethod.getAnException().getType().getADescendant() = thrownType select throwsTag, "Javadoc for " + docMethod + " claims to throw " + thrownType.getName() + " but this is impossible."