You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2016/09/20 03:21:18 UTC
[2/2] groovy git commit: formatting
formatting
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d40f188a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d40f188a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d40f188a
Branch: refs/heads/GROOVY_2_4_X
Commit: d40f188a86112d6a48e2eeff259d7485dc4ecd06
Parents: 32d5d1f
Author: John Wagenleitner <jw...@apache.org>
Authored: Sun Sep 18 10:56:55 2016 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Mon Sep 19 20:04:13 2016 -0700
----------------------------------------------------------------------
.../stc/StaticTypeCheckingSupport.java | 22 ++++++++++----------
src/test/groovy/bugs/Groovy7922Bug.groovy | 18 ++++++++++++++++
2 files changed, 29 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/d40f188a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
index bc1680d..cfca499 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
@@ -1108,18 +1108,18 @@ public abstract class StaticTypeCheckingSupport {
}
private static Collection<MethodNode> removeCovariantsAndInterfaceEquivalents(Collection<MethodNode> collection) {
- if (collection.size()<=1) return collection;
+ if (collection.size() <= 1) return collection;
List<MethodNode> toBeRemoved = new LinkedList<MethodNode>();
List<MethodNode> list = new LinkedList<MethodNode>(new HashSet<MethodNode>(collection));
- for (int i=0;i<list.size()-1;i++) {
+ for (int i = 0; i < list.size() - 1; i++) {
MethodNode one = list.get(i);
if (toBeRemoved.contains(one)) continue;
- for (int j=i+1;j<list.size();j++) {
+ for (int j = i + 1; j < list.size(); j++) {
MethodNode two = list.get(j);
if (toBeRemoved.contains(two)) continue;
if (one.getParameters().length == two.getParameters().length) {
if (areOverloadMethodsInSameClass(one,two)) {
- if (ParameterUtils.parametersEqual(one.getParameters(), two.getParameters())){
+ if (ParameterUtils.parametersEqual(one.getParameters(), two.getParameters())) {
removeMethodWithSuperReturnType(toBeRemoved, one, two);
} else {
// this is an imperfect solution to determining if two methods are
@@ -1127,7 +1127,7 @@ public abstract class StaticTypeCheckingSupport {
// in that case, Java marks the Object version as synthetic
removeSyntheticMethodIfOne(toBeRemoved, one, two);
}
- }else if(areEquivalentInterfaceMethods(one, two)){
+ } else if (areEquivalentInterfaceMethods(one, two)) {
// GROOVY-6970 choose between equivalent interface methods
removeMethodInSuperInterface(toBeRemoved, one, two);
}
@@ -1141,11 +1141,11 @@ public abstract class StaticTypeCheckingSupport {
}
private static void removeMethodInSuperInterface(List<MethodNode> toBeRemoved, MethodNode one, MethodNode two) {
- ClassNode oneDC=one.getDeclaringClass();
- ClassNode twoDC=two.getDeclaringClass();
- if(oneDC.implementsInterface(twoDC)){
+ ClassNode oneDC = one.getDeclaringClass();
+ ClassNode twoDC = two.getDeclaringClass();
+ if (oneDC.implementsInterface(twoDC)) {
toBeRemoved.add(two);
- }else{
+ } else {
toBeRemoved.add(one);
}
}
@@ -1175,8 +1175,8 @@ public abstract class StaticTypeCheckingSupport {
}
}
- private static boolean areOverloadMethodsInSameClass(MethodNode one, MethodNode two){
- return one.getName().equals(two.getName()) && one.getDeclaringClass()==two.getDeclaringClass();
+ private static boolean areOverloadMethodsInSameClass(MethodNode one, MethodNode two) {
+ return one.getName().equals(two.getName()) && one.getDeclaringClass() == two.getDeclaringClass();
}
/**
http://git-wip-us.apache.org/repos/asf/groovy/blob/d40f188a/src/test/groovy/bugs/Groovy7922Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy7922Bug.groovy b/src/test/groovy/bugs/Groovy7922Bug.groovy
index c71d774..b2ca07c 100644
--- a/src/test/groovy/bugs/Groovy7922Bug.groovy
+++ b/src/test/groovy/bugs/Groovy7922Bug.groovy
@@ -1,3 +1,21 @@
+/*
+ * 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 groovy.bugs;
import gls.CompilableTestSupport;