A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3763 below:

[java] Ambiguous reference error in valid code · Issue #3763 · pmd/pmd · GitHub

Affects PMD Version: 7.0.0

Make sure, to test with the latest PMD version.

Description:

Java reference resolution reports an ambiguity error where there is none, when a statically imported type shadows a java.lang member.

See https://github.com/pmd/pmd/runs/5091674249?check_suite_focus=true#step:7:9523

Exception Stacktrace:

Reference 'Exception' is ambiguous, both net.sourceforge.pmd.renderers.internal.sarif.SarifLog.Exception and java.lang.Exception match

Code Sample demonstrating the issue:

Container.java

package p;
public class Container { 
  public static class Exception {}
}

Foo.java

import static p.Container.Exception;
public class Foo {
  static {
    Exception e; // should be unambiguously p.Container.Exception 
  }
}
at Foo.java: Reference 'Exception' is ambiguous, both p.Container.Exception and java.lang.Exception match

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4