groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo zhang <zhangbo...@gmail.com>
Subject How to determine the equality of two closures?
Date Thu, 13 Apr 2017 13:56:31 GMT
Hello everybody,

I just have encountered a problem thus need your help. I want to treat the
following closures as "equivalent":

Clousure c1={
"This is a closure"
}

Clousure c2={
"This is a closure"
}

assert closureEqual(c1,c2)

Apparently, even though all fields and methods (the internal bytecode) are
equal, c1 and c2 are still different classes (xxx_closure$1 and
xxx_closure$2). AFAIK, everything but name in these two classes are equal.

Is there any possibilities to achieve my goal? Thank you very much.

Mime
View raw message