Integrated: 8297158: Suspicious collection method call in Types.isSameTypeVisitor
Vicente Romero
vromero at openjdk.org
Tue Jan 31 17:04:31 UTC 2023
On Sun, 29 Jan 2023 02:20:10 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> As reported there is a code in `com.sun.tools.javac.code.Types` that was basically a no-op. The code in question is:
>
>
> if (tMap.containsKey(ti)) {
> throw new AssertionError("Malformed intersection");
> }
> tMap.put(ti.tsym, ti);
>
> where tMap is defined as: `Map<Symbol,Type>`, but `ti` is a type so the condition, `tMap.containsKey(ti)`, is always false. The assertion should be thrown if an intersection type has two or more repeated interfaces. But there are other places in the compiler where this is checked for and an error is issued if necessary. So it shouldn't be possible to get to this point during a compilation. There are several tests, including combo tests, already stressing this condition, intersection types with repeated interfaces, for this reason there is no need to add more regression tests.
>
> TIA
This pull request has now been integrated.
Changeset: 5744c91b
Author: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/5744c91bf5742379913a9926a5d70a2d49dbea04
Stats: 9 lines in 4 files changed: 0 ins; 3 del; 6 mod
8297158: Suspicious collection method call in Types.isSameTypeVisitor
Reviewed-by: jlahoda
-------------
PR: https://git.openjdk.org/jdk/pull/12279
More information about the compiler-dev
mailing list