INRIA / INRIA/spoon

[Discussion] CtQuery Improvements

Open
#4,756 2 comments 1 reaction 0 assignees View on GitHub
discussion
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

I found that the API of `CtQuery` is somewhat limited. It functions essentially, as I understand it, similarly to a stream of `CtElements`, but is limited to consumption by `CtConsumer`s and collection into lists. I came across the discussion in #1070 and the limitations are justified by the fact that the implementation is based on `CtScanner`. Is there a reason that `CtScanner` must be used?

Now that there is #1986, the following is possible:
```java
Stream query = StreamSupport.stream(element.asIterable().spliterator(), false);
```
From what I understand, this can replace `CtQuery`. Can java stream replace the query API? If not what are the missing features or differing behaviours? Is it possible to reimplement/refactor `CtQuery` to use streams internally?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.