On Mon, 2 Oct 2023 17:42:39 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Aggelos Biboudis 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 four additional >> commits since the last revision: >> >> - Merge branch 'master' into primitive-patterns >> - Implement type pairs to exactnessMethod name >> - Apply suggestions from code review >> >> Co-authored-by: Raffaello Giulietti <raffaello.giulie...@oracle.com> >> - 8303374: Compiler Implementation for Primitive types in patterns, >> instanceof, and switch (Preview) > > src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java > line 770: > >> 768: PrimitiveGenerator primitiveGenerator = new >> PrimitiveGenerator(); >> 769: primitiveGenerator.assembleSig(primitiveType); >> 770: return new >> Symbol.DynamicVarSymbol(names.fromString(primitiveGenerator.sb.toString()), > > Why do we need a condy to generate a `Class` object for a type we know > statically? E.g. will this not be resolved to <primitiveType>.class ? Nevermind - you need a CP entry to a CONSTANT_Class, and you are dealing with primitive types, so you need the dynamic constant in order to create one (since we do not have CP forms for primitive class literals). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1343732619