Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Functional method call pretty printer leads to unexpected results

fabianlupa
Contributor
0 Kudos
330

I noticed the functional method call pretty printer option is available on the 7.54 developer edition. So I activated it and got some unexpected results with method chaining. This is especially noticeable with the builder pattern.

Full source code: https://gist.github.com/flaiker/90cdda66a22e2d71932041dac344be41

I don't mind the first examples not working that much, that's just missing functionality. But the last one cannot be right? It looks like the chained method call is aligned like it were part of the assignment of the last parameter of the previous method call (maybe it gets mistaken for a multi line literal or method calls inside the parameter value assignment).

I looked for SAP notes regarding this but couldn't find anything relevant. I implemented the latest one anyway with its depedencies but that didn't help.

(I turned it off for now and manually reverted these cases)

Some more examples:

prettyprinter2.png

3 REPLIES 3

fabianlupa
Contributor
187

Amazing "similar questions" from 2019 by the way.

They are from 2007 and 2008 and have no indication of being bumped at all after that.

wolfgang_woehrle
Product and Topic Expert
Product and Topic Expert
0 Kudos
187

Hi Fabian,

a colleague told me that the pretty printer does not support nested method calls while formatting. Only simple calls are supported. Does this help?

Kind regards,

Wolfgang

0 Kudos
187

Hi Wolfgang,

well, does this mean the missing functionality will be added in the future? It's not like these "non simple calls" are untouched but the results look odd, in my opinion at least. Removing all "non-simple" calls in existing and new code is not an option so I cannot imagine using this feature currently.