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

@@ -25,7 +25,7 @@ predicate usefulUpcast(CastExpr e) {
other.getName() = target.getName() and
other.getSourceDeclaration() != target.getSourceDeclaration()
|
c.(MethodAccess).getReceiverType().(RefType).inherits(other.(Method)) or
c.(MethodAccess).getReceiverType().inherits(other.(Method)) or
other = target.(Constructor).getDeclaringType().getAConstructor()
)
)

View File

@@ -45,7 +45,7 @@ private predicate closeableType(RefType t) {
class SqlResourceOpeningMethodAccess extends MethodAccess {
SqlResourceOpeningMethodAccess() {
exists(Method m | this.getMethod() = m |
m.getDeclaringType().(RefType).hasQualifiedName("java.sql", _) and
m.getDeclaringType().hasQualifiedName("java.sql", _) and
m.getReturnType().(RefType).hasQualifiedName("java.sql", _) and
m.getName().regexpMatch("(create|prepare|execute).*") and
closeableType(m.getReturnType()) and