File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
java/ql/lib/semmle/code/java Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import semmle.code.java.deadcode.DeadCode
3
3
import semmle.code.java.frameworks.javaee.Persistence
4
4
import semmle.code.java.frameworks.JAXB
5
5
import semmle.code.java.frameworks.jackson.JacksonSerializability
6
+ import semmle.code.java.frameworks.javaee.Persistence
6
7
7
8
/**
8
9
* A field that is from a source file.
@@ -161,10 +162,10 @@ class JpaReadField extends ReflectivelyReadField {
161
162
this = entity .getAField ( ) and
162
163
(
163
164
entity .getAccessType ( ) = "field" or
164
- this .hasAnnotation ( "javax.persistence" , "Access" )
165
+ this .hasAnnotation ( getAPersistencePackageName ( ) , "Access" )
165
166
)
166
167
|
167
- not this .hasAnnotation ( "javax.persistence" , "Transient" ) and
168
+ not this .hasAnnotation ( getAPersistencePackageName ( ) , "Transient" ) and
168
169
not this .isStatic ( ) and
169
170
not this .isFinal ( )
170
171
)
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import semmle.code.java.deadcode.StrutsEntryPoints
7
7
import semmle.code.java.deadcode.TestEntryPoints
8
8
import semmle.code.java.deadcode.WebEntryPoints
9
9
import semmle.code.java.frameworks.javaee.JavaServerFaces
10
+ import semmle.code.java.frameworks.javaee.Persistence
10
11
import semmle.code.java.frameworks.JAXB
11
12
import semmle.code.java.frameworks.JaxWS
12
13
import semmle.code.java.JMX
@@ -395,7 +396,7 @@ class PersistencePropertyMethod extends CallableEntryPoint {
395
396
this = e .getACallable ( ) and
396
397
(
397
398
e .getAccessType ( ) = "property" or
398
- this .hasAnnotation ( "javax.persistence" , "Access" )
399
+ this .hasAnnotation ( getAPersistencePackageName ( ) , "Access" )
399
400
) and
400
401
(
401
402
this .getName ( ) .matches ( "get%" ) or
Original file line number Diff line number Diff line change 4
4
5
5
import java
6
6
7
- private string getAPersistencePackageName ( ) {
7
+ /**
8
+ * Gets a JavaEE Persistence API package name.
9
+ */
10
+ string getAPersistencePackageName ( ) {
8
11
result = [ "javax.persistence" , "jakarta.persistence" ]
9
12
}
10
13
You can’t perform that action at this time.
0 commit comments