IDE fails to resolve correct class when duplicate classes exist across multiple JARs (shaded vs non-shaded)
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.