RFR: 8297158: Suspicious collection method call in Types.isSameTypeVisitor
Vicente Romero
vromero at openjdk.org
Sun Jan 29 02:26:54 UTC 2023
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. So it shouldn't be possible to get to this point during a compilation. There are several tests, including combo tests, already stressing this code for this reason there is no need to add more regression tests.
TIA
-------------
Commit messages:
- 8297158: Suspicious collection method call in Types.isSameTypeVisitor
Changes: https://git.openjdk.org/jdk/pull/12279/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12279&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8297158
Stats: 9 lines in 4 files changed: 0 ins; 3 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/12279.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12279/head:pull/12279
PR: https://git.openjdk.org/jdk/pull/12279
More information about the compiler-dev
mailing list