[code-reflection] Integrated: Clearly mark which AST nodes are unsupported in ReflectMethods

Maurizio Cimadamore mcimadamore at openjdk.org
Tue May 28 23:33:16 UTC 2024


On Mon, 27 May 2024 11:56:40 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.

This pull request has now been integrated.

Changeset: 331553ef
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/331553ef0ee0a218537ed7b96092266586a5f251
Stats:     30 lines in 1 file changed: 5 ins; 0 del; 25 mod

Clearly mark which AST nodes are unsupported in ReflectMethods

Reviewed-by: psandoz

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

PR: https://git.openjdk.org/babylon/pull/97


More information about the babylon-dev mailing list