On Mon, 07 Apr 2014 10:16:55 +0200, eric.giese <
eric...@googlemail.com>
wrote:
> To me the question is rather: "Is this really a good idea at all?"
>
> Static factory methods or default methods in Interfaces really shouldn't
> have side-effects at all, so I see no real usecase for logging, but a lot
> of potential for abuse. In your example above, throwing the Exception
> up-front is probably clearly superior to just log and discard a problem.
In my case I don't want to eat the exception - BTW it's prototype code
that will be soon changed. You have a point in saying that if the method
is not that complex and you don't want to log errors, there's probably not
meaning in logging anything. But, for instance for debugging purposes, I'd
like to log that "an instance of Service has been instantiated from class
...". It's not something that I can't live without. I could be persuaded
that it's such a marginal need that Lombok should avoid it.
> If lombok really introduces this feature, then I would at least recommend
> to give a warning that the log field cannot be scoped to an appropiate
> visibility level.
Can Lombok generate extra classes? I was thinking that the log variable
could be placed in a package-visible synthetic wrapper class...