Le 22/06/2010 23:29, John Rose a écrit : > On Jun 22, 2010, at 2:25 PM, Rémi Forax wrote: > > >> There is another possible design. >> Allow users to create fake types like java.dyn.Invokedynamic >> and define the annotation on that type. >> > I'd rather not let the magic signature polymorphism escape beyond the current > set of names (InvokeDynamic and two methods of MethodHandle). It pulls an > "innocent" name into a dark corner of the language. >
As you said before, the use cases are weaving, AOP or interceptor, basically a way to specify a protocol. virtual method is such kind of protocol, in Java or in C#, you don't specify it at each call sites. In Java, this is enable by default, in C# you add an annotation (the override keyword) at callee site. If you specify a protocol only a each call sites, you don't offer one common place to document that protocol. > Also, putting an optional annotation on each call site is more flexible. > perhaps but I think it doesn't fit with the use cases. In general, you will have few bootstrap methods, each one corresponding to a specific protocol. And you will have lot of more call sites using these few protocols. Encoding BSM at each callsite means a lot of information duplication. And we all know that kind of boilerplate code is error prone. Remember that currently, you specify the BSM name using a String ! Another to say the same thing, I don't see how to do refactoring of the corresponding all callsites if the name of one BSM change. > I wish we had expression annotations... > > -- John > Rémi _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev