spoon icon indicating copy to clipboard operation
spoon copied to clipboard

[Bug] SniperJavaPrettyPrinter - Invalid ouput on annotated default method

Open plcarmel opened this issue 3 years ago • 1 comments

Given the following input:

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.

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)

plcarmel avatar Dec 06 '21 13:12 plcarmel

@plcarmel Thanks for the issue. We will have a look at this.

This might be related to https://github.com/INRIA/spoon/pull/4296.

algomaster99 avatar Dec 06 '21 14:12 algomaster99