ppkarwasz commented on PR #3800:
URL: https://github.com/apache/logging-log4j2/pull/3800#issuecomment-3036135160

   Since we can't add inline comments to JSON files, it's worth providing a 
detailed explanation of this PR here.
   
   There are two main types of non-plugin reflection usage in the codebase:
   
   1. **Class availability checks (e.g., `Loader.isClassAvailable`)**
      These calls are typically used to check whether a class is present on the 
classpath. In theory, we should include an entry in `reflect-config.json` with 
just the `name` property to ensure the class is considered reachable by GraalVM 
and not trimmed.
      However, in the cases I reviewed, such entries would be redundant. For 
example, `YamlConfigurationFactory` uses reflection to check for the presence 
of `com.fasterxml.jackson.dataformat.yaml.YAMLFactory`, but it also references 
`YamlConfiguration`, which directly depends on that same class. So GraalVM will 
already consider it reachable. All `isClassAvailable` usages I found fell into 
this category.
   
   2. **Reflective instantiation (e.g., `Loader.newInstance`)**
      These calls require explicit entries in `reflect-config.json` that 
declare the `<init>` constructor. Even if GraalVM doesn't trim the class 
itself, it won't allow reflective instantiation unless the constructor is 
properly declared in the config. This PR adds such entries where necessary to 
ensure compatibility.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to