RFR: 8297118: Change IncompatibleClassChangeError to MatchException for exhaustive switch statements and switch expressions

Vicente Romero vromero at openjdk.org
Thu Nov 17 15:41:23 UTC 2022


On Thu, 17 Nov 2022 13:40:46 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 131:
>> 
>>> 129:             options.getBoolean("optimizeOuterThis", false);
>>> 130:         disableProtectedAccessors = options.isSet("disableProtectedAccessors");
>>> 131:         Source source = Source.instance(context);
>> 
>> Does this merit addition of a feature-enum constant in the usual way?
>
> I was thinking of this, but opted to reuse the existing feature constant, as this is not a separate user-selectable feature, but rather part of the patterns in switch feature. Also, each feature enum constant must a diagnostic set, and as it would never be part of any diagnostic, it would be impossible to test.
> 
> It is possible to have a separate constant if desired, though.

I'm OK with the current approach

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

PR: https://git.openjdk.org/jdk/pull/11189


More information about the compiler-dev mailing list