[code-reflection] RFR: Define JavaRef top-type for all Java refs [v2]

Paul Sandoz psandoz at openjdk.org
Mon Apr 28 16:03:04 UTC 2025


On Mon, 28 Apr 2025 12:00:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Paul Sandoz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert unintended changes.
>
> src/jdk.incubator.code/share/classes/jdk/incubator/code/type/JavaRef.java line 11:
> 
>> 9:  * can be resolved to an instance of {@link java.lang.reflect.Type Type}.
>> 10:  */
>> 11: public sealed interface JavaRef
> 
> Shouldn't `TypeVarRef` also extend from this?

I always thought of it as just a java type element, correlated with `java.lang.reflect.TypeVariable` since that is what it resolves to.

Why thinking about this PR and more broadly I was pondering whether to rename `TypeVarRef` to `TypeVarRefType` or more verbosely as `TypeVariableType`, since i must admit to  to finding the `Ref` in `TypeVarRef` a little confusing as presumably it is referring to the type variable, but then `ClassType` refers to the class, etc.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/411#discussion_r2063996973


More information about the babylon-dev mailing list