Add `CtElement.getCompilationUnit` method to the public API
Open
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
Currently, we have to retrieve the `CtCompilationUnit` of an element, `CtType` in my particular case, using the factory methods defined.
```java
element.getFactory().CompilationUnit().getOrCreate((CtType) element);
```
I propose we add a public API to directly get the `CtCompilationUnit`. It can be a part of the `CtElement` as each element belongs to some compilation unit.
Reference: https://github.com/SpoonLabs/diffmin/pull/65#discussion_r636910498
Contributor guide
Assessment
This issue has not been assessed yet.