[code-reflection] RFR: Clearly mark which AST nodes are unsupported in ReflectMethods
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon May 27 12:00:43 UTC 2024
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.
-------------
Commit messages:
- Initial push
Changes: https://git.openjdk.org/babylon/pull/97/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=97&range=00
Stats: 31 lines in 1 file changed: 8 ins; 0 del; 23 mod
Patch: https://git.openjdk.org/babylon/pull/97.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/97/head:pull/97
PR: https://git.openjdk.org/babylon/pull/97
More information about the babylon-dev
mailing list