Skip to content

Instantly share code, notes, and snippets.

@anentropic
Created April 24, 2021 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anentropic/ba2f95dcecabe789bd8c7d414f0f0302 to your computer and use it in GitHub Desktop.
Save anentropic/ba2f95dcecabe789bd8c7d414f0f0302 to your computer and use it in GitHub Desktop.
GraalVM native-image reflection config for Log4J
[
{
"name" : "org.apache.log4j.Category",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "org.apache.log4j.CategoryKey",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "org.apache.log4j.Logger",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "org.apache.log4j.helpers.Loader",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "java.lang.Thread",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
}
]
@anentropic
Copy link
Author

Graal provides a lot of control here over exactly what reflection features are analysed. So I guess this stuff must slow down the compilation and/or the executable and/or bloat the size of the artefact. (otherwise why not turn it on for everything?)

Here I have just enabled maximum reflection for each of the problem classes I encountered.

Probably some time I could go through and try to narrow these down to the minimum... mostly I'm just glad it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment