INRIA / INRIA/spoon

Add `CtElement.getCompilationUnit` method to the public API

Open
#3,942 16 comments 0 reactions 0 assignees View on GitHub
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

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.