Skip to content

Commit

Permalink
JENKINS-37403 - downstream change to use SymbolLookup.getSymbolValue(…
Browse files Browse the repository at this point in the history
…...)
  • Loading branch information
abayer committed Aug 15, 2016
1 parent d253c81 commit b5eddac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java
Expand Up @@ -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));
}
}
}
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -369,8 +370,8 @@ public Collection<QuasiDescriptor> getQuasiDescriptors(boolean advanced) {
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));
}
}
Expand Down Expand Up @@ -402,7 +403,7 @@ public static final class QuasiDescriptor implements Comparable<QuasiDescriptor>
}

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) {
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -45,7 +46,7 @@ private static final class Execution extends AbstractSynchronousNonBlockingStepE

@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;
Expand Down

0 comments on commit b5eddac

Please sign in to comment.