[code-reflection] RFR: Improve resolution of types in `CodeModelToAST`
Mourad Abbay
mabbay at openjdk.org
Thu Apr 10 16:32:53 UTC 2025
On Thu, 10 Apr 2025 11:37:16 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> The `CodeModelToAST` class features an ad-hoc table of types, which is hard-wired to include all the types that can come up in the code model generated by `OpBuilder`.
> This approach is fragile (if new types are relied upon by `OpBuilder`, they need to be added there), and duplicates type resolution tables that javac has to maintain anyway.
>
> This PR replaces the ad-hoc type table with more idiomatic javac type lookup logic.
src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/CodeModelToAST.java line 48:
> 46:
> 47: private Type typeElementToType(TypeElement te) {
> 48: JavaType jt = (JavaType) te;
I suggest we remove the cast and switch over the param `te`
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/391#discussion_r2037816364
More information about the babylon-dev
mailing list