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
33import semmle.code.java.frameworks.javaee.Persistence
44import semmle.code.java.frameworks.JAXB
55import semmle.code.java.frameworks.jackson.JacksonSerializability
6+ import semmle.code.java.frameworks.javaee.Persistence
67
78/**
89 * A field that is from a source file.
@@ -161,10 +162,10 @@ class JpaReadField extends ReflectivelyReadField {
161162 this = entity .getAField ( ) and
162163 (
163164 entity .getAccessType ( ) = "field" or
164- this .hasAnnotation ( "javax.persistence" , "Access" )
165+ this .hasAnnotation ( getAPersistencePackageName ( ) , "Access" )
165166 )
166167 |
167- not this .hasAnnotation ( "javax.persistence" , "Transient" ) and
168+ not this .hasAnnotation ( getAPersistencePackageName ( ) , "Transient" ) and
168169 not this .isStatic ( ) and
169170 not this .isFinal ( )
170171 )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import semmle.code.java.deadcode.StrutsEntryPoints
77import semmle.code.java.deadcode.TestEntryPoints
88import semmle.code.java.deadcode.WebEntryPoints
99import semmle.code.java.frameworks.javaee.JavaServerFaces
10+ import semmle.code.java.frameworks.javaee.Persistence
1011import semmle.code.java.frameworks.JAXB
1112import semmle.code.java.frameworks.JaxWS
1213import semmle.code.java.JMX
@@ -395,7 +396,7 @@ class PersistencePropertyMethod extends CallableEntryPoint {
395396 this = e .getACallable ( ) and
396397 (
397398 e .getAccessType ( ) = "property" or
398- this .hasAnnotation ( "javax.persistence" , "Access" )
399+ this .hasAnnotation ( getAPersistencePackageName ( ) , "Access" )
399400 ) and
400401 (
401402 this .getName ( ) .matches ( "get%" ) or
Original file line number Diff line number Diff line change 44
55import java
66
7- private string getAPersistencePackageName ( ) {
7+ /**
8+ * Gets a JavaEE Persistence API package name.
9+ */
10+ string getAPersistencePackageName ( ) {
811 result = [ "javax.persistence" , "jakarta.persistence" ]
912}
1013
You can’t perform that action at this time.
0 commit comments