News for hackers. Stuff that matters.
Re:Java’s Cultural Problem by kaba0 on Monday September 19, 2022 @08:25AM (#32897375)
You can’t change code either in Java — annotation processors are explicitly unable to do that — Spring’s magic works through loading new classes up that either implement the same static interface you use, or extending the class, and injecting this new proxy instead.

In short, if you want to log certain methods at enter and exit time with AOP (not manually adding it everywhere), you just create a proxy object and do a logEnter(); targetedObj.method(); logExit();

That’s why some people dislike Lombok as that actually changes byte code at compile time.

Re:Java’s Cultural Problem by samus on Monday September 19, 2022 @08:40AM (#32897544)
The bytecode format is well-documented. If Lombok would just augment these, then there would be no major problem with it. But it actually does something worse: it uses reflection and other tricks to extend the Abstract Syntax Tree, which is purely an implementation detail of the Java compiler. And it must do the same with every tool that touches Java Sources.