groovy git commit: Minor refactoring: extract common method of MetaMethodSite subclasses

2018-03-11 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X f5c50875b -> 2f9dcb49a


Minor refactoring: extract common method of MetaMethodSite subclasses

(cherry picked from commit af98abb)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2f9dcb49
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2f9dcb49
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2f9dcb49

Branch: refs/heads/GROOVY_2_5_X
Commit: 2f9dcb49a6de5ab662a085658d92c68b6b842416
Parents: f5c5087
Author: sunlan 
Authored: Mon Mar 12 08:27:26 2018 +0800
Committer: sunlan 
Committed: Mon Mar 12 09:16:14 2018 +0800

--
 .../callsite/PlainObjectMetaMethodSite.java | 53 
 .../runtime/callsite/PogoMetaMethodSite.java| 36 ++---
 .../runtime/callsite/PojoMetaMethodSite.java| 36 ++---
 3 files changed, 61 insertions(+), 64 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/2f9dcb49/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
--
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
new file mode 100644
index 000..b396e26
--- /dev/null
+++ 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.codehaus.groovy.runtime.callsite;
+
+import groovy.lang.GroovyRuntimeException;
+import groovy.lang.MetaClass;
+import groovy.lang.MetaMethod;
+import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Plain ordinary object call site
+ *   meta class - cached
+ *   method - cached
+ *
+ */
+public abstract class PlainObjectMetaMethodSite extends MetaMethodSite {
+public PlainObjectMetaMethodSite(CallSite site, MetaClass metaClass, 
MetaMethod metaMethod, Class[] params) {
+super(site, metaClass, metaMethod, params);
+}
+
+protected static Object doInvoke(Object receiver, Object[] args, Method 
reflect) throws Throwable {
+try {
+return reflect.invoke(receiver, args);
+} catch (InvocationTargetException e) {
+Throwable cause = e.getCause();
+if (cause instanceof GroovyRuntimeException) {
+throw ScriptBytecodeAdapter.unwrap ((GroovyRuntimeException) 
cause);
+} else {
+throw cause;
+}
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/2f9dcb49/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
--
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
index 243e62d..5240f34 100644
--- a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
+++ b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
@@ -27,7 +27,6 @@ import org.codehaus.groovy.runtime.GroovyCategorySupport;
 import org.codehaus.groovy.runtime.MetaClassHelper;
 import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 /**
@@ -35,7 +34,7 @@ import java.lang.reflect.Method;
  *   meta class - cached
  *   method - cached
 */
-public class PogoMetaMethodSite extends MetaMethodSite {
+public class PogoMetaMethodSite extends PlainObjectMetaMethodSite {
 private final int version;
 private final boolean skipVersionCheck;
 public PogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, 
MetaMethod metaMethod, Class params[]) {
@@ -165,16 +164,7 @@ public class 

groovy git commit: Minor refactoring: extract common method of MetaMethodSite subclasses

2018-03-11 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 4d4bd1b12 -> 64c279899


Minor refactoring: extract common method of MetaMethodSite subclasses

(cherry picked from commit af98abb)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/64c27989
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/64c27989
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/64c27989

Branch: refs/heads/GROOVY_2_6_X
Commit: 64c279899c30f99bed754b6edf91ef372d5336a8
Parents: 4d4bd1b
Author: sunlan 
Authored: Mon Mar 12 08:27:26 2018 +0800
Committer: sunlan 
Committed: Mon Mar 12 09:15:04 2018 +0800

--
 .../callsite/PlainObjectMetaMethodSite.java | 53 
 .../runtime/callsite/PogoMetaMethodSite.java| 36 ++---
 .../runtime/callsite/PojoMetaMethodSite.java| 36 ++---
 3 files changed, 61 insertions(+), 64 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/64c27989/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
--
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
new file mode 100644
index 000..b396e26
--- /dev/null
+++ 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.codehaus.groovy.runtime.callsite;
+
+import groovy.lang.GroovyRuntimeException;
+import groovy.lang.MetaClass;
+import groovy.lang.MetaMethod;
+import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Plain ordinary object call site
+ *   meta class - cached
+ *   method - cached
+ *
+ */
+public abstract class PlainObjectMetaMethodSite extends MetaMethodSite {
+public PlainObjectMetaMethodSite(CallSite site, MetaClass metaClass, 
MetaMethod metaMethod, Class[] params) {
+super(site, metaClass, metaMethod, params);
+}
+
+protected static Object doInvoke(Object receiver, Object[] args, Method 
reflect) throws Throwable {
+try {
+return reflect.invoke(receiver, args);
+} catch (InvocationTargetException e) {
+Throwable cause = e.getCause();
+if (cause instanceof GroovyRuntimeException) {
+throw ScriptBytecodeAdapter.unwrap ((GroovyRuntimeException) 
cause);
+} else {
+throw cause;
+}
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/64c27989/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
--
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
index 243e62d..5240f34 100644
--- a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
+++ b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
@@ -27,7 +27,6 @@ import org.codehaus.groovy.runtime.GroovyCategorySupport;
 import org.codehaus.groovy.runtime.MetaClassHelper;
 import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 /**
@@ -35,7 +34,7 @@ import java.lang.reflect.Method;
  *   meta class - cached
  *   method - cached
 */
-public class PogoMetaMethodSite extends MetaMethodSite {
+public class PogoMetaMethodSite extends PlainObjectMetaMethodSite {
 private final int version;
 private final boolean skipVersionCheck;
 public PogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, 
MetaMethod metaMethod, Class params[]) {
@@ -165,16 +164,7 @@ public class 

groovy git commit: Minor refactoring: extract common method of MetaMethodSite subclasses

2018-03-11 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/master b3e042191 -> af98abb4d


Minor refactoring: extract common method of MetaMethodSite subclasses


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/af98abb4
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/af98abb4
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/af98abb4

Branch: refs/heads/master
Commit: af98abb4de171525214df1392dd5057a7397b041
Parents: b3e0421
Author: sunlan 
Authored: Mon Mar 12 08:27:26 2018 +0800
Committer: sunlan 
Committed: Mon Mar 12 08:27:26 2018 +0800

--
 .../callsite/PlainObjectMetaMethodSite.java | 53 
 .../runtime/callsite/PogoMetaMethodSite.java| 36 ++---
 .../runtime/callsite/PojoMetaMethodSite.java| 36 ++---
 3 files changed, 61 insertions(+), 64 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/af98abb4/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
--
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
new file mode 100644
index 000..b396e26
--- /dev/null
+++ 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PlainObjectMetaMethodSite.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.codehaus.groovy.runtime.callsite;
+
+import groovy.lang.GroovyRuntimeException;
+import groovy.lang.MetaClass;
+import groovy.lang.MetaMethod;
+import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Plain ordinary object call site
+ *   meta class - cached
+ *   method - cached
+ *
+ */
+public abstract class PlainObjectMetaMethodSite extends MetaMethodSite {
+public PlainObjectMetaMethodSite(CallSite site, MetaClass metaClass, 
MetaMethod metaMethod, Class[] params) {
+super(site, metaClass, metaMethod, params);
+}
+
+protected static Object doInvoke(Object receiver, Object[] args, Method 
reflect) throws Throwable {
+try {
+return reflect.invoke(receiver, args);
+} catch (InvocationTargetException e) {
+Throwable cause = e.getCause();
+if (cause instanceof GroovyRuntimeException) {
+throw ScriptBytecodeAdapter.unwrap ((GroovyRuntimeException) 
cause);
+} else {
+throw cause;
+}
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/af98abb4/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
--
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java 
b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
index 243e62d..5240f34 100644
--- a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
+++ b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
@@ -27,7 +27,6 @@ import org.codehaus.groovy.runtime.GroovyCategorySupport;
 import org.codehaus.groovy.runtime.MetaClassHelper;
 import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 /**
@@ -35,7 +34,7 @@ import java.lang.reflect.Method;
  *   meta class - cached
  *   method - cached
 */
-public class PogoMetaMethodSite extends MetaMethodSite {
+public class PogoMetaMethodSite extends PlainObjectMetaMethodSite {
 private final int version;
 private final boolean skipVersionCheck;
 public PogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, 
MetaMethod metaMethod, Class params[]) {
@@ -165,16 +164,7 @@ public class PogoMetaMethodSite extends MetaMethodSite {
 public