redhat-developer / redhat-developer/vscode-java
IDE fails to resolve correct class when duplicate classes exist across multiple JARs (shaded vs non-shaded)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Description
The class org.apache.hadoop.security.authentication.server.AuthenticationHandler is present in both the jars i have:
- hadoop-client-api.jar (shaded version)
- hadoop-auth.jar (non-shaded version)
In the shaded JAR (hadoop-client-api.jar), AuthenticationHandler references HttpServletRequest from a relocated (shaded) servlet package.
In hadoop-auth.jar, the same class references javax.servlet.HttpServletRequest.
This leads to ambiguous class resolution in VS Code.
In our case, the VS Code Java extension mistakenly resolves the shaded AuthenticationHandler from hadoop-client-api.jar instead of the correct one from hadoop-auth.jar, resulting in a type mismatch when extending the class.
Reference screenshot
Environment
Hadoop version: 3.4.0
Java version: 17.0.16
Build tool: Gradle 8.14
IDE: VS Code with Java extension (vscjava.vscode-gradle 3.17.1)
Steps to Reproduce
- Create a Gradle project depending on two JARs that contain the same class name.
- One JAR uses a shaded package (e.g., org.apache.hadoop.shaded.*).
- Reference the class from the unshaded JAR.
- Observe that VS Code reports type mismatch or class conflict, while Gradle CLI builds successfully.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Gradle reproduction described in the issue, using duplicate classes from shaded and unshaded JARs. Trace how the VS Code Java extension resolves the class compared with the Gradle CLI, and verify completion when the unshaded AuthenticationHandler is selected without a type mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100