RFR: 8266645: javac should not check for sealed supertypes in intersection types

Vicente Romero vromero at openjdk.java.net
Thu May 6 20:27:09 UTC 2021


While trying to convert the hierarchy under package java.lang.constant to a sealed one we discovered that the compiler was issuing an error for intersection types when at least one of the types is sealed. The reason for this is that javac creates a synthetic anonymous class that extends and implements the classes and interfaces in the intersection type and then it attributes that synthetic class. The current implementation for sealed classes then issues an error for this anonymous class. The fix is to do not check for sealed supertypes for classes with an intersection type.

TIA

-------------

Commit messages:
 - 8266645: javac should not check for sealed supertypes in intersection types

Changes: https://git.openjdk.java.net/jdk/pull/3907/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3907&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8266645
  Stats: 29 lines in 2 files changed: 20 ins; 6 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3907.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3907/head:pull/3907

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


More information about the compiler-dev mailing list