Skip to content

Commit

Permalink
Fix potential problem when deserializing
Browse files Browse the repository at this point in the history
  • Loading branch information
melix committed Jul 9, 2015
1 parent 03e3812 commit 09e9778
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/org/codehaus/groovy/runtime/MethodClosure.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
*/
public class MethodClosure extends Closure {

public static boolean ALLOW_RESOLVE = false;

private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
private String method;

public MethodClosure(Object owner, String method) {
super(owner);
this.method = method;
Expand Down Expand Up @@ -62,6 +64,13 @@ public String getMethod() {
protected Object doCall(Object arguments) {
return InvokerHelper.invokeMethod(getOwner(), method, arguments);
}

private Object readResolve() {
if (ALLOW_RESOLVE) {
return this;
}
throw new UnsupportedOperationException();
}

public Object getProperty(String property) {
if ("method".equals(property)) {
Expand Down

0 comments on commit 09e9778

Please sign in to comment.