remove redundant inline casts

This commit is contained in:
Erik Krogh Kristensen
2021-10-28 16:35:53 +02:00
parent d425b3782e
commit e75448ebb0
38 changed files with 60 additions and 79 deletions

View File

@@ -150,7 +150,7 @@ private Type parameterForSubTypes(ParameterizedType type) {
lowerBound = arg.(Wildcard).getLowerBoundType()
|
// `T super Foo` implies that `Foo`, or any super-type of `Foo`, may be represented.
lowerBound.(RefType).getAnAncestor() = result
lowerBound.getAnAncestor() = result
)
)
}

View File

@@ -93,8 +93,8 @@ class SuppressedConstructor extends Constructor {
not this.isDefaultConstructor() and
// Verify that there is only one statement, which is the `super()` call. This exists
// even for empty constructors.
this.getBody().(BlockStmt).getNumStmt() = 1 and
this.getBody().(BlockStmt).getAStmt().(SuperConstructorInvocationStmt).getNumArgument() = 0 and
this.getBody().getNumStmt() = 1 and
this.getBody().getAStmt().(SuperConstructorInvocationStmt).getNumArgument() = 0 and
// A constructor that is called is not acting to suppress the default constructor. We permit
// calls from suppressed and default constructors - in both cases, they can only come from
// sub-class constructors.

View File

@@ -262,7 +262,7 @@ class ManagedBeanImplEntryPoint extends EntryPoint, RegisteredManagedBeanImpl {
// Find the method that will be called for each method on each managed bean that this class
// implements.
this.inherits(result) and
result.(Method).overrides(this.getAnImplementedManagedBean().getAMethod())
result.overrides(this.getAnImplementedManagedBean().getAMethod())
}
}

View File

@@ -668,7 +668,7 @@ Type inheritsMatchingMethodExceptThrows(SessionEJB ejb, Method m) {
sig = n.getSignature() and
sig = m.getSignature() and
exists(Exception ex | ex = n.getAnException() and not throwsExplicitUncheckedException(n, ex) |
not ex.getType().(RefType).hasSupertype*(m.getAnException().getType()) and
not ex.getType().hasSupertype*(m.getAnException().getType()) and
result = ex.getType()
)
)
@@ -717,7 +717,7 @@ Type inheritsMatchingCreateMethodExceptThrows(StatefulSessionEJB ejb, EjbInterfa
exists(Exception ex |
ex = cm.getAnException() and not throwsExplicitUncheckedException(cm, ex)
|
not ex.getType().(RefType).hasSupertype*(icm.getAnException().getType()) and
not ex.getType().hasSupertype*(icm.getAnException().getType()) and
result = ex.getType()
)
)
@@ -732,7 +732,7 @@ Type inheritsMatchingCreateMethodExceptThrows(StatefulSessionEJB ejb, EjbInterfa
exists(Exception ex |
ex = im.getAnException() and not throwsExplicitUncheckedException(im, ex)
|
not ex.getType().(RefType).hasSupertype*(icm.getAnException().getType()) and
not ex.getType().hasSupertype*(icm.getAnException().getType()) and
result = ex.getType()
)
)

View File

@@ -141,8 +141,7 @@ class ExternalAPIUsedWithUntrustedData extends TExternalAPI {
|
this = TExternalAPIParameter(m, index) and
result =
m.getDeclaringType().(RefType).getQualifiedName() + "." + m.getSignature() + " [" +
indexString + "]"
m.getDeclaringType().getQualifiedName() + "." + m.getSignature() + " [" + indexString + "]"
)
}
}