INRIA / INRIA/spoon

[Bug] SniperJavaPrettyPrinter - Invalid ouput on annotated default method

Open
#4,330 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

Given the following input:

```java
package org.example;

interface Example {

@Deprecated
default void doNotUseMePlease() {}

}
```

When performing a transformation on the class (changing the method name to "potato", for example) and pretty printing the model using SniperJavaPrettyPrinter, the annotation "@Deprecated" and the "default" keyword end-up merged together.

```java
package org.example;

interface Example {

@Deprecateddefault void potato() {}

}
```

Code to reproduce the bug is available on GitHub:
https://github.com/plcarmel/spoon-default-method-bug

```
> java -version
java version "11.0.13" 2021-10-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)
```

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.