On Mon, Jun 27, 2016 at 1:09 PM, Nicolas Passerini <npasserini@gmail.com> wrote:
Well, there's a reason why they're restricted. Note, that the restriction is on language level, not at runtime level. A annotation class
with arbitrary code would pass JVM verification (or at least I can't see a rule that would reject such a class).
When I implemented annotation support I was initially thinking the same - let's create an instance of CoolAnnotationClass when the code is accepted
and then one can add arbitrary code to his CoolAnnotationClass. I quickly realized this is a (very) bad idea. Or, to be precise, it is a bad idea given the
environment. So I'd be very careful..
Jan
P.S.: As for "which always forced me to hate Java": I found myself a very enlightening to think carefully about why somebody else
do things differently before I start to hate her/him. Besides, there's whole lot of things that Java guys got right...