mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
remove redundant inline casts
This commit is contained in:
@@ -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()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user