apache / apache/maven-dependency-plugin

[MDEP-646] mvn dependency:analyze mistakenly treat backward compatible classes as used undeclared

Open
#1,077 1 comment 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[John Lin](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=johnlinp)** opened **[MDEP-646](https://issues.apache.org/jira/browse/MDEP-646?redirect=false)** and commented

I have the following dependency in my `pom.xml`:

```

org.apache.cassandra
cassandra-all
2.1.8

```

Then a piece of code in my app:

```
import java.util.concurrent.ConcurrentHashMap;

public class App {
public void foo () {
ConcurrentHashMap m = new ConcurrentHashMap<>();
...
}
}
```

Then `mvn dependency:analyze` will find a used undeclared dependency:

```
[WARNING] Used undeclared dependencies found:
[WARNING] com.boundary:high-scale-lib:jar:1.0.6:compile
```

It turns out that `cassandra-all` has a dependency on `high-scale-lib`, and `high-scale-lib` implemented a `java.util.concurrent.ConcurrentHashMap` for backward compatibility.

In fact, my app use the built-in `ConcurrentHashMap` in JDK, not the `ConcurrentHashMap` from `high-scale-lib`. So I believe that it is incorrect for the dependency analysis to report it as used.

---

**Affects:** 3.1.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the report with the pom.xml dependency on org.apache.cassandra:cassandra-all:2.1.8 and the App example using java.util.concurrent.ConcurrentHashMap, then run mvn dependency:analyze. Compare the JDK class with high-scale-lib's backward-compatible class and trace why the analyzer treats the transitive dependency as used. Done means the built-in JDK usage is no longer reported as an undeclared high-scale-lib dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.