| I wasted some time with this bug. From what I can tell, the bug was introduced with commit 0a9e67654a0f072601fb3a24d420c3c09ebfd843, when upgrading jenkins.version property from 2.60.3 to 2.138.4. It happens because of commit ba33bd67cdaef87aba8a4e95dca8dcf108a7d73f , in 2.138.2, which added an interface StaplerProxy to class Run. This interface defines a method Object getTarget() with an implementation in class Run. The Promotion class, which derives from Run, also has a method getTarget but with return type AbstractBuild<?,?>, so a synthetic method, with return type Object, is created by the compiler which invokes AbstractBuild<?,?> getTarget().
javap -v ./promoted-builds-2.138.2/WEB-INF/lib/promoted-builds/hudson/plugins/promoted_builds/Promotion.class
public hudson.model.AbstractBuild<?, ?> getRootBuild();
descriptor: ()Lhudson/model/AbstractBuild;
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokevirtual #9 // Method getTarget:()Lhudson/model/AbstractBuild;
4: invokevirtual #10 // Method hudson/model/AbstractBuild.getRootBuild:()Lhudson/model/AbstractBuild;
7: areturn
LineNumberTable:
line 93: 0
LocalVariableTable:
Start Length Slot Name Signature
0 8 0 this Lhudson/plugins/promoted_builds/Promotion;
Signature: #185 // ()Lhudson/model/AbstractBuild<**>;
Renaming AbstractBuild<?,?> getTarget() to AbstractBuild<?,?> getTarget2() fixes the bug, but I have no idea of its impacts because of the @Exported annotation. Note: the new Object getTarget() method in Run as an annotation @Restricted(NoExternalUse.class) but I don't understand its meaning. |