RFR: 8236842: Surprising 'multiple elements' behaviour from getTypeElement when cross-compiling with --release [v4]

Jan Lahoda jlahoda at openjdk.java.net
Mon Nov 2 08:15:21 UTC 2020

> Unqualified Elements.getTypeElement(CharSequence) and Elements.getPackageElement(CharSequence) search for elements across all modules in the module graph, and only return a value when they find exactly one element. This is troublesome, as an element (uniquely) visible from a root module may be "hidden" by an element that is not visible from any root module (i.e. is internal to some module that is not in the root module set). The idea proposed here is that these unqualified methods would first look for elements visible from the root modules, and would search the internals of other modules only if nothing would be found in the first round.
> The draft of the corresponding CSR is here: https://bugs.openjdk.java.net/browse/JDK-8253168.

Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'master' into JDK-8236842
 - Linking to root and all modules definition.
 - Merge branch 'master' into JDK-8236842
 - Reflecting review comments - improving javadoc, avoid repeated search of modules that have already been searched.
 - 8253168: Surprising 'multiple elements' behaviour from getTypeElement when cross-compiling with --release


  - all: https://git.openjdk.java.net/jdk/pull/200/files
  - new: https://git.openjdk.java.net/jdk/pull/200/files/33ca56ed..fa0e316a

 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=200&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=200&range=02-03

  Stats: 462759 lines in 4438 files changed: 385829 ins; 55838 del; 21092 mod
  Patch: https://git.openjdk.java.net/jdk/pull/200.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/200/head:pull/200

PR: https://git.openjdk.java.net/jdk/pull/200

More information about the compiler-dev mailing list