Skip to content

Commit 76a4114

Browse files
authored
Merge pull request github#6594 from smowton/smowton/fix/stub-arrays-and-bounds
Move unreachable cases of IndirectType into getAContainedType
2 parents d22620f + c259d02 commit 76a4114

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

java/ql/src/utils/Stubs.qll

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88
import java
99

1010
/** A type that should be in the generated code. */
11-
abstract private class GeneratedType extends RefType {
11+
abstract private class GeneratedType extends ClassOrInterface {
1212
GeneratedType() {
13-
(
14-
this instanceof Interface
15-
or
16-
this instanceof Class
17-
) and
1813
not this instanceof AnonymousClass and
1914
not this instanceof LocalClass and
2015
not this.getPackage() instanceof ExcludedPackage
@@ -134,17 +129,13 @@ private class IndirectType extends GeneratedType {
134129
or
135130
this = any(GeneratedType t).getSourceDeclaration()
136131
or
137-
exists(GeneratedType t | this = t.(BoundedType).getATypeBound().getType())
138-
or
139132
exists(GeneratedDeclaration decl |
140133
decl.(Member).getDeclaringType().getSourceDeclaration() = this
141134
)
142135
or
143136
this.(NestedType).getEnclosingType() instanceof GeneratedType
144137
or
145138
exists(NestedType nt | nt instanceof GeneratedType and this = nt.getEnclosingType())
146-
or
147-
this = any(GeneratedType a).(Array).getComponentType()
148139
}
149140
}
150141

@@ -156,6 +147,10 @@ private Type getAContainedType(Type t) {
156147
result = t
157148
or
158149
result = getAContainedType(t.(ParameterizedType).getATypeArgument())
150+
or
151+
result = getAContainedType(t.(Array).getElementType())
152+
or
153+
result = getAContainedType(t.(BoundedType).getATypeBound().getType())
159154
}
160155

161156
/**

0 commit comments

Comments
 (0)