Skip to content

Commit e865d07

Browse files
authored
Merge pull request #19187 from smowton/smowton/feature/jakarta-persistence
Java: generalise `javax.persistence` models to also recognise `jakarta.persistence`.
2 parents f461763 + 77e4d9e commit e865d07

File tree

8 files changed

+258
-165
lines changed

8 files changed

+258
-165
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* All existing modelling and support for `javax.persistence` now applies to `jakarta.persistence` as well.

java/ql/lib/semmle/code/java/deadcode/DeadField.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ class JpaReadField extends ReflectivelyReadField {
161161
this = entity.getAField() and
162162
(
163163
entity.getAccessType() = "field" or
164-
this.hasAnnotation("javax.persistence", "Access")
164+
this.hasAnnotation(getAPersistencePackageName(), "Access")
165165
)
166166
|
167-
not this.hasAnnotation("javax.persistence", "Transient") and
167+
not this.hasAnnotation(getAPersistencePackageName(), "Transient") and
168168
not this.isStatic() and
169169
not this.isFinal()
170170
)

java/ql/lib/semmle/code/java/deadcode/EntryPoints.qll

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import semmle.code.java.deadcode.StrutsEntryPoints
77
import semmle.code.java.deadcode.TestEntryPoints
88
import semmle.code.java.deadcode.WebEntryPoints
99
import semmle.code.java.frameworks.javaee.JavaServerFaces
10+
import semmle.code.java.frameworks.javaee.Persistence
1011
import semmle.code.java.frameworks.JAXB
1112
import semmle.code.java.frameworks.JaxWS
1213
import 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

0 commit comments

Comments
 (0)