On Tue, Jul 30, 2013 at 7:38 PM, Kohsuke Kawaguchi
<[email protected]> wrote:
> @AdaptField
> protected volatile DescribableList<...> triggers = ...
>
> @AdaptField("DESCRIPTOR")
> @Restricted(NoExternalUse.class)
> public static DescriptorImpl _getDescriptor() {
> return ...;
> }
>From an API design perspective this seems like an overly specific
(inflexible) annotation; there are a bunch of kinds of signature
change that people commonly want to make for which bytecode
transformation of clients would be necessary, and this annotation
seems to cover just two. (Changing field type, and replacing final
field access with a method call.)
Can we instead define a general annotation to be applied to any member
whose signature has changed (or which has a nested element whose
signature has changed or been removed), with a reference to a
transformation? This would let people write modules offering fixes for
other changes like renamed methods, etc.:
@Transformed(by=MethodRenamed.class, info="toURL")
public URL toUrl() {…}
Here @Transformed would be the general marker which class loaders
could scan for (or which could even be indexed during compilation for
runtime efficiency); MethodRenamed would implement the specific
bytecode changes; and the option "toURL" (i.e. previous name) could be
passed to the transformer. Specifically:
@Retention(CLASS)
@interface Transformed {
Class<? extends Transformer> by();
String[] info() default {};
}
Maybe too much work to justify the effort, but thought I would put it out there.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.