Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f5a3d3

Browse files
committed
Java: Adjust comment style.
1 parent 2f0b983 commit 0f5a3d3

2 files changed

Lines changed: 24 additions & 54 deletions

File tree

java/ql/src/semmle/code/java/JMX.qll

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,11 @@ class JMXRegistrationMethod extends Method {
6262
getName() = "registerMBean"
6363
)
6464
or
65-
/*
66-
* The `MBeanServer` is often wrapped by an application specific management class, so identify
67-
* methods that wrap a call to another `JMXRegistrationMethod`.
68-
*/
69-
65+
// The `MBeanServer` is often wrapped by an application specific management class, so identify
66+
// methods that wrap a call to another `JMXRegistrationMethod`.
7067
exists(JMXRegistrationCall c |
71-
/*
72-
* This must be a call to another JMX registration method, where the object argument is an access
73-
* of one of the parameters of this method.
74-
*/
75-
68+
// This must be a call to another JMX registration method, where the object argument is an access
69+
// of one of the parameters of this method.
7670
c.getObjectArgument().(VarAccess).getVariable() = getAParameter()
7771
)
7872
}

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

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,15 @@ private Type parameterForSubTypes(ParameterizedType type) {
138138
// Upper bound case
139139
upperBound = arg.(BoundedType).getUpperBoundType()
140140
|
141-
/*
142-
* `T extends Foo` implies that `Foo`, or any sub-type of `Foo`, may be represented.
143-
*/
144-
141+
// `T extends Foo` implies that `Foo`, or any sub-type of `Foo`, may be represented.
145142
result.(RefType).getAnAncestor() = upperBound
146143
)
147144
or
148145
exists(RefType lowerBound |
149146
// Lower bound case
150147
lowerBound = arg.(Wildcard).getLowerBoundType()
151148
|
152-
/*
153-
* `T super Foo` implies that `Foo`, or any super-type of `Foo`, may be represented.
154-
*/
155-
149+
// `T super Foo` implies that `Foo`, or any super-type of `Foo`, may be represented.
156150
lowerBound.(RefType).getAnAncestor() = result
157151
)
158152
)
@@ -165,11 +159,8 @@ Type inferClassParameterType(Expr expr) {
165159
// Must be of type `Class` or `Class<T>`.
166160
expr.getType() instanceof TypeClass and
167161
(
168-
/*
169-
* If this `expr` is a `VarAccess` of a final or effectively final parameter, then look at the
170-
* arguments to calls to this method, to see if we can infer anything from that case.
171-
*/
172-
162+
// If this `expr` is a `VarAccess` of a final or effectively final parameter, then look at the
163+
// arguments to calls to this method, to see if we can infer anything from that case.
173164
exists(Parameter p |
174165
p = expr.(VarAccess).getVariable() and
175166
p.isEffectivelyFinal()
@@ -179,24 +170,18 @@ Type inferClassParameterType(Expr expr) {
179170
or
180171
if exists(pointsToReflectiveClassIdentifier(expr).getReflectivelyIdentifiedClass())
181172
then
182-
/*
183-
* We've been able to identify where this `Class` instance was created, and identified the
184-
* particular class that was loaded.
185-
*/
186-
173+
// We've been able to identify where this `Class` instance was created, and identified the
174+
// particular class that was loaded.
187175
result = pointsToReflectiveClassIdentifier(expr).getReflectivelyIdentifiedClass()
188176
else (
189-
/*
190-
* If we haven't been able to find where the value for this expression was defined, then we
191-
* resort to the type `T` in `Class<T>`.
192-
*
193-
* If `T` refers to a bounded type with an upper bound, then we return all sub-types of the upper
194-
* bound as possibilities for the instantiation, so long as this is not a catch-all type.
195-
*
196-
* A "catch-all" type is something like `? extends Object` or `? extends Serialization`, which
197-
* would return too many sub-types.
198-
*/
199-
177+
// If we haven't been able to find where the value for this expression was defined, then we
178+
// resort to the type `T` in `Class<T>`.
179+
//
180+
// If `T` refers to a bounded type with an upper bound, then we return all sub-types of the upper
181+
// bound as possibilities for the instantiation, so long as this is not a catch-all type.
182+
//
183+
// A "catch-all" type is something like `? extends Object` or `? extends Serialization`, which
184+
// would return too many sub-types.
200185
result = parameterForSubTypes(expr.getType())
201186
)
202187
)
@@ -244,11 +229,8 @@ class NewInstance extends MethodAccess {
244229
else
245230
if getNumArgument() = 1 and getArgument(0).getType() instanceof Array
246231
then
247-
/*
248-
* This is a var-args array argument. If array argument is initialized inline, then identify
249-
* the number of arguments specified in the array.
250-
*/
251-
232+
// This is a var-args array argument. If array argument is initialized inline, then identify
233+
// the number of arguments specified in the array.
252234
if exists(getArgument(0).(ArrayCreationExpr).getInit())
253235
then
254236
// Count the number of elements in the initializer, and find the matching constructors.
@@ -258,11 +240,8 @@ class NewInstance extends MethodAccess {
258240
// Could be any of the constructors on this class.
259241
any()
260242
else
261-
/*
262-
* No var-args in play, just use the number of arguments to the `newInstance(..)` to determine
263-
* which constructors may be called.
264-
*/
265-
243+
// No var-args in play, just use the number of arguments to the `newInstance(..)` to determine
244+
// which constructors may be called.
266245
matchConstructorArguments(result, getNumArgument())
267246
}
268247

@@ -310,11 +289,8 @@ class NewInstance extends MethodAccess {
310289
result = cast.getType()
311290
or
312291
(
313-
/*
314-
* If we cast the result of this method, then this is either the type specified, or a
315-
* sub-type of that type. Make sure we exclude overly generic types such as `Object`.
316-
*/
317-
292+
// If we cast the result of this method, then this is either the type specified, or a
293+
// sub-type of that type. Make sure we exclude overly generic types such as `Object`.
318294
not overlyGenericType(cast.getType()) and
319295
hasSubtype*(cast.getType(), result)
320296
)

0 commit comments

Comments
 (0)