-
1. Re: roaster parse for methods [JavaClassSource]
gastaldi Aug 14, 2017 2:26 PM (in response to cristhian)Hi Cristhian,
What is that? The output from JavaClassSource.toString()?
Always use Roaster.format() to format the output appropriately.
-
2. Re: roaster parse for methods [JavaClassSource]
cristhian Aug 14, 2017 2:44 PM (in response to gastaldi)Hi George, thanks for reply.
Is the output of the body data, when I use the getMethod. Suppose this
JavaClassSource classOrigin = Roaster.parse()
and using
classOrigin.getMethods()
it deletes the original format of the code parsed previously
-
3. Re: roaster parse for methods [JavaClassSource]
gastaldi Aug 14, 2017 3:00 PM (in response to cristhian)If you call JavaClassSource.toUnformattedString() it should keep your original format.
-
4. Re: roaster parse for methods [JavaClassSource]
cristhian Aug 14, 2017 3:16 PM (in response to gastaldi)the problem I have is that I need to use the getMethods, because I need to merge two classes into one. So, I have the class A with some methods, and class B with some other methods, and I need to create a class C with the methods in A and B into a single one.
-
5. Re: roaster parse for methods [JavaClassSource]
gastaldi Aug 14, 2017 3:19 PM (in response to cristhian)Right, do you have a specific code format that you would like to use?
Try setting that up in Eclipse, export as a Properties file and use that in the Roaster.format() signature.
-
6. Re: roaster parse for methods [JavaClassSource]
gastaldi Aug 14, 2017 3:20 PM (in response to cristhian)Do you have the method body code formatted appropriately when Method.getBody() is called?
-
7. Re: roaster parse for methods [JavaClassSource]
cristhian Aug 14, 2017 3:47 PM (in response to gastaldi)Basically my main issue now is just this new line crop that I'm facing, when getBody is called, \n\n from original string is converted to \n.
I could try the way you're suggesting me, but I think the problem will remain. I need to reuse the styles from classes A and B. If for example these classes contains methods with statements that have empty lines, not sure if this file format could help me. (because of the issue of \n\n converted to \n).
thanks for the help
-
8. Re: roaster parse for methods [JavaClassSource]
gastaldi Aug 14, 2017 4:17 PM (in response to cristhian)I think the problem may be in the getBody implementation - roaster/MethodImpl.java at master · forge/roaster · GitHub
Feel free to play with it and provide a PR if you find a solution. Happy to help!