1

In our application we have a couple of utility methods that take lambdas as argument to execute misc. activities and among them they then call the passed lambdas.

During development we occasionally had errors in the lambdas, so we emit the lambdas as part of the error message. The default toString() of a lambda at least emits the classname (which is already a BIG help! Otherwise we would never have found some of the issues) but only with a cryptic suffix e.g. "classname_here$$Lambda$2497/0x0000000800e75c40@463f3a95".

For better error logging it would be very helpful if one could give a lambda a more telling name. Is that somehow possible? Can one assign lambdas a name or some "human readable" identification? For classes that contain LOTS of lambdas it can be pretty hard to find out, WHICH lambda caused the issue, so that would be helpful.

mmo
  • 3,897
  • 11
  • 42
  • 63
  • Presumably, an alternative would be some means of deciphering the lambda class name, mapping it back to a location in the code? I don't have a solution for that, but I'm just noting it sounds like it could be sufficient. – Andy Turner Mar 08 '21 at 13:13

0 Answers0