-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support comments in method bodies #268
Comments
I believe a custom visitor needs to be implemented to gain access to comments, otherwise the JDT ignores them. I seem to remember this from some issue a long time ago, but here's an example. Hopefully it still applies: |
@lincolnthree yes, I discovered that through my investigation as well. The problem is that the comments are stored in the |
Ah yeah that makes sense. I see you found a solution using document. Just curious since I'm 'lurking' - did you mean for these tests to be |
It's still not working. Unfortunately the solution with |
Greetings! Wondering about the status of this issue. |
@oc007us no evolution so far, unfortunately. Open for suggestions 😉 |
@gastaldi, yes, it is a tricky one. I guess, there is a way to collect all comments and perhaps save them in the MethodImpl class. I am not sure if there is a way to insert them back when the entire CompilationUnit is written to a file. |
@oc007us I guess it depends on if the |
@gastaldi, neither am I. The generated code in my case can be done away without comments. I will use the JavaDoc on the methods to add info. Thank you for looking into it! |
Discussed in #267
Originally posted by panderior November 6, 2022
When I try to add a line comment to a Java class code I am trying to generate, the roaster library removes the comment and gives just the code.
My intention is to generate a code like this:
What have I tried:
Your help is very appreciated. Thank you.
The text was updated successfully, but these errors were encountered: