Skip to content
Permalink
Browse files
JENKINS-37403 - downstream change to use SymbolLookup.getSymbolValue(…
…...)
  • Loading branch information
abayer committed Aug 15, 2016
1 parent d253c81 commit b5eddacf15482efd320dd7aaa7d93760210f86c4
@@ -100,7 +100,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.3</version>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
@@ -132,9 +132,9 @@ public Object invokeMethod(String name, Object args) {
try {
for (Class<?> e : Index.list(Symbol.class, Jenkins.getActiveInstance().pluginManager.uberClassLoader, Class.class)) {
if (Descriptor.class.isAssignableFrom(e)) {
Symbol s = e.getAnnotation(Symbol.class);
String s = SymbolLookup.getSymbolValue(e);
if (s != null) {
symbols.addAll(Arrays.asList(s.value()));
symbols.addAll(Arrays.asList(s));
}
}
}
@@ -50,6 +50,7 @@
import jenkins.tasks.SimpleBuildStep;
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.structs.SymbolLookup;
import org.jenkinsci.plugins.structs.describable.DescribableModel;
import org.jenkinsci.plugins.structs.describable.DescribableParameter;
import org.jenkinsci.plugins.structs.describable.HeterogeneousObjectType;
@@ -369,8 +370,8 @@ private static boolean isSingleMap(Map<String, ?> args) {
for (DescribableModel<?> delegateOptionSchema : ((HeterogeneousObjectType) delegate.getType()).getTypes().values()) {
Class<?> delegateOptionType = delegateOptionSchema.getType();
Descriptor<?> delegateDescriptor = Jenkins.getActiveInstance().getDescriptorOrDie(delegateOptionType.asSubclass(Describable.class));
Symbol symbol = delegateDescriptor.getClass().getAnnotation(Symbol.class);
if (symbol != null && symbol.value().length > 0) {
String symbol = SymbolLookup.getSymbolValue(delegateDescriptor);
if (symbol != null) {
t.add(new QuasiDescriptor(delegateDescriptor));
}
}
@@ -402,7 +403,7 @@ private static boolean isSingleMap(Map<String, ?> args) {
}

public String getSymbol() {
return real instanceof StepDescriptor ? ((StepDescriptor) real).getFunctionName() : real.getClass().getAnnotation(Symbol.class).value()[0];
return real instanceof StepDescriptor ? ((StepDescriptor) real).getFunctionName() : SymbolLookup.getSymbolValue(real);
}

@Override public int compareTo(QuasiDescriptor o) {
@@ -4,6 +4,7 @@
import hudson.Extension;
import hudson.model.TaskListener;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.structs.SymbolLookup;
import org.jenkinsci.plugins.workflow.DSLTest;
import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl;
import org.jenkinsci.plugins.workflow.steps.AbstractStepImpl;
@@ -45,7 +46,7 @@ public void setModerate(boolean m) {

@Override protected Void run() throws Exception {
if (step.moderate) {
listener.getLogger().println("Introducing "+step.state.getDescriptor().getClass().getAnnotation(Symbol.class).value()[0]);
listener.getLogger().println("Introducing "+ SymbolLookup.getSymbolValue(step.state.getDescriptor()));
}
step.state.sayHello(listener);
return null;

0 comments on commit b5eddac

Please sign in to comment.