| 1048 | * inner class instead of the outer! |
| 1049 | */ |
| 1050 | private class WritableClosure extends Closure implements Writable { |
| 1051 | @Serial private static final long serialVersionUID = -5749205698681690370L; |
| 1052 | |
| 1053 | private WritableClosure() { |
| 1054 | super(Closure.this); |
| 1055 | } |
| 1056 | |
| 1057 | /** |
| 1058 | * {@inheritDoc} |
| 1059 | */ |
| 1060 | @Override |
| 1061 | public Writer writeTo(Writer out) throws IOException { |
| 1062 | Closure.this.call(new Object[]{out}); |
| 1063 | |
| 1064 | return out; |
| 1065 | } |
| 1066 | |
| 1067 | /** |
| 1068 | * {@inheritDoc} |
| 1069 | */ |
| 1070 | @Override |
| 1071 | public Object invokeMethod(String method, Object arguments) { |
| 1072 | if ("clone".equals(method)) { |
| 1073 | return clone(); |
| 1074 | } |
| 1075 | if ("curry".equals(method)) { |
| 1076 | return curry((Object[]) arguments); |
| 1077 | } |
| 1078 | if ("asWritable".equals(method)) { |
| 1079 | return asWritable(); |
| 1080 | } |
| 1081 | return Closure.this.invokeMethod(method, arguments); |
| 1082 | } |
| 1083 | |
| 1084 | /** |
| 1085 | * {@inheritDoc} |
| 1086 | */ |
| 1087 | @Override |
| 1088 | public Object getProperty(String property) { |
| 1089 | return Closure.this.getProperty(property); |
| 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * {@inheritDoc} |
| 1094 | */ |
| 1095 | @Override |
| 1096 | public void setProperty(String property, Object newValue) { |
| 1097 | Closure.this.setProperty(property, newValue); |
| 1098 | } |
| 1099 | |
| 1100 | /** |
| 1101 | * {@inheritDoc} |
| 1102 | */ |
| 1103 | @Override |
| 1104 | public Object call() { |
| 1105 | return ((Closure) getOwner()).call(); |
| 1106 | } |
| 1107 |
nothing calls this directly
no outgoing calls
no test coverage detected