Is there any tool which can list all static fields in source code. It is difficult to write reliable regular expression, because static field definition may have several formats, different initializers, may be spanned across several lines with line cut in many positions.
In addition, in list there should be not static methods, "static" string constants, and "static" being substring of identifier name.
I need this functionality for analyze potential GC roots or state sharing fields. I use JProfiler, but it displays only static fields for classes currently loaded by Class Loader, but I have many classes which aren't loaded during runtime yet, or it is cumbersome to make them all loaded on runtime.
I would like to have a full list of static fields from source code, so I can group them into several categories afterwards:
- final and not final fields
- Initialized by constant value or not constant value
- etc.
GENERATE_XML
andEXTRACT_STATIC
(and maybeEXTRACT_ALL
and others depending on what has been documented) and postprocess the resulting xml files.