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

Skip to content

Commit 7b3acd8

Browse files
committed
(Minor) Add missing this.
1 parent 07f7fd0 commit 7b3acd8

1 file changed

Lines changed: 24 additions & 25 deletions

File tree

  • java/ql/src/semmle/code/java/frameworks

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

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,23 @@ class JaxRsResourceMethod extends Method {
7171
or
7272
// A JaxRS resource method can also inherit these annotations from a supertype, but only if
7373
// there are no JaxRS annotations on the method itself
74-
getAnOverride() instanceof JaxRsResourceMethod and
75-
not exists(getAnAnnotation().(JaxRSAnnotation))
74+
this.getAnOverride() instanceof JaxRsResourceMethod and
75+
not exists(this.getAnAnnotation().(JaxRSAnnotation))
7676
}
7777

7878
/** Gets an `@Produces` annotation that applies to this method */
7979
JaxRSProducesAnnotation getProducesAnnotation() {
80-
result = getAnAnnotation()
80+
result = this.getAnAnnotation()
8181
or
8282
// No direct annotations
83-
not exists(getAnAnnotation().(JaxRSProducesAnnotation)) and
83+
not exists(this.getAnAnnotation().(JaxRSProducesAnnotation)) and
8484
(
8585
// Annotations on a method we've overridden
86-
result = getAnOverride().getAnAnnotation()
86+
result = this.getAnOverride().getAnAnnotation()
8787
or
8888
// No annotations on this method, or a method we've overridden, so look to the class
89-
not exists(getAnOverride().getAnAnnotation().(JaxRSProducesAnnotation)) and
90-
result = getDeclaringType().getAnAnnotation()
89+
not exists(this.getAnOverride().getAnAnnotation().(JaxRSProducesAnnotation)) and
90+
result = this.getDeclaringType().getAnAnnotation()
9191
)
9292
}
9393
}
@@ -120,7 +120,7 @@ class JaxRsResourceClass extends Class {
120120
* annotations leading to this resource method.
121121
*/
122122
JaxRsResourceMethod getAResourceMethod() {
123-
isPublic() and
123+
this.isPublic() and
124124
result = this.getACallable()
125125
}
126126

@@ -129,7 +129,7 @@ class JaxRsResourceClass extends Class {
129129
* but is not a resource method e.g. it is not annotated with `@GET` etc.
130130
*/
131131
Callable getASubResourceLocator() {
132-
result = getAMethod() and
132+
result = this.getAMethod() and
133133
not result instanceof JaxRsResourceMethod and
134134
hasPathAnnotation(result)
135135
}
@@ -148,10 +148,10 @@ class JaxRsResourceClass extends Class {
148148
* (existence of particular parameters).
149149
*/
150150
Constructor getAnInjectableConstructor() {
151-
result = getAConstructor() and
151+
result = this.getAConstructor() and
152152
// JaxRs Spec v2.0 - 3.12
153153
// Only root resources are constructed by the JaxRS container.
154-
isRootResource() and
154+
this.isRootResource() and
155155
// JaxRS can only construct the class using constructors that are public, and where the
156156
// container can provide all of the parameters. This includes the no-arg constructor.
157157
result.isPublic() and
@@ -164,16 +164,16 @@ class JaxRsResourceClass extends Class {
164164
* Gets a Callable that may be executed by the JaxRs container, injecting parameters as required.
165165
*/
166166
Callable getAnInjectableCallable() {
167-
result = getAResourceMethod() or
168-
result = getAnInjectableConstructor() or
169-
result = getASubResourceLocator()
167+
result = this.getAResourceMethod() or
168+
result = this.getAnInjectableConstructor() or
169+
result = this.getASubResourceLocator()
170170
}
171171

172172
/**
173173
* Gets a Field that may be injected with a value by the JaxRs container.
174174
*/
175175
Field getAnInjectableField() {
176-
result = getAField() and
176+
result = this.getAField() and
177177
result.getAnAnnotation() instanceof JaxRsInjectionAnnotation
178178
}
179179
}
@@ -182,7 +182,7 @@ class JaxRsResourceClass extends Class {
182182
class JaxRSAnnotation extends Annotation {
183183
JaxRSAnnotation() {
184184
exists(AnnotationType a |
185-
a = getType() and
185+
a = this.getType() and
186186
a.getPackage().getName().regexpMatch("javax\\.ws\\.rs(\\..*)?")
187187
)
188188
}
@@ -195,7 +195,7 @@ class JaxRSAnnotation extends Annotation {
195195
class JaxRsInjectionAnnotation extends JaxRSAnnotation {
196196
JaxRsInjectionAnnotation() {
197197
exists(AnnotationType a |
198-
a = getType() and
198+
a = this.getType() and
199199
a.getPackage().getName() = getAJaxRsPackage()
200200
|
201201
a.hasName("BeanParam") or
@@ -207,7 +207,7 @@ class JaxRsInjectionAnnotation extends JaxRSAnnotation {
207207
a.hasName("QueryParam")
208208
)
209209
or
210-
getType().hasQualifiedName(getAJaxRsPackage("core"), "Context")
210+
this.getType().hasQualifiedName(getAJaxRsPackage("core"), "Context")
211211
}
212212
}
213213

@@ -241,13 +241,12 @@ class JaxRsClient extends RefType {
241241
class JaxRsBeanParamConstructor extends Constructor {
242242
JaxRsBeanParamConstructor() {
243243
exists(JaxRsResourceClass resourceClass, Callable c, Parameter p |
244-
c = resourceClass.getAnInjectableCallable()
245-
|
244+
c = resourceClass.getAnInjectableCallable() and
246245
p = c.getAParameter() and
247246
p.getAnAnnotation().getType().hasQualifiedName(getAJaxRsPackage(), "BeanParam") and
248247
this.getDeclaringType().getSourceDeclaration() = p.getType().(RefType).getSourceDeclaration()
249248
) and
250-
forall(Parameter p | p = getAParameter() |
249+
forall(Parameter p | p = this.getAParameter() |
251250
p.getAnAnnotation() instanceof JaxRsInjectionAnnotation
252251
)
253252
}
@@ -283,19 +282,19 @@ class MessageBodyReaderRead extends Method {
283282

284283
/** An `@Produces` annotation that describes which content types can be produced by this resource. */
285284
class JaxRSProducesAnnotation extends JaxRSAnnotation {
286-
JaxRSProducesAnnotation() { getType().hasQualifiedName(getAJaxRsPackage(), "Produces") }
285+
JaxRSProducesAnnotation() { this.getType().hasQualifiedName(getAJaxRsPackage(), "Produces") }
287286

288287
/**
289288
* Gets a declared content type that can be produced by this resource.
290289
*/
291290
string getADeclaredContentType() {
292-
result = getAValue().(CompileTimeConstantExpr).getStringValue()
291+
result = this.getAValue().(CompileTimeConstantExpr).getStringValue()
293292
or
294293
exists(Field jaxMediaType |
295294
// Accesses to static fields on `MediaType` class do not have constant strings in the database
296295
// so convert the field name to a content type string
297296
jaxMediaType.getDeclaringType().hasQualifiedName(getAJaxRsPackage("core"), "MediaType") and
298-
jaxMediaType.getAnAccess() = getAValue() and
297+
jaxMediaType.getAnAccess() = this.getAValue() and
299298
// e.g. MediaType.TEXT_PLAIN => text/plain
300299
result = jaxMediaType.getName().toLowerCase().replaceAll("_", "/")
301300
)
@@ -304,7 +303,7 @@ class JaxRSProducesAnnotation extends JaxRSAnnotation {
304303

305304
/** An `@Consumes` annotation that describes content types can be consumed by this resource. */
306305
class JaxRSConsumesAnnotation extends JaxRSAnnotation {
307-
JaxRSConsumesAnnotation() { getType().hasQualifiedName(getAJaxRsPackage(), "Consumes") }
306+
JaxRSConsumesAnnotation() { this.getType().hasQualifiedName(getAJaxRsPackage(), "Consumes") }
308307
}
309308

310309
/**

0 commit comments

Comments
 (0)