Title: Message Title
Mike Kobit created an issue
Jenkins / JENKINS-49826
Incorrect and confusing compilation of sets with custom types
Issue Type:
Bug
Assignee:
Unassigned
Components:
workflow-cps-plugin
Created:
2018-03-01 18:35
Environment:
Jenkins version: 2.89.4 Pipeline (workflow-aggregator) => 2.5 Pipeline: API (workflow-api) => 2.26 Pipeline: Basic Steps (workflow-basic-steps) => 2.6 Pipeline: Groovy (workflow-cps) => 2.45 Pipeline: Job (workflow-job) => 2.17 Pipeline: Multibranch (workflow-multibranch) => 2.17 Pipeline: Nodes and Processes (workflow-durable-task-step) => 2.19 Pipeline: SCM Step (workflow-scm-step) => 2.6 Pipeline: Shared Groovy Libraries (workflow-cps-global-lib) => 2.9 Pipeline: Step API (workflow-step-api) => 2.14 Pipeline: Supporting APIs (workflow-support) => 2.18
Priority:
Major
Reporter:
Mike Kobit
First, create a pipeline job with this pipeline that contains a class definition:
class Data implements Serializable {
final String string
Data(final String string) {
this.string = Objects.requireNonNull(string)
}
boolean equals(final other) {
if (this.is(other)) {
return true
}
if (getClass() != other.class) {
return false
}
final Data that = (Data) other
return string == that.string
}
int hashCode() {
return string.hashCode()
}
}
final d1 = new Data('a')
final d2 = new Data('b')
final d3 = new Data('c')
final s1 = 'a'
final s2 = 'b'
final s3 = 'c'
final s0 = [s1, s2, s3]
echo "s1: ${s0.getClass()}"
final ss1 = [s1, s2, s3].toSet()
echo "ss1: ${ss1.getClass()}"
final Set s