remove redundant cast where the type is enforced by an equality comparison

This commit is contained in:
Erik Krogh Kristensen
2021-10-28 18:08:20 +02:00
parent e75448ebb0
commit 15c90adec5
19 changed files with 26 additions and 30 deletions

View File

@@ -150,7 +150,7 @@ private module ControlFlowGraphImpl {
* `TypeThrowable` which results in both `TypeError` and `TypeRuntimeException`.
*/
UncheckedThrowableType getAnUncheckedSubtype() {
result = this.(UncheckedThrowableType)
result = this
or
result instanceof TypeError and this instanceof TypeThrowable
or

View File

@@ -665,7 +665,7 @@ final class GenericTypeNode extends PrintAstNode, TGenericTypeNode {
override Location getLocation() { none() }
override ElementNode getChild(int childIndex) {
result.getElement().(TypeVariable) = ty.getTypeParameter(childIndex)
result.getElement() = ty.getTypeParameter(childIndex)
}
/**
@@ -686,7 +686,7 @@ final class GenericCallableNode extends PrintAstNode, TGenericCallableNode {
override string toString() { result = "(Generic Parameters)" }
override ElementNode getChild(int childIndex) {
result.getElement().(TypeVariable) = c.getTypeParameter(childIndex)
result.getElement() = c.getTypeParameter(childIndex)
}
/**

View File

@@ -54,7 +54,7 @@ class JaxbType extends Class {
this.getAnAnnotation() = a and
a.getType().(JaxbAnnotationType).hasName("XmlAccessorType")
|
result.getAnAccess() = a.getValue("value").(VarAccess)
result.getAnAccess() = a.getValue("value")
)
}

View File

@@ -395,9 +395,7 @@ class MavenRepo extends Folder {
/**
* Gets a Jar file contained within this repository.
*/
File getAJarFile() {
result = this.getAChildContainer*().(File) and result.getExtension() = "jar"
}
File getAJarFile() { result = this.getAChildContainer*() and result.getExtension() = "jar" }
/**
* Gets any jar artifacts in this repository that match the POM project definition. This is an

View File

@@ -159,7 +159,7 @@ predicate badMethodAccessLockOrder(
MethodAccess outerAccess, MethodAccess innerAccess, MethodAccess other
) {
exists(Synched outer, Synched inner |
inner.(MethodAccess) = innerAccess and
inner = innerAccess and
inner = outer.getInnerSynch() and
inner.getLockType() = outer.getLockType() and
exists(Parameter p, int i | outer.(Method).getAParameter() = p and p.getPosition() = i |