Implicit elements and source positions
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
In spoon, we store information about whether an AST element appears in the code by marking it as implicit if it is *not* present in source. In such case, the element also does not have a source position.
However, this is somewhat inconsistent at the moment. I wrote a quick test that collects all elements that are *not* implicit and *don't* have a valid source position. As input, I used the spoon source code.
As result, I stored information about which class has which amount of such elements:
| Class Name | Count |
| ---- | ---- |
| CtTypeReferenceImpl | 221051 |
| CtPackageReferenceImpl | 201640 |
| CtExecutableReferenceImpl | 32539 |
| CtTypeAccessImpl | 16266 |
| CtParameterReferenceImpl | 14910 |
| CtTypeParameterReferenceImpl | 14131 |
| CtWildcardReferenceImpl | 13473 |
| CtLocalVariableReferenceImpl | 11700 |
| CtFieldReferenceImpl | 10397 |
| CtJavaDocTagImpl | 2483 |
| CtArrayTypeReferenceImpl | 2189 |
| CtBlockImpl | 304 |
| CtCatchVariableReferenceImpl | 120 |
| CtPackageImpl | 43 |
| CtParameterImpl | 38 |
| CtVariableReadImpl | 38 |
| CtRootPackage | 1 |
From those results, I assume it doesn't make sense to try to fix all of these in one PR.
I would create a PR for a (disabled) test that just runs the code I wrote for the results above, this way we can keep track of the situation.
Additionally, fixes can then provide test cases for specific situations.
Such fixes could be good for new contributors.
WDYT?
Contributor guide
Research direction
Review the Spoon source classes listed in the issue, especially the reference implementations, to understand how implicit status and source positions are represented. Add the proposed disabled check against the Spoon source and preserve the reported counts as its baseline; later fixes can add focused cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100