[code-reflection] RFR: Clearly mark which AST nodes are unsupported in ReflectMethods [v2]
Paul Sandoz
psandoz at openjdk.org
Tue May 28 16:23:31 UTC 2024
On Mon, 27 May 2024 15:57:17 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> The logic in `ReflectMethods` uses a `FilterScanner` to scan the body of methods and turn them into code models.
>> A filter scanner is a scanner that only supports a subset of all AST nodes (and throws when it encounter AST nodes not in that set).
>>
>> Having a list of supported nodes isn't as useful in this context as having a list of unsupported ones. After all, unsupported node cause the compiler to bark when generating code models. As such, implementation effort should be focussed on reducing the set of unsupported nodes to (eventually) zero.
>>
>> For this reason, this PR applies a simple change where we first list the set of unsupported nodes, and then we compute their complement, and use that complement to set the `FilterScanner` constructor parameter.
>>
>> The list of unsupported nodes is organised in two sections:
>> * first we have a list of all unsupported nodes that likely would benefit from more support
>> * then we have a list of all unsupported nodes which will likely never be supported, either because they are already handled as part of an enclosing statement (e.g. `case` AST nodes), or because they are no longer relevant for `ReflectMethods` (e.g. `TYPEAPPLY`).
>>
>> This should hopefully make it clear where implementation efforts should be directed to.
>
> Maurizio Cimadamore has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>
> - Merge branch 'code-reflection' into unsupported_nodes
> - Initial push
Marked as reviewed by psandoz (Lead).
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 439:
> 437: Tag.SWITCH, Tag.SYNCHRONIZED,
> 438: // operators
> 439: Tag.COMPL, Tag.POS,
These last two should be easy low hanging fruit, esp. `POS`.
-------------
PR Review: https://git.openjdk.org/babylon/pull/97#pullrequestreview-2083343174
PR Review Comment: https://git.openjdk.org/babylon/pull/97#discussion_r1617583265
More information about the babylon-dev
mailing list