jhaber commented on a change in pull request #20:
URL:
https://github.com/apache/maven-dependency-analyzer/pull/20#discussion_r464543986
##########
File path:
src/main/java/org/apache/maven/shared/dependency/analyzer/DependencyAnalyzer.java
##########
@@ -39,4 +39,7 @@
Set<String> analyze( URL url )
throws IOException;
+
+ Set<DependencyUsage> analyzeWithUsages( URL url )
Review comment:
> Would it make sense to simply make analyze include usages?
How were you thinking that would work, change the return type of `analyze`
method? Isn't that also incompatible? And just to confirm, you're thinking
about the case where someone wrote a custom implementation of
`DependencyAnalyzer` and registered it for use with the dependency plugin?
One option that comes to mind is making `analyzeWithUsages` a default
interface method with an implementation that throws something like
`UnsupportedOperationException`. That way the dependency plugin can try to
gracefully handle this case and fall back to the regular `analyze` method, for
example:
```java
try
{
return dependencyAnalyzer.analyzeWithUsages( url );
}
catch ( UnsupportedOperationException e )
{
log.warn( "Dependency analyzer {} should be updated to implement
analyzeWithUsages", dependencyAnalyzer );
return dependencyAnalyzer.analyze( url );
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]