It's not quite as simple as enums not working at all. The following pipeline works fine on one installation (tested with Jenkins ver. 1.651.1 on Java 1.8.0_77-b03 with script-security 1.18.1) but fails with "RejectedAccessException: unclassified staticMethod Thing $INIT java.lang.String java.lang.Integer java.lang.String" on another (tested with Jenkins ver. 2.0 on both 1.8.0_31-b13 and 1.8.0_91-b14, and script-security 1.18.1):
enum Thing {
FIRST("The first thing"),
SECOND("The second thing");
String description;
public Thing(String description) {
this.description = description;
}
}
node {
for (int i = 0; i < Thing.values().length; i++) {
Thing thing = Thing.values()[i];
echo "${thing.description}"
}
}
It's not quite as simple as enums not working at all. The following pipeline works fine on one installation (tested with Jenkins ver. 1.651.1 on Java 1.8.0_77-b03 with script-security 1.18.1) but fails with "RejectedAccessException: unclassified staticMethod Thing $INIT java.lang.String java.lang.Integer java.lang.String" on another (tested with Jenkins ver. 2.0 on both 1.8.0_31-b13 and 1.8.0_91-b14, and script-security 1.18.1):