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

Skip to content

Commit ade2934

Browse files
committed
Java: Adjust comment style.
1 parent 24f3099 commit ade2934

14 files changed

Lines changed: 73 additions & 174 deletions

File tree

java/ql/src/semmle/code/java/frameworks/Camel.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ class CamelTargetClass extends Class {
7272
or
7373
exists(CamelJavaDSLMethodDecl methodDecl | this = methodDecl.getABean())
7474
or
75-
/*
76-
* Any beans referred to in Java DSL bean or beanRef elements are considered as possible
77-
* targets. Whether the route builder is ever constructed or called is not considered.
78-
*/
79-
75+
// Any beans referred to in Java DSL bean or beanRef elements are considered as possible
76+
// targets. Whether the route builder is ever constructed or called is not considered.
8077
exists(CamelJavaDSLBeanDecl beanDecl | this = beanDecl.getABeanClass())
8178
or
8279
exists(CamelJavaDSLBeanRefDecl beanRefDecl | this = beanRefDecl.getABeanClass())

java/ql/src/semmle/code/java/frameworks/JAXB.qll

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* Definitions related to JAXB. */
1+
/** Definitions related to JAXB. */
2+
23
import semmle.code.java.Type
34

45
library class JAXBElement extends Class {
@@ -39,11 +40,8 @@ class JaxbType extends Class {
3940
or
4041
hasJaxbAnnotation(this, "XmlRootElement")
4142
or
42-
/*
43-
* There is at least one Jaxb annotation on a member of this class. The `@XmlType` is implied
44-
* on any class, but we limit our identification to those that have some reference to JAXB.
45-
*/
46-
43+
// There is at least one Jaxb annotation on a member of this class. The `@XmlType` is implied
44+
// on any class, but we limit our identification to those that have some reference to JAXB.
4745
exists(AnnotationType at |
4846
at = this.getAMember().getAnAnnotation().getType() and
4947
at instanceof JaxbMemberAnnotation
@@ -189,17 +187,11 @@ class JaxbBoundGetterSetter extends GetterOrSetterMethod {
189187
or
190188
// Within a JAXB type which has an `XmlAcessType` that binds this method.
191189
exists(JaxbType c | this.getDeclaringType() = c |
192-
/*
193-
* If this is a "property" - both a setter and getter present for the XML element or attribute
194-
* - the `XmlAccessType` of the declaring type may cause this property to be bound.
195-
*/
196-
190+
// If this is a "property" - both a setter and getter present for the XML element or attribute
191+
// - the `XmlAccessType` of the declaring type may cause this property to be bound.
197192
isProperty() and
198193
(
199-
/*
200-
* In the `PUBLIC_MEMBER` case all public properties are considered bound.
201-
*/
202-
194+
// In the `PUBLIC_MEMBER` case all public properties are considered bound.
203195
(c.getXmlAccessType().isPublicMember() and isPublic())
204196
or
205197
// In "property" all properties are considered bound.

java/ql/src/semmle/code/java/frameworks/JaxWS.qll

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,8 @@ class JaxRsResourceClass extends Class {
6868
or
6969
// A sub-resource
7070
exists(JaxRsResourceClass resourceClass, Method method |
71-
/*
72-
* This is a sub-resource class is if it is referred to from the sub-resource locator of
73-
* another resource class.
74-
*/
75-
71+
// This is a sub-resource class is if it is referred to from the sub-resource locator of
72+
// another resource class.
7673
method = resourceClass.getASubResourceLocator()
7774
|
7875
this = method.getReturnType()
@@ -118,11 +115,8 @@ class JaxRsResourceClass extends Class {
118115
// JaxRs Spec v2.0 - 3.12
119116
// Only root resources are constructed by the JaxRS container.
120117
isRootResource() and
121-
/*
122-
* JaxRS can only construct the class using constructors that are public, and where the
123-
* container can provide all of the parameters. This includes the no-arg constructor.
124-
*/
125-
118+
// JaxRS can only construct the class using constructors that are public, and where the
119+
// container can provide all of the parameters. This includes the no-arg constructor.
126120
result.isPublic() and
127121
forall(Parameter p | p = result.getAParameter() |
128122
p.getAnAnnotation() instanceof JaxRsInjectionAnnotation

java/ql/src/semmle/code/java/frameworks/Mockito.qll

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,8 @@ class MockitoMockedField extends MockitoAnnotatedField {
142142
exists(MockitoInjectedField injectedField |
143143
injectedField.getDeclaringType() = getDeclaringType()
144144
|
145-
/*
146-
* A `@Mock` is injected if it is used in one of the invoked callables (constructor or
147-
* setter), or injected directly onto a field.
148-
*/
149-
145+
// A `@Mock` is injected if it is used in one of the invoked callables (constructor or
146+
// setter), or injected directly onto a field.
150147
getType().(RefType).getAnAncestor() = injectedField.getAnInvokedCallable().getAParamType() or
151148
getType().(RefType).getAnAncestor() = injectedField.getASetField().getType()
152149
)
@@ -162,11 +159,8 @@ class MockitoInjectedField extends MockitoAnnotatedField {
162159
override predicate isValid() {
163160
super.isValid() and
164161
(
165-
/*
166-
* If we need to initialize the field, it is only valid if the type is a `Class` that is not
167-
* local, is static if it is a nested class, and is not abstract.
168-
*/
169-
162+
// If we need to initialize the field, it is only valid if the type is a `Class` that is not
163+
// local, is static if it is a nested class, and is not abstract.
170164
exists(getInitializer())
171165
or
172166
exists(Class c | c = getType() |
@@ -176,10 +170,7 @@ class MockitoInjectedField extends MockitoAnnotatedField {
176170
)
177171
) and
178172
(
179-
/*
180-
* If neither of these is true, then mockito will fail to initialize this field.
181-
*/
182-
173+
// If neither of these is true, then mockito will fail to initialize this field.
183174
usingConstructorInjection() or
184175
usingPropertyInjection()
185176
)
@@ -223,11 +214,8 @@ class MockitoInjectedField extends MockitoAnnotatedField {
223214
|
224215
if usingConstructorInjection()
225216
then
226-
/*
227-
* If there is no initializer for this field, and there is a most mockable constructor,
228-
* then we are doing a parameterized injection of mocks into a most mockable constructor.
229-
*/
230-
217+
// If there is no initializer for this field, and there is a most mockable constructor,
218+
// then we are doing a parameterized injection of mocks into a most mockable constructor.
231219
result = mockInjectedClass.getAMostMockableConstructor()
232220
else
233221
if usingPropertyInjection()
@@ -239,21 +227,15 @@ class MockitoInjectedField extends MockitoAnnotatedField {
239227
)
240228
or
241229
(
242-
/*
243-
* Perform property injection into setter fields, but only where there exists a mock
244-
* that can be injected into the method. Otherwise, the setter method is never called.
245-
*/
246-
230+
// Perform property injection into setter fields, but only where there exists a mock
231+
// that can be injected into the method. Otherwise, the setter method is never called.
247232
result = mockInjectedClass.getASetterMethod() and
248233
exists(MockitoMockedField mockedField |
249234
mockedField.getDeclaringType() = this.getDeclaringType() and
250235
mockedField.isValid()
251236
|
252-
/*
253-
* We make a simplifying assumption here - in theory, each mock can only be injected
254-
* once, but we instead assume that there are sufficient mocks to go around.
255-
*/
256-
237+
// We make a simplifying assumption here - in theory, each mock can only be injected
238+
// once, but we instead assume that there are sufficient mocks to go around.
257239
mockedField.getType().(RefType).getAnAncestor() = result.getParameterType(0)
258240
)
259241
)
@@ -276,11 +258,8 @@ class MockitoInjectedField extends MockitoAnnotatedField {
276258
mockedField.getDeclaringType() = this.getDeclaringType() and
277259
mockedField.isValid()
278260
|
279-
/*
280-
* We make a simplifying assumption here - in theory, each mock can only be injected
281-
* once, but we instead assume that there are sufficient mocks to go around.
282-
*/
283-
261+
// We make a simplifying assumption here - in theory, each mock can only be injected
262+
// once, but we instead assume that there are sufficient mocks to go around.
284263
mockedField.getType().(RefType).getAnAncestor() = result.getType()
285264
)
286265
else none()

java/ql/src/semmle/code/java/frameworks/Servlets.qll

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,8 @@ class ServletWebXMLListenerType extends RefType {
317317
hasQualifiedName("javax.servlet.http", "HttpSessionAttributeListener") or
318318
hasQualifiedName("javax.servlet.http", "HttpSessionIdListener") or
319319
hasQualifiedName("javax.servlet.http", "HttpSessionListener")
320-
/*
321-
* Listeners that are not configured in `web.xml`:
322-
* - `HttpSessionActivationListener`
323-
* - `HttpSessionBindingListener`
324-
*/
325-
326-
}
320+
// Listeners that are not configured in `web.xml`:
321+
// - `HttpSessionActivationListener`
322+
// - `HttpSessionBindingListener`
323+
}
327324
}

java/ql/src/semmle/code/java/frameworks/camel/CamelJavaDSL.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ class CamelJavaDSLBeanDecl extends ProcessorDefinitionElement {
5959
RefType getABeanClass() {
6060
if getArgument(0).getType() instanceof TypeClass
6161
then
62-
/*
63-
* In this case, we've been given a Class<?>, which implies a Spring Bean of this type
64-
* should be loaded. Infer the type of type parameter.
65-
*/
66-
62+
// In this case, we've been given a Class<?>, which implies a Spring Bean of this type
63+
// should be loaded. Infer the type of type parameter.
6764
result = inferClassParameterType(getArgument(0))
6865
else
6966
// In this case, the object itself is used as the target for the Apache Camel messages.

java/ql/src/semmle/code/java/frameworks/gwt/GWT.qll

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,13 @@ class GwtEntryPointClass extends Class {
3030
* Holds if this entry point is live - that is, whether it is referred to within an XML element.
3131
*/
3232
predicate isLive() {
33-
/*
34-
* We must have a `*.gwt.xml` in order to determine whether a particular `EntryPoint` is enabled.
35-
* In the absence of such a file, we cannot guarantee that `EntryPoint`s without annotations
36-
* are live.
37-
*/
38-
33+
// We must have a `*.gwt.xml` in order to determine whether a particular `EntryPoint` is enabled.
34+
// In the absence of such a file, we cannot guarantee that `EntryPoint`s without annotations
35+
// are live.
3936
isGwtXmlIncluded()
4037
implies
4138
(
42-
/*
43-
* The entry point is live if it is specified in a `*.gwt.xml` file.
44-
*/
45-
39+
// The entry point is live if it is specified in a `*.gwt.xml` file.
4640
exists(getAGwtXmlFile())
4741
)
4842
}

java/ql/src/semmle/code/java/frameworks/jackson/JacksonSerializability.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,8 @@ class JacksonMixedInCallable extends Callable {
204204
result = getATargetType().getACallable() and
205205
if this instanceof Constructor
206206
then
207-
/*
208-
* The mixed in type will have a different name to the target type, so just compare the
209-
* parameters.
210-
*/
211-
207+
// The mixed in type will have a different name to the target type, so just compare the
208+
// parameters.
212209
result.getSignature().suffix(targetType.getName().length()) = getSignature()
213210
.suffix(getDeclaringType().getName().length())
214211
else

java/ql/src/semmle/code/java/frameworks/javaee/Persistence.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ class PersistentEntity extends RefType {
2121
if exists(getAccessTypeFromAnnotation())
2222
then result = getAccessTypeFromAnnotation()
2323
else
24-
/*
25-
* If the access type is not explicit, then the location of the `Id` annotation determines
26-
* which access type is used.
27-
*/
28-
24+
// If the access type is not explicit, then the location of the `Id` annotation determines
25+
// which access type is used.
2926
if getAMethod().hasAnnotation("javax.persistence", "Id")
3027
then result = "property"
3128
else result = "field"

java/ql/src/semmle/code/java/frameworks/spring/SpringAutowire.qll

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ predicate hasInjectAnnotation(Annotatable a) {
2323
*/
2424
class SpringComponentConstructor extends Constructor {
2525
SpringComponentConstructor() {
26-
/*
27-
* Must be a live Spring component.
28-
*/
29-
26+
// Must be a live Spring component.
3027
getDeclaringType().(SpringComponent).isLive() and
3128
(
3229
this.getNumberOfParameters() = 0 or
@@ -63,10 +60,7 @@ class SpringBeanPropertySetterMethod extends Method {
6360
*/
6461
class SpringBeanXMLAutowiredSetterMethod extends Method {
6562
SpringBeanXMLAutowiredSetterMethod() {
66-
/*
67-
* The bean as marked with some form of autowiring in the XML file.
68-
*/
69-
63+
// The bean as marked with some form of autowiring in the XML file.
7064
exists(string xmlAutowire |
7165
xmlAutowire = this.getDeclaringType().(SpringBeanRefType).getSpringBean().getAutowire()
7266
|
@@ -95,11 +89,8 @@ class SpringBeanXMLAutowiredSetterMethod extends Method {
9589
xmlAutowire = "byType"
9690
or
9791
(
98-
/*
99-
* When it is set to autodetect, we use "byType" if there is a no-arg constructor. This
100-
* approach has been removed in Spring 4.x.
101-
*/
102-
92+
// When it is set to autodetect, we use "byType" if there is a no-arg constructor. This
93+
// approach has been removed in Spring 4.x.
10394
xmlAutowire = "autodetect" and
10495
exists(Constructor c | c = this.getDeclaringType().getAConstructor() |
10596
c.getNumberOfParameters() = 0

0 commit comments

Comments
 (0)