Query for Java Static Initializer #16838
Answered
by
jketema
mrigankpawagi
asked this question in
Q&A
-
Hi, I am a junior developer and need some help with writing a query to capture the static initializer ( |
Beta Was this translation helpful? Give feedback.
Answered by
jketema
Jun 25, 2024
Replies: 1 comment 2 replies
-
Hi, In the database the static initialiser block becomes a block statement that is part of a static initialiser method. The easiest way I could find to get to it is as follows: from Class c, StaticInitializer i, BlockStmt s
where c.getAMethod() = i and i.getBody().getAChild() = s
select s |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mrigankpawagi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
In the database the static initialiser block becomes a block statement that is part of a static initialiser method. The easiest way I could find to get to it is as follows: