Pankraz76 commented on code in PR #2404: URL: https://github.com/apache/maven/pull/2404#discussion_r2113622004
########## src/mdo/java/WrapperProperties.java: ########## @@ -45,30 +50,44 @@ class WrapperProperties extends Properties { final Supplier<Map<String, String>> getter; final Consumer<Properties> setter; + private final OrderedProperties orderedProps = new OrderedProperties(); + private boolean initialized = false; WrapperProperties(Supplier<Map<String, String>> getter, Consumer<Properties> setter) { this.getter = getter; this.setter = setter; } + private synchronized void ensureInitialized() { + if (!initialized) { + Map<String, String> initial = getter.get(); + orderedProps.putAll(initial); + initialized = true; + } + } + @Override public String getProperty(String key) { - return getter.get().get(key); + ensureInitialized(); Review Comment: why not call once in constructor or post construct, as we mimic `CDI`? this seems redundant. - https://stackoverflow.com/questions/8519187/spring-postconstruct-vs-init-method-attribute - https://docs.oracle.com/javase/8/docs/api/javax/annotation/PostConstruct.html -- 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