ppkarwasz commented on code in PR #3772:
URL: https://github.com/apache/logging-log4j2/pull/3772#discussion_r2173155758


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/GraalVmProcessor.java:
##########
@@ -184,11 +188,21 @@ private void processFactory(Element element) {
     }
 
     private void writeReachabilityMetadata() {
-        //
-        // Many users will have `log4j-core` on the annotation processor path, 
but do not have Log4j Plugins.
-        // Therefore, we check for the annotation processor required options 
only if some elements were processed.
-        //
-        String reachabilityMetadataPath = getReachabilityMetadataPath();
+        // Compute the reachability metadata
+        ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
+        try {
+            ReachabilityMetadata.writeReflectConfig(reachableTypes.values(), 
arrayOutputStream);
+        } catch (IOException e) {
+            String message = String.format(
+                    "%s: an error occurred while generating reachability 
metadata: %s", PROCESSOR_NAME, e.getMessage());
+            processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, 
message);
+            return;
+        }
+        byte[] data = arrayOutputStream.toByteArray();
+
+        Map<String, String> options = processingEnv.getOptions();
+        String reachabilityMetadataPath = getReachabilityMetadataPath(
+                options.get(GROUP_ID), options.get(ARTIFACT_ID), 
Integer.toHexString(Arrays.hashCode(data)));

Review Comment:
   That is a good question:
   
   - Yes, `-` is a valid file name character in Windows (see [What characters 
are forbidden in Windows and Linux directory 
names?](https://stackoverflow.com/q/1976007/11748454).
   - `Integer.toHexString` treats its argument as an **unsigned** integer.



-- 
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