atomist-attic / rug

DEPRECATED Runtime for Rugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editing a JavaType breaks formatting and duplicates comments

mpdatx opened this issue · comments

Using addAnnotation or addImport (possibly other methods) on a JavaType causes the following issues:

  1. The class declaration gets reformatted into a single line, even if it was broken up into multiple lines in the original source
  2. The class comment gets duplicated
  3. Any method comments get duplicated

This happens with rug 1.0.0-m.2. Example code that demonstrates this can be found at https://github.com/mpdatx/javatypetest

@mpdatx I checked out 1.0.0-m.2 of rug and reproduced the duplication of class, method, and constructor comments. However, we recently upgraded JavaParser from 2.5.x to 3.2.4 and now 3.2.5 today and this issue seems to have been resolved. I don't see duplication any more.

With regards to preserving class declaration formatting, we are relying on JavaParser and this feature has been requested a lot. See javaparser/javaparser#318 and a later article https://dzone.com/articles/implementing-lexical-preservation-for-javaparser-1. We haven't set up a LexicalPreservingPrinter as the article explains.

Please try the latest rug snapshot release from 1.0.0-20170524012911.

@alankstewart is this fixed in in the latest release of rug?

@kipz The duplication is definitely fixed but I can't do anything about the class declaration being formatted to a single line, as JavaParser is doing this.

Please ensure https://atomist.jfrog.io/atomist/list/libs-dev is in your cli.yml to pick up timestamped versions.

Duplication fixed for release 1.0.0-m.5. Perhaps raise new issue for formatting problems if affected.