gnodet-bot commented on code in PR #26635:
URL: https://github.com/apache/camel/pull/26635#discussion_r4057556538


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -881,6 +881,64 @@ private static void addRuntimeSpecificDependencies(String 
deps, Set<String> answ
         }
     }
 
+    /** resource:classpath:x or resource:file:x in a route file: the file x is 
referenced by its path. */
+    private static final Pattern RESOURCE_REF_PATTERN = 
Pattern.compile("resource:(?:classpath|file):([^\"'\\s?&,]+)");
+
+    /**
+     * The paths of the files the route files 
(camel.main.routesIncludePattern) reference as resource:classpath: or
+     * resource:file:, as written in the reference (a relative path, or a bare 
name), so the export can keep them where
+     * the reference resolves. A file: route is read from the file system, a 
classpath: route from the classpath.
+     */
+    private Set<String> resourceReferencedFiles(String routeFiles) {

Review Comment:
   💡 **`private static` + `ExportBaseCommand.class.getClassLoader()`:** 
`getScheme()` (the only non-argument dependency) is `protected static` in 
`CamelCommand`, so this method has no instance dependency. The remaining reason 
it is not `static` is `getClass().getClassLoader()`. `getClass()` returns the 
runtime subclass (`Export`, `ExportQuarkus`, …), not `ExportBaseCommand` — the 
classloaders happen to be identical today, but that is an accidental invariant. 
Use `ExportBaseCommand.class.getClassLoader()` and declare the method `private 
static`.
   
   ```suggestion
       private static Set<String> resourceReferencedFiles(String routeFiles) {
   ```



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