Java: Support CompileTimeConstantExpr
for constant fields from compiled classes
#8650
Marcono1234
started this conversation in
Ideas
Replies: 1 comment
-
This is definitely something that would be nice to have. I don't currently know how easy it would be to extend the extractor to capture this information. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When compiled classes have constant fields, source code referencing them uses the constant value. A simple example for this is the following:
Compiling this class and inspecting it with
javap -v
shows that the value ofInteger.MAX_VALUE
, that is 2147483647, has been stored in the class file (instead of performing a field read). This is also explicitly mentioned in JLS 17 §13.4.9.Currently CodeQL's
CompileTimeConstantExpr
does not support this; I assume because the information is missing from the database. Would it be possible to store this information in the database during extraction?Beta Was this translation helpful? Give feedback.
All reactions