slawekjaranowski commented on code in PR #216:
URL: https://github.com/apache/maven-enforcer/pull/216#discussion_r1059895450


##########
maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/internal/EnforcerRuleManager.java:
##########
@@ -93,6 +112,16 @@ public List<EnforcerRuleDesc> 
createRules(PlexusConfiguration rules) throws Enfo
 
     private EnforcerRuleDesc createRuleDesc(String name, String 
implementation) throws EnforcerRuleManagerException {
 
+        // component name should always start at lowercase character
+        String ruleName = Character.toLowerCase(name.charAt(0)) + 
name.substring(1);
+
+        try {
+            return new EnforcerRuleDesc(ruleName, 
plexusContainer.lookup(EnforcerRuleBase.class, ruleName));

Review Comment:
   > What is the default scope of Sisu components? How does it work, if the 
same rule is being used more than once with different parameters in parallel? 
Shouldn't rules having the singleton scope lead to a warn at least to prevent 
race conditions with multi-threading?
   
   Component annotated only by `@Named` has `per-lookup` strategy - every 
lookup return new instance of component.
   Rule should not have `@Singleton` annotation.
   We need new rule instance for each execution, each rule object is configured 
again - so we will override items in existing object.
   
   > 
   > What about allowing to reuse rule objects but always pass the current 
parametrisation as argument to the execute method (e.g. for custom rules having 
complex global initialisation)
   
   Rule can depends on other component with `@Singleton` and manage it manually.
   



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to