RFR: 8303820: Simplify type metadata [v2]

Vicente Romero vromero at openjdk.org
Thu Mar 9 02:10:13 UTC 2023


On Wed, 8 Mar 2023 23:40:20 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java line 325:
>> 
>>> 323:      *  and with given constant value
>>> 324:      */
>>> 325:     public Type constType(Object constValue) {
>> 
>> so now any type can have a constant value? shouldn't this be restricted to primitives and Strings?
>
> Yeah - not sure which way to go - in reality we have a also a couple of types which implement this method and just return `this`. Only the toplevel `Type` declaration throws. I'm happy to revert to the old ways if that is preferred - it was mostly a way not to duplicate the method body twice (but that's not a big deal).

I would keep the original semantics and we can relax it later if needed, but I don't have a strong preference tbh

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

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


More information about the compiler-dev mailing list