Skip to content

Commit 06238dd

Browse files
authored
Improve reflective class names
1 parent 011666b commit 06238dd

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

java/ql/lib/semmle/code/java/Reflection.qll

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class NewInstance extends MethodCall {
304304
}
305305

306306
/**
307-
* A `MethodCall` on a `Class` element.
307+
* A `MethodCall` on a `Class` instance.
308308
*/
309309
class ClassMethodCall extends MethodCall {
310310
ClassMethodCall() { this.getCallee().getDeclaringType() instanceof TypeClass }
@@ -326,34 +326,34 @@ deprecated class ClassMethodAccess = ClassMethodCall;
326326
/**
327327
* A call to `Class.getConstructors(..)` or `Class.getDeclaredConstructors(..)`.
328328
*/
329-
class ReflectiveConstructorsCall extends ClassMethodCall {
330-
ReflectiveConstructorsCall() {
329+
class ReflectiveGetConstructorsCall extends ClassMethodCall {
330+
ReflectiveGetConstructorsCall() {
331331
this.getCallee().hasName("getConstructors") or
332332
this.getCallee().hasName("getDeclaredConstructors")
333333
}
334334
}
335335

336-
/** DEPRECATED: Alias for `ReflectiveConstructorsCall`. */
337-
deprecated class ReflectiveConstructorsAccess = ReflectiveConstructorsCall;
336+
/** DEPRECATED: Alias for `ReflectiveGetConstructorsCall`. */
337+
deprecated class ReflectiveConstructorsAccess = ReflectiveGetConstructorsCall;
338338

339339
/**
340340
* A call to `Class.getMethods(..)` or `Class.getDeclaredMethods(..)`.
341341
*/
342-
class ReflectiveMethodsCall extends ClassMethodCall {
343-
ReflectiveMethodsCall() {
342+
class ReflectiveGetMethodsCall extends ClassMethodCall {
343+
ReflectiveGetMethodsCall() {
344344
this.getCallee().hasName("getMethods") or
345345
this.getCallee().hasName("getDeclaredMethods")
346346
}
347347
}
348348

349-
/** DEPRECATED: Alias for `ReflectiveMethodsCall`. */
350-
deprecated class ReflectiveMethodsAccess = ReflectiveMethodsCall;
349+
/** DEPRECATED: Alias for `ReflectiveGetMethodsCall`. */
350+
deprecated class ReflectiveMethodsAccess = ReflectiveGetMethodsCall;
351351

352352
/**
353353
* A call to `Class.getMethod(..)` or `Class.getDeclaredMethod(..)`.
354354
*/
355-
class ReflectiveMethodCall extends ClassMethodCall {
356-
ReflectiveMethodCall() {
355+
class ReflectiveGetMethodCall extends ClassMethodCall {
356+
ReflectiveGetMethodCall() {
357357
this.getCallee().hasName("getMethod") or
358358
this.getCallee().hasName("getDeclaredMethod")
359359
}
@@ -378,14 +378,14 @@ class ReflectiveMethodCall extends ClassMethodCall {
378378
}
379379
}
380380

381-
/** DEPRECATED: Alias for `ReflectiveMethodCall`. */
382-
deprecated class ReflectiveMethodAccess = ReflectiveMethodCall;
381+
/** DEPRECATED: Alias for `ReflectiveGetMethodCall`. */
382+
deprecated class ReflectiveMethodAccess = ReflectiveGetMethodCall;
383383

384384
/**
385385
* A call to `Class.getAnnotation(..)`.
386386
*/
387-
class ReflectiveAnnotationCall extends ClassMethodCall {
388-
ReflectiveAnnotationCall() { this.getCallee().hasName("getAnnotation") }
387+
class ReflectiveGetAnnotationCall extends ClassMethodCall {
388+
ReflectiveGetAnnotationCall() { this.getCallee().hasName("getAnnotation") }
389389

390390
/**
391391
* Gets a possible annotation type for this reflective annotation access.
@@ -395,14 +395,14 @@ class ReflectiveAnnotationCall extends ClassMethodCall {
395395
}
396396
}
397397

398-
/** DEPRECATED: Alias for `ReflectiveAnnotationCall`. */
399-
deprecated class ReflectiveAnnotationAccess = ReflectiveAnnotationCall;
398+
/** DEPRECATED: Alias for `ReflectiveGetAnnotationCall`. */
399+
deprecated class ReflectiveAnnotationAccess = ReflectiveGetAnnotationCall;
400400

401401
/**
402402
* A call to `Class.getField(..)` that accesses a field.
403403
*/
404-
class ReflectiveFieldCall extends ClassMethodCall {
405-
ReflectiveFieldCall() {
404+
class ReflectiveGetFieldCall extends ClassMethodCall {
405+
ReflectiveGetFieldCall() {
406406
this.getCallee().hasName("getField") or
407407
this.getCallee().hasName("getDeclaredField")
408408
}
@@ -424,5 +424,5 @@ class ReflectiveFieldCall extends ClassMethodCall {
424424
}
425425
}
426426

427-
/** DEPRECATED: Alias for `ReflectiveFieldCall`. */
428-
deprecated class ReflectiveFieldAccess = ReflectiveFieldCall;
427+
/** DEPRECATED: Alias for `ReflectiveGetFieldCall`. */
428+
deprecated class ReflectiveFieldAccess = ReflectiveGetFieldCall;

java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ private module Impl {
267267

268268
/** Holds if `f` can have any sign. */
269269
predicate fieldWithUnknownSign(Field f) {
270-
exists(ReflectiveFieldCall rfa | rfa.inferAccessedField() = f)
270+
exists(ReflectiveGetFieldCall rfa | rfa.inferAccessedField() = f)
271271
}
272272

273273
/** Holds if `f` is accessed in an increment operation. */

java/ql/lib/semmle/code/java/deadcode/DeadCode.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class LiveClass extends SourceClassOrInterface {
173173
exists(NestedType r | r.getEnclosingType() = this | r instanceof LiveClass)
174174
or
175175
// An annotation on the class is reflectively accessed.
176-
exists(ReflectiveAnnotationCall reflectiveAnnotationCall |
176+
exists(ReflectiveGetAnnotationCall reflectiveAnnotationCall |
177177
this = reflectiveAnnotationCall.getInferredClassType() and
178178
isLive(reflectiveAnnotationCall.getEnclosingCallable())
179179
)

java/ql/lib/semmle/code/java/deadcode/DeadField.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class JUnitAnnotatedField extends ReflectivelyReadField {
130130
*/
131131
class ClassReflectivelyReadField extends ReflectivelyReadField {
132132
ClassReflectivelyReadField() {
133-
exists(ReflectiveFieldCall fieldAccess | this = fieldAccess.inferAccessedField())
133+
exists(ReflectiveGetFieldCall fieldAccess | this = fieldAccess.inferAccessedField())
134134
}
135135
}
136136

java/ql/lib/semmle/code/java/deadcode/EntryPoints.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,16 @@ class NewInstanceCall extends EntryPoint, NewInstance {
164164
/**
165165
* A call to either `Class.getMethod(...)` or `Class.getDeclaredMethod(...)`.
166166
*/
167-
class ReflectiveMethodCallEntryPoint extends EntryPoint, ReflectiveMethodCall {
167+
class ReflectiveGetMethodCallEntryPoint extends EntryPoint, ReflectiveGetMethodCall {
168168
override Method getALiveCallable() {
169169
result = this.inferAccessedMethod() and
170170
// The `getMethod(...)` call must be used in a live context.
171171
isLive(this.getEnclosingCallable())
172172
}
173173
}
174174

175-
/** DEPRECATED: Alias for `ReflectiveMethodCallEntryPoint`. */
176-
deprecated class ReflectiveMethodAccessEntryPoint = ReflectiveMethodCallEntryPoint;
175+
/** DEPRECATED: Alias for `ReflectiveGetMethodCallEntryPoint`. */
176+
deprecated class ReflectiveMethodAccessEntryPoint = ReflectiveGetMethodCallEntryPoint;
177177

178178
/**
179179
* Classes that are entry points recognised by annotations.

java/ql/src/experimental/Security/CWE/CWE-470/UnsafeReflection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ module UnsafeReflectionConfig implements DataFlow::ConfigSig {
4545
// Qualifier -> return of Class.getDeclaredConstructors/Methods and similar
4646
exists(MethodCall ma |
4747
(
48-
ma instanceof ReflectiveConstructorsCall or
49-
ma instanceof ReflectiveMethodsCall
48+
ma instanceof ReflectiveGetConstructorsCall or
49+
ma instanceof ReflectiveGetMethodsCall
5050
) and
5151
ma.getQualifier() = pred.asExpr() and
5252
ma = succ.asExpr()

0 commit comments

Comments
 (0)