spoon.SpoonException: The element of class class spoon.support.reflect.code.CtForImpl does not have CtRole.TYPE
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
If there is a comment before for loop and the initialization condition has final modifier before it then we are getting this exception : spoon.SpoonException: The element of class class spoon.support.reflect.code.CtForImpl does not have CtRole.TYPE
Example :
```java
public class TestClass {
@Override
private void testBug() {
//generic comment
for (final int i=0;i<5;) {
if(i==5)
break;
else
System.out.println(i);
}
}
}
```
Code used for this transformation :
```java
@Override public void process(final CtAnnotation element) {
if(element.getType().getQualifiedName().equals("java.lang.Override")) {
element.getParent().removeAnnotation(element);
}
}
```
Spoon print config :
```
launcher.getEnvironment().setPrettyPrinterCreator(() -> new SniperJavaPrettyPrinter(launcher.getEnvironment()));
```
Spoon version : 9.1.0-beta-10
Contributor guide
Assessment
This issue has not been assessed yet.