Skip to content

Commit 6fa18be

Browse files
committed
Fix QLDocs
1 parent 7688f46 commit 6fa18be

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,16 @@ private predicate hasPathAnnotation(Annotatable annotatable) {
148148
}
149149

150150
/**
151-
* Holds if the class inherites the JaxRs `@Path` annotation.
151+
* Holds if the class has or inherits the JaxRs `@Path` annotation.
152152
*/
153153
private predicate hasOrInheritsPathAnnotation(Class c) {
154154
hasPathAnnotation(c)
155155
or
156156
// Note that by the JAX-RS spec, JAX-RS annotations on classes and interfaces
157157
// are not inherited, but some implementations, like Apache CXF, do inherit
158158
// them. I think this only applies if there are no JaxRS annotations on the
159-
// class itself.
159+
// class itself, as that is the rule in the JAX-RS spec for method
160+
// annotations.
160161
hasPathAnnotation(c.getAnAncestor()) and
161162
not exists(c.getAnAnnotation().(JaxRSAnnotation))
162163
}

java/ql/test/library-tests/frameworks/JaxWs/JakartaRs4.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
import jakarta.ws.rs.core.Response;
2525
import jakarta.ws.rs.ext.MessageBodyReader;
2626

27-
// This is not a resource class because it doesn't have a @Path annotation.
28-
// Note that inheritance of class or interface annotations is not supported in
29-
// JAX-RS.
27+
// By the JAX-RS spec, this is not a resource class because it doesn't
28+
// have a @Path annotation. Inheritance of class or interface annotations
29+
// is not supported in JAX-RS. However, this is a resource class for some
30+
// implementations, like Apache CXF, that allow inheritance of JAX-RS
31+
// annotations on classes and interfaces.
3032
public class JakartaRs4 implements JakartaRsInterface { // $ RootResourceClass
3133
public JakartaRs4() { // $ InjectableConstructor
3234
}

java/ql/test/library-tests/frameworks/JaxWs/JaxRs4.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
import javax.ws.rs.core.Response;
2525
import javax.ws.rs.ext.MessageBodyReader;
2626

27-
// This is not a resource class because it doesn't have a @Path annotation.
28-
// Note that inheritance of class or interface annotations is not supported in
29-
// JAX-RS.
27+
// By the JAX-RS spec, this is not a resource class because it doesn't
28+
// have a @Path annotation. Inheritance of class or interface annotations
29+
// is not supported in JAX-RS. However, this is a resource class for some
30+
// implementations, like Apache CXF, that allow inheritance of JAX-RS
31+
// annotations on classes and interfaces.
3032
public class JaxRs4 implements JaxRsInterface { // $ RootResourceClass
3133
public JaxRs4() { // $ InjectableConstructor
3234
}

java/ql/test/library-tests/frameworks/JaxWs/JaxRsInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import javax.ws.rs.core.Response;
2525
import javax.ws.rs.ext.MessageBodyReader;
2626

27-
@Path("/resource") // This annotation has no effect, as class/interface annotations are not inherited in jax-rs
27+
@Path("/resource")
2828
public interface JaxRsInterface {
2929
@GET
3030
int Get(); // $ ResourceMethod

0 commit comments

Comments
 (0)