[code-reflection] RFR: Support storing the code that builds the code model [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Feb 10 12:15:38 UTC 2025
On Wed, 22 Jan 2025 17:25:58 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
>> In this PR we allow the user to decide how to store the code model. The first option is `TEXT`, if this is selected, we store the textual representation of the code model. The second option is `CODE_BUILDR`, if this is selected, we store the code that builds the code model. All work done here is around the second option, because the first option is already supported.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
>
> Make TEXT the default storage mechanism for code models
Marked as reviewed by mcimadamore (Reviewer).
src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 159:
> 157: options.isSet(G_CUSTOM, "lines");
> 158: String cmso = options.get("codeModelStorageOption");
> 159: codeModelStorageOption = CodeModelStorageOption.valueOf(cmso != null ? cmso : CodeModelStorageOption.TEXT.name());
If you want you can define the parsing code here as a static method in the CodeModelStorageOption enum, for better encapsulation.
src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 400:
> 398:
> 399: private JCMethodDecl opMethodDecl(Name methodName, CoreOp.FuncOp op, CodeModelStorageOption codeModelStorageOption) {
> 400: if (CodeModelStorageOption.TEXT.equals(codeModelStorageOption)) {
Maybe we can a switch on enum? That should allow you to get rid of the `else` part (as switching on enum constants is "exhaustive")
-------------
PR Review: https://git.openjdk.org/babylon/pull/305#pullrequestreview-2605575969
PR Review Comment: https://git.openjdk.org/babylon/pull/305#discussion_r1948946427
PR Review Comment: https://git.openjdk.org/babylon/pull/305#discussion_r1948948497
More information about the babylon-dev
mailing list