desruisseaux commented on code in PR #2347:
URL: https://github.com/apache/maven/pull/2347#discussion_r2096388431
##########
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolver.java:
##########
@@ -67,6 +67,21 @@
@Named
@Singleton
public class DefaultDependencyResolver implements DependencyResolver {
+ /**
+ * Cache of information about the modules contained in a path element.
+ * This cache is created when first needed. It may be never created.
+ *
+ * <p><b>TODO:</b> This field should not be in this class, because the
cache should be global to the session.
+ * This field exists here only temporarily, until we clarified where to
store session-wide caches.</p>
+ *
+ * @see moduleCache()
+ */
+ private PathModularizationCache moduleCache;
+
+ /**
+ * Creates an initially empty resolver.
+ */
+ public DefaultDependencyResolver() {}
Review Comment:
I'm not sure which change is requested here. Is it to remove the
constructor? It was added only for making explicit what was implicit before. So
this is mostly for documentation purpose.
# Demonstration
Save the following file somewhere:
```java
/**
* A dummy comment.
*/
public class Test {
/**
* Another dummy comment.
*/
public Test() {
}
}
```
Compile as below with a recent Java version (tested with Java 24). The
`-Xdoclint` option is for having warnings about the documentation. The
`-g:none` option is for omitting debugging information, because the line
numbers will change in this demo.
```bash
javac -g:none -Xdoclint:all Test.java
```
Compilation succeed with no warning. Save the output file:
```bash
mv Test.class Test.bak
```
Remove the constructor (including its comment) and recompile with the same
command. Note that we now get the following warning:
```
Test.java:4: warning: use of default constructor, which does not provide a
comment
public class Test {
^
1 warning
```
Compare the output files:
```
diff Test.bak Test.class
```
They are identical. Making the implicit constructor explicit changes nothing
to the compiled code, but is nevertheless recommended according above warning.
--
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]