[1/3] groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/master 322e86274 -> 12d0f4431 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/cb7db51e Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/cb7db51e Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/cb7db51e Branch: refs/heads/master Commit: cb7db51e2c41a4ed5ca2c179dc3d0b2e7b6b5618 Parents: 322e862 Author: Paul King Authored: Thu Apr 12 18:50:39 2018 +1000 Committer: Paul King Committed: Fri Apr 13 03:25:30 2018 +1000 -- src/main/java/org/codehaus/groovy/control/GenericsVisitor.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/cb7db51e/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java -- diff --git a/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java b/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java index 36ef5ea..53885cf 100644 --- a/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java +++ b/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java @@ -30,8 +30,6 @@ import org.codehaus.groovy.ast.expr.ConstructorCallExpression; /** * class used to verify correct usage of generics in * class header (class and superclass declaration) - * - * @author Jochen Theodorou */ public class GenericsVisitor extends ClassCodeVisitorSupport { private final SourceUnit source; @@ -48,7 +46,7 @@ public class GenericsVisitor extends ClassCodeVisitorSupport { public void visitClass(ClassNode node) { boolean error = checkWildcard(node); if (error) return; -boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode)node).isAnonymous(); +boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode) node).isAnonymous(); checkGenericsUsage(node.getUnresolvedSuperClass(false), node.getSuperClass(), isAnon ? true : null); ClassNode[] interfaces = node.getInterfaces(); for (ClassNode anInterface : interfaces) { @@ -67,7 +65,7 @@ public class GenericsVisitor extends ClassCodeVisitorSupport { @Override public void visitConstructorCallExpression(ConstructorCallExpression call) { ClassNode type = call.getType(); -boolean isAnon = type instanceof InnerClassNode && ((InnerClassNode)type).isAnonymous(); +boolean isAnon = type instanceof InnerClassNode && ((InnerClassNode) type).isAnonymous(); checkGenericsUsage(type, type.redirect(), isAnon); }
[1/3] groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X 61284355f -> d862bdbdc formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2c9197fa Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2c9197fa Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2c9197fa Branch: refs/heads/GROOVY_2_6_X Commit: 2c9197fa2fa57c4cfc46e55d97ebb8b876b559c8 Parents: 6128435 Author: Paul King Authored: Thu Apr 12 18:50:39 2018 +1000 Committer: Paul King Committed: Thu Apr 12 23:42:01 2018 +1000 -- src/main/java/org/codehaus/groovy/control/GenericsVisitor.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/2c9197fa/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java -- diff --git a/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java b/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java index 36ef5ea..53885cf 100644 --- a/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java +++ b/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java @@ -30,8 +30,6 @@ import org.codehaus.groovy.ast.expr.ConstructorCallExpression; /** * class used to verify correct usage of generics in * class header (class and superclass declaration) - * - * @author Jochen Theodorou */ public class GenericsVisitor extends ClassCodeVisitorSupport { private final SourceUnit source; @@ -48,7 +46,7 @@ public class GenericsVisitor extends ClassCodeVisitorSupport { public void visitClass(ClassNode node) { boolean error = checkWildcard(node); if (error) return; -boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode)node).isAnonymous(); +boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode) node).isAnonymous(); checkGenericsUsage(node.getUnresolvedSuperClass(false), node.getSuperClass(), isAnon ? true : null); ClassNode[] interfaces = node.getInterfaces(); for (ClassNode anInterface : interfaces) { @@ -67,7 +65,7 @@ public class GenericsVisitor extends ClassCodeVisitorSupport { @Override public void visitConstructorCallExpression(ConstructorCallExpression call) { ClassNode type = call.getType(); -boolean isAnon = type instanceof InnerClassNode && ((InnerClassNode)type).isAnonymous(); +boolean isAnon = type instanceof InnerClassNode && ((InnerClassNode) type).isAnonymous(); checkGenericsUsage(type, type.redirect(), isAnon); }
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X d3d75e514 -> 43706262b formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/43706262 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/43706262 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/43706262 Branch: refs/heads/GROOVY_2_5_X Commit: 43706262b33b37ea4006e81027e9e6a1fe1d9efa Parents: d3d75e5 Author: Paul King Authored: Thu Apr 12 18:50:39 2018 +1000 Committer: Paul King Committed: Thu Apr 12 18:50:39 2018 +1000 -- src/main/java/org/codehaus/groovy/control/GenericsVisitor.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/43706262/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java -- diff --git a/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java b/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java index 36ef5ea..53885cf 100644 --- a/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java +++ b/src/main/java/org/codehaus/groovy/control/GenericsVisitor.java @@ -30,8 +30,6 @@ import org.codehaus.groovy.ast.expr.ConstructorCallExpression; /** * class used to verify correct usage of generics in * class header (class and superclass declaration) - * - * @author Jochen Theodorou */ public class GenericsVisitor extends ClassCodeVisitorSupport { private final SourceUnit source; @@ -48,7 +46,7 @@ public class GenericsVisitor extends ClassCodeVisitorSupport { public void visitClass(ClassNode node) { boolean error = checkWildcard(node); if (error) return; -boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode)node).isAnonymous(); +boolean isAnon = node instanceof InnerClassNode && ((InnerClassNode) node).isAnonymous(); checkGenericsUsage(node.getUnresolvedSuperClass(false), node.getSuperClass(), isAnon ? true : null); ClassNode[] interfaces = node.getInterfaces(); for (ClassNode anInterface : interfaces) { @@ -67,7 +65,7 @@ public class GenericsVisitor extends ClassCodeVisitorSupport { @Override public void visitConstructorCallExpression(ConstructorCallExpression call) { ClassNode type = call.getType(); -boolean isAnon = type instanceof InnerClassNode && ((InnerClassNode)type).isAnonymous(); +boolean isAnon = type instanceof InnerClassNode && ((InnerClassNode) type).isAnonymous(); checkGenericsUsage(type, type.redirect(), isAnon); }
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X 7d49e93e5 -> d3d75e514 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d3d75e51 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d3d75e51 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d3d75e51 Branch: refs/heads/GROOVY_2_5_X Commit: d3d75e5140327c2a05bff0ec9c9cff10004e18f6 Parents: 7d49e93 Author: Paul King Authored: Thu Apr 12 13:57:41 2018 +1000 Committer: Paul King Committed: Thu Apr 12 13:57:41 2018 +1000 -- src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/d3d75e51/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java -- diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java index 83d1999..31f6c6e 100644 --- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java +++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java @@ -144,7 +144,7 @@ public class GenericsUtils { * types it defines. * * @param node the class node to check - + @param map the generics type information collector + * @param map the generics type information collector */ public static void extractPlaceholders(ClassNode node, Map map) { if (node == null) return;
[2/2] groovy git commit: formatting only
formatting only Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d98afbeb Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d98afbeb Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d98afbeb Branch: refs/heads/GROOVY_2_5_X Commit: d98afbeb2b332be1853dacdca2aecc300ca0743c Parents: 15fc348 Author: Paul King Authored: Thu Apr 12 10:52:32 2018 +1000 Committer: Paul King Committed: Thu Apr 12 10:52:32 2018 +1000 -- .../groovy/ast/tools/GenericsUtils.java | 118 ++-- .../stc/StaticTypeCheckingSupport.java | 377 +- .../stc/StaticTypeCheckingVisitor.java | 683 ++- 3 files changed, 610 insertions(+), 568 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/d98afbeb/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java -- diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java index 126ef42..1b0fb04 100644 --- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java +++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java @@ -52,9 +52,6 @@ import static org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.implem /** * Utility methods to deal with generic types. - * - * @author Cedric Champeau - * @author Paul King */ public class GenericsUtils { public static final GenericsType[] EMPTY_GENERICS_ARRAY = GenericsType.EMPTY_ARRAY; @@ -65,28 +62,29 @@ public class GenericsUtils { * class uses generic type(redirectGenericTypes), is used with actual type parameters * , then a class or interface using generic types * will be aligned to + * * @param redirectGenericTypes the type arguments or the redirect class node - * @param parameterizedTypes the actual type arguments used on this class node - * @param alignmentTarget the generic type arguments to which we want to align to + * @param parameterizedTypes the actual type arguments used on this class node + * @param alignmentTarget the generic type arguments to which we want to align to * @return aligned type arguments * @deprecated You shouldn't call this method because it is inherently unreliable */ @Deprecated public static GenericsType[] alignGenericTypes(final GenericsType[] redirectGenericTypes, final GenericsType[] parameterizedTypes, final GenericsType[] alignmentTarget) { -if (alignmentTarget==null) return EMPTY_GENERICS_ARRAY; -if (parameterizedTypes==null || parameterizedTypes.length==0) return alignmentTarget; +if (alignmentTarget == null) return EMPTY_GENERICS_ARRAY; +if (parameterizedTypes == null || parameterizedTypes.length == 0) return alignmentTarget; GenericsType[] generics = new GenericsType[alignmentTarget.length]; for (int i = 0, scgtLength = alignmentTarget.length; i < scgtLength; i++) { final GenericsType currentTarget = alignmentTarget[i]; GenericsType match = null; -if (redirectGenericTypes!=null) { +if (redirectGenericTypes != null) { for (int j = 0; j < redirectGenericTypes.length && match == null; j++) { GenericsType redirectGenericType = redirectGenericTypes[j]; if (redirectGenericType.isCompatibleWith(currentTarget.getType())) { if (currentTarget.isPlaceholder() && redirectGenericType.isPlaceholder() && !currentTarget.getName().equals(redirectGenericType.getName())) { // check if there's a potential better match boolean skip = false; -for (int k=j+1; k genericsSpec, MethodNode mn) { +public static MethodNode correctToGenericsSpec(Map genericsSpec, MethodNode mn) { ClassNode correctedType = correctToGenericsSpecRecurse(genericsSpec, mn.getReturnType()); Parameter[] origParameters = mn.getParameters(); Parameter[] newParameters = new Parameter[origParameters.length]; @@ -293,26 +295,26 @@ public class GenericsUtils { return new MethodNode(mn.getName(), mn.getModifiers(), correctedType, newParameters, mn.getExceptions(), mn.getCode()); } -public static ClassNode correctToGenericsSpecRecurse(Map genericsSpec, ClassNode type) { +public static ClassNode correctToGenericsSpecRecurse(Map genericsSpec, ClassNode type) { return correctToGenericsSpecRecurse(genericsSpec, type, new ArrayList()); } /** * @since 2.4.1 */ -public static ClassNode[] corr
[1/2] groovy git commit: formatting only
Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X 15fc34835 -> d98afbeb2 http://git-wip-us.apache.org/repos/asf/groovy/blob/d98afbeb/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java -- diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java index 9137bd7..b8f3763 100644 --- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -300,13 +300,13 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { if (returnStatement.getExpression() == ConstantExpression.NULL) return; if (isNullConstant(returnStatement.getExpression())) return; checkReturnType(returnStatement); -if (typeCheckingContext.getEnclosingClosure()!=null) { +if (typeCheckingContext.getEnclosingClosure() != null) { addClosureReturnType(getType(returnStatement.getExpression())); } else if (typeCheckingContext.getEnclosingMethod() != null) { } else { throw new GroovyBugError("Unexpected return statement at " -+ returnStatement.getLineNumber()+":"+returnStatement.getColumnNumber() -+ " "+returnStatement.getText()); ++ returnStatement.getLineNumber() + ":" + returnStatement.getColumnNumber() ++ " " + returnStatement.getText()); } } }; @@ -441,6 +441,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { /** * Test if a node is an inner class node, and if it is, then checks if the enclosing method is skipped. + * * @param node * @return true if the inner class node should be skipped */ @@ -462,7 +463,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { @SuppressWarnings("unchecked") private static void addPrivateFieldOrMethodAccess(Expression source, ClassNode cn, StaticTypesMarker type, ASTNode accessedMember) { Set set = (Set) cn.getNodeMetaData(type); -if (set==null) { +if (set == null) { set = new LinkedHashSet(); cn.putNodeMetaData(type, set); } @@ -474,9 +475,9 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { * Given a field node, checks if we are accessing or setting a private field from an inner class. */ private void checkOrMarkPrivateAccess(Expression source, FieldNode fn, boolean lhsOfAssignment) { -if (fn!=null && Modifier.isPrivate(fn.getModifiers()) && -(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) && -fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) { +if (fn != null && Modifier.isPrivate(fn.getModifiers()) && +(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure() != null) && +fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) { StaticTypesMarker marker = lhsOfAssignment ? StaticTypesMarker.PV_FIELDS_MUTATION : StaticTypesMarker.PV_FIELDS_ACCESS; addPrivateFieldOrMethodAccess(source, fn.getDeclaringClass(), marker, fn); } @@ -486,7 +487,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { * Given a method node, checks if we are calling a private method from an inner class. */ private void checkOrMarkPrivateAccess(Expression source, MethodNode mn) { -if (mn==null) { +if (mn == null) { return; } ClassNode declaringClass = mn.getDeclaringClass(); @@ -495,7 +496,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { int mods = mn.getModifiers(); boolean sameModule = declaringClass.getModule() == enclosingClassNode.getModule(); String packageName = declaringClass.getPackageName(); -if (packageName==null) { +if (packageName == null) { packageName = ""; } if ((Modifier.isPrivate(mods) && sameModule)) { @@ -515,7 +516,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { private void checkSuperCallFromClosure(Expression call, MethodNode directCallTarget) { if (call instanceof MethodCallExpression && typeCheckingContext.getEnclosingClosure() != null) { -Expression objectExpression = ((MethodCallExpression)call).getObjectExpressio
[1/2] groovy git commit: formatting only
Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X 49a1c02d8 -> ef659512a http://git-wip-us.apache.org/repos/asf/groovy/blob/ef659512/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java -- diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java index 17d6c92..9308617 100644 --- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -304,13 +304,13 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { if (returnStatement.getExpression() == ConstantExpression.NULL) return; if (isNullConstant(returnStatement.getExpression())) return; checkReturnType(returnStatement); -if (typeCheckingContext.getEnclosingClosure()!=null) { +if (typeCheckingContext.getEnclosingClosure() != null) { addClosureReturnType(getType(returnStatement.getExpression())); } else if (typeCheckingContext.getEnclosingMethod() != null) { } else { throw new GroovyBugError("Unexpected return statement at " -+ returnStatement.getLineNumber()+":"+returnStatement.getColumnNumber() -+ " "+returnStatement.getText()); ++ returnStatement.getLineNumber() + ":" + returnStatement.getColumnNumber() ++ " " + returnStatement.getText()); } } }; @@ -445,6 +445,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { /** * Test if a node is an inner class node, and if it is, then checks if the enclosing method is skipped. + * * @param node * @return true if the inner class node should be skipped */ @@ -466,7 +467,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { @SuppressWarnings("unchecked") private static void addPrivateFieldOrMethodAccess(Expression source, ClassNode cn, StaticTypesMarker type, ASTNode accessedMember) { Set set = (Set) cn.getNodeMetaData(type); -if (set==null) { +if (set == null) { set = new LinkedHashSet(); cn.putNodeMetaData(type, set); } @@ -478,9 +479,9 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { * Given a field node, checks if we are accessing or setting a private field from an inner class. */ private void checkOrMarkPrivateAccess(Expression source, FieldNode fn, boolean lhsOfAssignment) { -if (fn!=null && Modifier.isPrivate(fn.getModifiers()) && -(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) && -fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) { +if (fn != null && Modifier.isPrivate(fn.getModifiers()) && +(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure() != null) && +fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) { StaticTypesMarker marker = lhsOfAssignment ? StaticTypesMarker.PV_FIELDS_MUTATION : StaticTypesMarker.PV_FIELDS_ACCESS; addPrivateFieldOrMethodAccess(source, fn.getDeclaringClass(), marker, fn); } @@ -490,7 +491,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { * Given a method node, checks if we are calling a private method from an inner class. */ private void checkOrMarkPrivateAccess(Expression source, MethodNode mn) { -if (mn==null) { +if (mn == null) { return; } ClassNode declaringClass = mn.getDeclaringClass(); @@ -499,7 +500,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { int mods = mn.getModifiers(); boolean sameModule = declaringClass.getModule() == enclosingClassNode.getModule(); String packageName = declaringClass.getPackageName(); -if (packageName==null) { +if (packageName == null) { packageName = ""; } if ((Modifier.isPrivate(mods) && sameModule)) { @@ -519,7 +520,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { private void checkSuperCallFromClosure(Expression call, MethodNode directCallTarget) { if (call instanceof MethodCallExpression && typeCheckingContext.getEnclosingClosure() != null) { -Expression objectExpression = ((MethodCallExpression)call).getObjectExpressio
[2/2] groovy git commit: formatting only
formatting only Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ef659512 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ef659512 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ef659512 Branch: refs/heads/GROOVY_2_6_X Commit: ef659512a5ca54ca120dc5e86d5fd0472b7e Parents: 49a1c02 Author: Paul King Authored: Thu Apr 12 10:12:09 2018 +1000 Committer: Paul King Committed: Thu Apr 12 10:49:00 2018 +1000 -- .../groovy/ast/tools/GenericsUtils.java | 122 ++-- .../stc/StaticTypeCheckingSupport.java | 380 ++- .../stc/StaticTypeCheckingVisitor.java | 672 ++- 3 files changed, 610 insertions(+), 564 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/ef659512/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java -- diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java index 126ef42..b562ab8 100644 --- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java +++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java @@ -52,9 +52,6 @@ import static org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.implem /** * Utility methods to deal with generic types. - * - * @author Cedric Champeau - * @author Paul King */ public class GenericsUtils { public static final GenericsType[] EMPTY_GENERICS_ARRAY = GenericsType.EMPTY_ARRAY; @@ -65,28 +62,29 @@ public class GenericsUtils { * class uses generic type(redirectGenericTypes), is used with actual type parameters * , then a class or interface using generic types * will be aligned to + * * @param redirectGenericTypes the type arguments or the redirect class node - * @param parameterizedTypes the actual type arguments used on this class node - * @param alignmentTarget the generic type arguments to which we want to align to + * @param parameterizedTypes the actual type arguments used on this class node + * @param alignmentTarget the generic type arguments to which we want to align to * @return aligned type arguments * @deprecated You shouldn't call this method because it is inherently unreliable */ @Deprecated public static GenericsType[] alignGenericTypes(final GenericsType[] redirectGenericTypes, final GenericsType[] parameterizedTypes, final GenericsType[] alignmentTarget) { -if (alignmentTarget==null) return EMPTY_GENERICS_ARRAY; -if (parameterizedTypes==null || parameterizedTypes.length==0) return alignmentTarget; +if (alignmentTarget == null) return EMPTY_GENERICS_ARRAY; +if (parameterizedTypes == null || parameterizedTypes.length == 0) return alignmentTarget; GenericsType[] generics = new GenericsType[alignmentTarget.length]; for (int i = 0, scgtLength = alignmentTarget.length; i < scgtLength; i++) { final GenericsType currentTarget = alignmentTarget[i]; GenericsType match = null; -if (redirectGenericTypes!=null) { +if (redirectGenericTypes != null) { for (int j = 0; j < redirectGenericTypes.length && match == null; j++) { GenericsType redirectGenericType = redirectGenericTypes[j]; if (redirectGenericType.isCompatibleWith(currentTarget.getType())) { if (currentTarget.isPlaceholder() && redirectGenericType.isPlaceholder() && !currentTarget.getName().equals(redirectGenericType.getName())) { // check if there's a potential better match boolean skip = false; -for (int k=j+1; k map) { if (node == null) return; @@ -158,7 +158,7 @@ public class GenericsUtils { GenericsType[] parameterized = node.getGenericsTypes(); if (parameterized == null || parameterized.length == 0) return; GenericsType[] redirectGenericsTypes = node.redirect().getGenericsTypes(); -if (redirectGenericsTypes==null) redirectGenericsTypes = parameterized; +if (redirectGenericsTypes == null) redirectGenericsTypes = parameterized; for (int i = 0; i < redirectGenericsTypes.length; i++) { GenericsType redirectType = redirectGenericsTypes[i]; if (redirectType.isPlaceholder()) { @@ -168,11 +168,11 @@ public class GenericsUtils { map.put(name, value); if (value.isWildcard()) { ClassNode lowerBound = value.getLowerBound(); -i
[1/2] groovy git commit: formatting only
Repository: groovy Updated Branches: refs/heads/master 4ada9e66c -> d033d1ce5 http://git-wip-us.apache.org/repos/asf/groovy/blob/d033d1ce/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java -- diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java index c8e79bb..a6067c2 100644 --- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -304,13 +304,13 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { if (returnStatement.getExpression() == ConstantExpression.NULL) return; if (isNullConstant(returnStatement.getExpression())) return; checkReturnType(returnStatement); -if (typeCheckingContext.getEnclosingClosure()!=null) { +if (typeCheckingContext.getEnclosingClosure() != null) { addClosureReturnType(getType(returnStatement.getExpression())); } else if (typeCheckingContext.getEnclosingMethod() != null) { } else { throw new GroovyBugError("Unexpected return statement at " -+ returnStatement.getLineNumber()+":"+returnStatement.getColumnNumber() -+ " "+returnStatement.getText()); ++ returnStatement.getLineNumber() + ":" + returnStatement.getColumnNumber() ++ " " + returnStatement.getText()); } } }; @@ -445,6 +445,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { /** * Test if a node is an inner class node, and if it is, then checks if the enclosing method is skipped. + * * @param node * @return true if the inner class node should be skipped */ @@ -466,7 +467,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { @SuppressWarnings("unchecked") private static void addPrivateFieldOrMethodAccess(Expression source, ClassNode cn, StaticTypesMarker type, ASTNode accessedMember) { Set set = (Set) cn.getNodeMetaData(type); -if (set==null) { +if (set == null) { set = new LinkedHashSet(); cn.putNodeMetaData(type, set); } @@ -478,9 +479,9 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { * Given a field node, checks if we are accessing or setting a private field from an inner class. */ private void checkOrMarkPrivateAccess(Expression source, FieldNode fn, boolean lhsOfAssignment) { -if (fn!=null && Modifier.isPrivate(fn.getModifiers()) && -(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) && -fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) { +if (fn != null && Modifier.isPrivate(fn.getModifiers()) && +(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure() != null) && +fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) { StaticTypesMarker marker = lhsOfAssignment ? StaticTypesMarker.PV_FIELDS_MUTATION : StaticTypesMarker.PV_FIELDS_ACCESS; addPrivateFieldOrMethodAccess(source, fn.getDeclaringClass(), marker, fn); } @@ -490,7 +491,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { * Given a method node, checks if we are calling a private method from an inner class. */ private void checkOrMarkPrivateAccess(Expression source, MethodNode mn) { -if (mn==null) { +if (mn == null) { return; } ClassNode declaringClass = mn.getDeclaringClass(); @@ -499,7 +500,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { int mods = mn.getModifiers(); boolean sameModule = declaringClass.getModule() == enclosingClassNode.getModule(); String packageName = declaringClass.getPackageName(); -if (packageName==null) { +if (packageName == null) { packageName = ""; } if ((Modifier.isPrivate(mods) && sameModule)) { @@ -519,7 +520,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport { private void checkSuperCallFromClosure(Expression call, MethodNode directCallTarget) { if (call instanceof MethodCallExpression && typeCheckingContext.getEnclosingClosure() != null) { -Expression objectExpression = ((MethodCallExpression)call).getObjectExpression(); +
[2/2] groovy git commit: formatting only
formatting only Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/d033d1ce Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/d033d1ce Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/d033d1ce Branch: refs/heads/master Commit: d033d1ce591389f867698b49558621e899a91788 Parents: 4ada9e6 Author: Paul King Authored: Thu Apr 12 10:12:09 2018 +1000 Committer: Paul King Committed: Thu Apr 12 10:12:09 2018 +1000 -- .../groovy/ast/tools/GenericsUtils.java | 122 ++-- .../stc/StaticTypeCheckingSupport.java | 380 ++- .../stc/StaticTypeCheckingVisitor.java | 672 ++- 3 files changed, 610 insertions(+), 564 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/d033d1ce/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java -- diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java index 126ef42..b562ab8 100644 --- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java +++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java @@ -52,9 +52,6 @@ import static org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.implem /** * Utility methods to deal with generic types. - * - * @author Cedric Champeau - * @author Paul King */ public class GenericsUtils { public static final GenericsType[] EMPTY_GENERICS_ARRAY = GenericsType.EMPTY_ARRAY; @@ -65,28 +62,29 @@ public class GenericsUtils { * class uses generic type(redirectGenericTypes), is used with actual type parameters * , then a class or interface using generic types * will be aligned to + * * @param redirectGenericTypes the type arguments or the redirect class node - * @param parameterizedTypes the actual type arguments used on this class node - * @param alignmentTarget the generic type arguments to which we want to align to + * @param parameterizedTypes the actual type arguments used on this class node + * @param alignmentTarget the generic type arguments to which we want to align to * @return aligned type arguments * @deprecated You shouldn't call this method because it is inherently unreliable */ @Deprecated public static GenericsType[] alignGenericTypes(final GenericsType[] redirectGenericTypes, final GenericsType[] parameterizedTypes, final GenericsType[] alignmentTarget) { -if (alignmentTarget==null) return EMPTY_GENERICS_ARRAY; -if (parameterizedTypes==null || parameterizedTypes.length==0) return alignmentTarget; +if (alignmentTarget == null) return EMPTY_GENERICS_ARRAY; +if (parameterizedTypes == null || parameterizedTypes.length == 0) return alignmentTarget; GenericsType[] generics = new GenericsType[alignmentTarget.length]; for (int i = 0, scgtLength = alignmentTarget.length; i < scgtLength; i++) { final GenericsType currentTarget = alignmentTarget[i]; GenericsType match = null; -if (redirectGenericTypes!=null) { +if (redirectGenericTypes != null) { for (int j = 0; j < redirectGenericTypes.length && match == null; j++) { GenericsType redirectGenericType = redirectGenericTypes[j]; if (redirectGenericType.isCompatibleWith(currentTarget.getType())) { if (currentTarget.isPlaceholder() && redirectGenericType.isPlaceholder() && !currentTarget.getName().equals(redirectGenericType.getName())) { // check if there's a potential better match boolean skip = false; -for (int k=j+1; k map) { if (node == null) return; @@ -158,7 +158,7 @@ public class GenericsUtils { GenericsType[] parameterized = node.getGenericsTypes(); if (parameterized == null || parameterized.length == 0) return; GenericsType[] redirectGenericsTypes = node.redirect().getGenericsTypes(); -if (redirectGenericsTypes==null) redirectGenericsTypes = parameterized; +if (redirectGenericsTypes == null) redirectGenericsTypes = parameterized; for (int i = 0; i < redirectGenericsTypes.length; i++) { GenericsType redirectType = redirectGenericsTypes[i]; if (redirectType.isPlaceholder()) { @@ -168,11 +168,11 @@ public class GenericsUtils { map.put(name, value); if (value.isWildcard()) { ClassNode lowerBound = value.getLowerBound(); -if (low
[1/2] groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X a259ad3b1 -> cf6a6c7c5 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5748573b Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5748573b Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5748573b Branch: refs/heads/GROOVY_2_6_X Commit: 5748573b2dafd9664e5e79a0aeab0ea43d7628e6 Parents: a259ad3 Author: Paul King Authored: Sun Apr 1 23:09:29 2018 +1000 Committer: Paul King Committed: Sun Apr 1 23:41:19 2018 +1000 -- .../runtime/metaclass/MetaClassRegistryImpl.java | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/5748573b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java -- diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java index ff30a2b..2914d02 100644 --- a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java +++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java @@ -513,22 +513,22 @@ public class MetaClassRegistryImpl implements MetaClassRegistry{ public void onModule(final ExtensionModule module) { if (moduleRegistry.hasModule(module.getName())) { -ExtensionModule loadedModule = moduleRegistry.getModule(module.getName()); -if (loadedModule.getVersion().equals(module.getVersion())) { -// already registered -return; -} else { -throw new GroovyRuntimeException("Conflicting module versions. Module ["+module.getName()+" is loaded in version "+ -loadedModule.getVersion()+" and you are trying to load version "+module.getVersion()); +ExtensionModule loadedModule = moduleRegistry.getModule(module.getName()); +if (loadedModule.getVersion().equals(module.getVersion())) { +// already registered +return; +} else { +throw new GroovyRuntimeException("Conflicting module versions. Module [" + module.getName() + " is loaded in version " + +loadedModule.getVersion() + " and you are trying to load version " + module.getVersion()); +} } -} moduleRegistry.addModule(module); // register MetaMethods List metaMethods = module.getMetaMethods(); for (MetaMethod metaMethod : metaMethods) { CachedClass cachedClass = metaMethod.getDeclaringClass(); List methods = map.get(cachedClass); -if (methods==null) { +if (methods == null) { methods = new ArrayList(4); map.put(cachedClass, methods); }
[1/2] groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/master 650c16c58 -> d4e792523 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/a3ed9d48 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/a3ed9d48 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/a3ed9d48 Branch: refs/heads/master Commit: a3ed9d482381f8ea0e6a9efd16c35028c66791e0 Parents: 650c16c Author: Paul King Authored: Sun Apr 1 23:09:29 2018 +1000 Committer: Paul King Committed: Sun Apr 1 23:40:33 2018 +1000 -- .../runtime/metaclass/MetaClassRegistryImpl.java | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/a3ed9d48/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java -- diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java index ff30a2b..2914d02 100644 --- a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java +++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java @@ -513,22 +513,22 @@ public class MetaClassRegistryImpl implements MetaClassRegistry{ public void onModule(final ExtensionModule module) { if (moduleRegistry.hasModule(module.getName())) { -ExtensionModule loadedModule = moduleRegistry.getModule(module.getName()); -if (loadedModule.getVersion().equals(module.getVersion())) { -// already registered -return; -} else { -throw new GroovyRuntimeException("Conflicting module versions. Module ["+module.getName()+" is loaded in version "+ -loadedModule.getVersion()+" and you are trying to load version "+module.getVersion()); +ExtensionModule loadedModule = moduleRegistry.getModule(module.getName()); +if (loadedModule.getVersion().equals(module.getVersion())) { +// already registered +return; +} else { +throw new GroovyRuntimeException("Conflicting module versions. Module [" + module.getName() + " is loaded in version " + +loadedModule.getVersion() + " and you are trying to load version " + module.getVersion()); +} } -} moduleRegistry.addModule(module); // register MetaMethods List metaMethods = module.getMetaMethods(); for (MetaMethod metaMethod : metaMethods) { CachedClass cachedClass = metaMethod.getDeclaringClass(); List methods = map.get(cachedClass); -if (methods==null) { +if (methods == null) { methods = new ArrayList(4); map.put(cachedClass, methods); }
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X d1d875387 -> 0f3ed8d6b formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/0f3ed8d6 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/0f3ed8d6 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/0f3ed8d6 Branch: refs/heads/GROOVY_2_5_X Commit: 0f3ed8d6bc03e78065907063083362b36b731ff7 Parents: d1d8753 Author: Paul King Authored: Sun Apr 1 23:09:29 2018 +1000 Committer: Paul King Committed: Sun Apr 1 23:09:29 2018 +1000 -- .../runtime/metaclass/MetaClassRegistryImpl.java | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/0f3ed8d6/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java -- diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java index ff30a2b..2914d02 100644 --- a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java +++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java @@ -513,22 +513,22 @@ public class MetaClassRegistryImpl implements MetaClassRegistry{ public void onModule(final ExtensionModule module) { if (moduleRegistry.hasModule(module.getName())) { -ExtensionModule loadedModule = moduleRegistry.getModule(module.getName()); -if (loadedModule.getVersion().equals(module.getVersion())) { -// already registered -return; -} else { -throw new GroovyRuntimeException("Conflicting module versions. Module ["+module.getName()+" is loaded in version "+ -loadedModule.getVersion()+" and you are trying to load version "+module.getVersion()); +ExtensionModule loadedModule = moduleRegistry.getModule(module.getName()); +if (loadedModule.getVersion().equals(module.getVersion())) { +// already registered +return; +} else { +throw new GroovyRuntimeException("Conflicting module versions. Module [" + module.getName() + " is loaded in version " + +loadedModule.getVersion() + " and you are trying to load version " + module.getVersion()); +} } -} moduleRegistry.addModule(module); // register MetaMethods List metaMethods = module.getMetaMethods(); for (MetaMethod metaMethod : metaMethods) { CachedClass cachedClass = metaMethod.getDeclaringClass(); List methods = map.get(cachedClass); -if (methods==null) { +if (methods == null) { methods = new ArrayList(4); map.put(cachedClass, methods); }
[1/2] groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X d00a10f6d -> 1d34e01f2 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/1d34e01f Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/1d34e01f Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/1d34e01f Branch: refs/heads/GROOVY_2_5_X Commit: 1d34e01f21905b20c84e42e09c1ffda57c164925 Parents: 0305a38 Author: John Wagenleitner Authored: Sun Jun 4 16:09:48 2017 -0700 Committer: John Wagenleitner Committed: Sun Jun 4 16:18:02 2017 -0700 -- .../reflection/AccessPermissionChecker.java | 31 ++-- .../reflection/CacheAccessControlException.java | 2 +- .../groovy/reflection/CachedMethod.java | 3 +- 3 files changed, 18 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/1d34e01f/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java -- diff --git a/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java b/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java index 73f35a9..4ad0373 100644 --- a/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java +++ b/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java @@ -26,23 +26,24 @@ import java.security.AccessControlException; import groovy.lang.GroovyObject; -class AccessPermissionChecker { +final class AccessPermissionChecker { private static final ReflectPermission REFLECT_PERMISSION = new ReflectPermission("suppressAccessChecks"); +private AccessPermissionChecker() { +} + private static void checkAccessPermission(Class declaringClass, final int modifiers, boolean isAccessible) { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null && isAccessible) { -if (((modifiers & Modifier.PRIVATE) != 0 -|| ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 - && packageCanNotBeAddedAnotherClass(declaringClass))) -&& !GroovyObject.class.isAssignableFrom(declaringClass)) { -securityManager.checkPermission(REFLECT_PERMISSION); -} -else if ((modifiers & (Modifier.PROTECTED)) != 0 -&& declaringClass.equals(ClassLoader.class)){ -securityManager.checkCreateClassLoader(); -} +if (((modifiers & Modifier.PRIVATE) != 0 +|| ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 +&& packageCanNotBeAddedAnotherClass(declaringClass))) +&& !GroovyObject.class.isAssignableFrom(declaringClass)) { +securityManager.checkPermission(REFLECT_PERMISSION); +} else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)) { +securityManager.checkCreateClassLoader(); +} } } @@ -60,7 +61,8 @@ class AccessPermissionChecker { private static CacheAccessControlException createCacheAccessControlExceptionOf(Method method, AccessControlException e) { return new CacheAccessControlException( -"Groovy object can not access method " + method.getName() + " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName() +"Groovy object can not access method " + method.getName() ++ " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName() + " with modifiers \"" + Modifier.toString(method.getModifiers()) + "\"", e); } @@ -74,10 +76,9 @@ class AccessPermissionChecker { private static CacheAccessControlException createCacheAccessControlExceptionOf(Field field, AccessControlException e) { return new CacheAccessControlException( -"Groovy object can not access field " + field.getName() + " cacheAccessControlExceptionOf class " + field.getDeclaringClass().getName() +"Groovy object can not access field " + field.getName() ++ " cacheAccessControlExceptionOf class " + field.getDeclaringClass().getName() + " with modifiers \"" + Modifier.toString(field.getModifiers()) + "\"", e); } -private AccessPermissionChecker() {} - } http://git-wip-us.apache.org/repos/asf/groovy/blob/1d34e01f/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.java -- diff --git a/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.
[1/2] groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X 14b3d46c5 -> 0aeb0a773 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/0aeb0a77 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/0aeb0a77 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/0aeb0a77 Branch: refs/heads/GROOVY_2_6_X Commit: 0aeb0a77329005c3c05a4be9a70dae0eae5a8a52 Parents: b039c35 Author: John Wagenleitner Authored: Sun Jun 4 16:09:48 2017 -0700 Committer: John Wagenleitner Committed: Sun Jun 4 16:16:32 2017 -0700 -- .../reflection/AccessPermissionChecker.java | 31 ++-- .../reflection/CacheAccessControlException.java | 2 +- .../groovy/reflection/CachedMethod.java | 3 +- 3 files changed, 18 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/0aeb0a77/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java -- diff --git a/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java b/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java index 73f35a9..4ad0373 100644 --- a/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java +++ b/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java @@ -26,23 +26,24 @@ import java.security.AccessControlException; import groovy.lang.GroovyObject; -class AccessPermissionChecker { +final class AccessPermissionChecker { private static final ReflectPermission REFLECT_PERMISSION = new ReflectPermission("suppressAccessChecks"); +private AccessPermissionChecker() { +} + private static void checkAccessPermission(Class declaringClass, final int modifiers, boolean isAccessible) { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null && isAccessible) { -if (((modifiers & Modifier.PRIVATE) != 0 -|| ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 - && packageCanNotBeAddedAnotherClass(declaringClass))) -&& !GroovyObject.class.isAssignableFrom(declaringClass)) { -securityManager.checkPermission(REFLECT_PERMISSION); -} -else if ((modifiers & (Modifier.PROTECTED)) != 0 -&& declaringClass.equals(ClassLoader.class)){ -securityManager.checkCreateClassLoader(); -} +if (((modifiers & Modifier.PRIVATE) != 0 +|| ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 +&& packageCanNotBeAddedAnotherClass(declaringClass))) +&& !GroovyObject.class.isAssignableFrom(declaringClass)) { +securityManager.checkPermission(REFLECT_PERMISSION); +} else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)) { +securityManager.checkCreateClassLoader(); +} } } @@ -60,7 +61,8 @@ class AccessPermissionChecker { private static CacheAccessControlException createCacheAccessControlExceptionOf(Method method, AccessControlException e) { return new CacheAccessControlException( -"Groovy object can not access method " + method.getName() + " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName() +"Groovy object can not access method " + method.getName() ++ " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName() + " with modifiers \"" + Modifier.toString(method.getModifiers()) + "\"", e); } @@ -74,10 +76,9 @@ class AccessPermissionChecker { private static CacheAccessControlException createCacheAccessControlExceptionOf(Field field, AccessControlException e) { return new CacheAccessControlException( -"Groovy object can not access field " + field.getName() + " cacheAccessControlExceptionOf class " + field.getDeclaringClass().getName() +"Groovy object can not access field " + field.getName() ++ " cacheAccessControlExceptionOf class " + field.getDeclaringClass().getName() + " with modifiers \"" + Modifier.toString(field.getModifiers()) + "\"", e); } -private AccessPermissionChecker() {} - } http://git-wip-us.apache.org/repos/asf/groovy/blob/0aeb0a77/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.java -- diff --git a/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.
[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/9c7504c0 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9c7504c0 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9c7504c0 Branch: refs/heads/master Commit: 9c7504c0bc51212f7dd9f1bdfb99f705e86ce483 Parents: ddecb50 Author: John Wagenleitner Authored: Sun Jun 4 16:09:48 2017 -0700 Committer: John Wagenleitner Committed: Sun Jun 4 16:09:48 2017 -0700 -- .../reflection/AccessPermissionChecker.java | 31 ++-- .../reflection/CacheAccessControlException.java | 2 +- .../groovy/reflection/CachedMethod.java | 3 +- 3 files changed, 18 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/9c7504c0/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java -- diff --git a/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java b/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java index 73f35a9..4ad0373 100644 --- a/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java +++ b/src/main/org/codehaus/groovy/reflection/AccessPermissionChecker.java @@ -26,23 +26,24 @@ import java.security.AccessControlException; import groovy.lang.GroovyObject; -class AccessPermissionChecker { +final class AccessPermissionChecker { private static final ReflectPermission REFLECT_PERMISSION = new ReflectPermission("suppressAccessChecks"); +private AccessPermissionChecker() { +} + private static void checkAccessPermission(Class declaringClass, final int modifiers, boolean isAccessible) { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null && isAccessible) { -if (((modifiers & Modifier.PRIVATE) != 0 -|| ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 - && packageCanNotBeAddedAnotherClass(declaringClass))) -&& !GroovyObject.class.isAssignableFrom(declaringClass)) { -securityManager.checkPermission(REFLECT_PERMISSION); -} -else if ((modifiers & (Modifier.PROTECTED)) != 0 -&& declaringClass.equals(ClassLoader.class)){ -securityManager.checkCreateClassLoader(); -} +if (((modifiers & Modifier.PRIVATE) != 0 +|| ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 +&& packageCanNotBeAddedAnotherClass(declaringClass))) +&& !GroovyObject.class.isAssignableFrom(declaringClass)) { +securityManager.checkPermission(REFLECT_PERMISSION); +} else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)) { +securityManager.checkCreateClassLoader(); +} } } @@ -60,7 +61,8 @@ class AccessPermissionChecker { private static CacheAccessControlException createCacheAccessControlExceptionOf(Method method, AccessControlException e) { return new CacheAccessControlException( -"Groovy object can not access method " + method.getName() + " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName() +"Groovy object can not access method " + method.getName() ++ " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName() + " with modifiers \"" + Modifier.toString(method.getModifiers()) + "\"", e); } @@ -74,10 +76,9 @@ class AccessPermissionChecker { private static CacheAccessControlException createCacheAccessControlExceptionOf(Field field, AccessControlException e) { return new CacheAccessControlException( -"Groovy object can not access field " + field.getName() + " cacheAccessControlExceptionOf class " + field.getDeclaringClass().getName() +"Groovy object can not access field " + field.getName() ++ " cacheAccessControlExceptionOf class " + field.getDeclaringClass().getName() + " with modifiers \"" + Modifier.toString(field.getModifiers()) + "\"", e); } -private AccessPermissionChecker() {} - } http://git-wip-us.apache.org/repos/asf/groovy/blob/9c7504c0/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.java -- diff --git a/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.java b/src/main/org/codehaus/groovy/reflection/CacheAccessControlException.java index b1438ec
[03/50] [abbrv] groovy git commit: formatting and general tidy up of some tests
formatting and general tidy up of some tests Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/94137c91 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/94137c91 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/94137c91 Branch: refs/heads/parrot Commit: 94137c91379b8152afe7e76e59c6537dc5a12ef3 Parents: 55c186f Author: paulk Authored: Tue Oct 4 10:59:04 2016 +1000 Committer: paulk Committed: Tue Oct 4 10:59:32 2016 +1000 -- gradle/pomconfigurer.gradle | 3 +++ src/tck/test/gls/ch03/s01/Unicode1.groovy | 11 +++- src/tck/test/gls/ch03/s01/Unicode2.groovy | 18 + .../gls/ch03/s02/LexicalTranslation1.groovy | 4 +-- src/tck/test/gls/ch03/s02/Longest1.groovy | 2 -- .../test/gls/ch03/s03/UnicodeEscapes1.groovy| 5 +--- .../test/gls/ch03/s03/UnicodeEscapes2.groovy| 27 ++-- 7 files changed, 30 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/gradle/pomconfigurer.gradle -- diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle index 3f08f4a..2877e8a 100644 --- a/gradle/pomconfigurer.gradle +++ b/gradle/pomconfigurer.gradle @@ -576,6 +576,9 @@ project.ext.pomConfigureClosureWithoutTweaks = { contributor { name 'Santhosh Kumar T' } +contributor { +name 'Alan Green' +} } mailingLists { mailingList { http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode1.groovy -- diff --git a/src/tck/test/gls/ch03/s01/Unicode1.groovy b/src/tck/test/gls/ch03/s01/Unicode1.groovy index 45ab780..92984ab 100644 --- a/src/tck/test/gls/ch03/s01/Unicode1.groovy +++ b/src/tck/test/gls/ch03/s01/Unicode1.groovy @@ -17,17 +17,14 @@ * under the License. */ package gls.ch03.s01; + /** * Except for comments, identifiers and the contents of ... string * literals, all input elements are formed from ASCII characters. * * TODO: Find a better way to test these things * Note that this is a little hard to test since the input file is ASCII. - * - * @author Alan Green - * @author Jeremy Rayner */ - class Unicode1 extends GroovyTestCase { //TODO: find some way to assert that Unicode3.0 + is available @@ -35,7 +32,7 @@ class Unicode1 extends GroovyTestCase { * This doc comment checks that Unicode is allowed in javadoc. * e.g. \u05D0\u2136\u05d3\u05d7 */ -public void testComments() { +void testComments() { // Unicode is allowed in comments // This is a comment \u0410\u0406\u0414\u0419 /* Another comment \u05D0\u2136\u05d3\u05d7 */ @@ -44,12 +41,12 @@ class Unicode1 extends GroovyTestCase { /***/ // Also valid } -public void testStringLiterals() { +void testStringLiterals() { assert 1 == "\u0040".length() assert "A" == "\u0041" } -public void testCharNotAvailableAsLiteral() { +void testCharNotAvailableAsLiteral() { char a = 'x' char b = "x" def c = "x".charAt(0) http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode2.groovy -- diff --git a/src/tck/test/gls/ch03/s01/Unicode2.groovy b/src/tck/test/gls/ch03/s01/Unicode2.groovy index be60ff6..35fbf72 100644 --- a/src/tck/test/gls/ch03/s01/Unicode2.groovy +++ b/src/tck/test/gls/ch03/s01/Unicode2.groovy @@ -17,24 +17,20 @@ * under the License. */ package gls.ch03.s01; + /** * Except for comments, identifiers and the contents of ... string * literals, all input elements are formed from ASCII characters. - * - * TODO: Find a better way to test these things - * Note that this is a little hard to test since the input file is ASCII. - * - * @author Jeremy Rayner */ - class Unicode2 extends GroovyTestCase { -//todo - this doesn't seem to work in raw Java5.0 either -//public void testUTF16SupplementaryCharacters() { -//assert 1 == "\uD840\uDC00".length() -//} +void testUTF16SupplementaryCharacters() { +def s = "\uD840\uDC00" +assert 2 == s.length() // number of Unicode code units +assert 1 == s.codePointCount(0, s.length()) // number of Unicode code points +} -public void testIdentifiers() { +void testIdentifiers() { def foo\u0044 = 12 assert 20 == foo\u0044 + 8 } http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s02/LexicalTranslation1.groovy ---
[16/50] [abbrv] 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/2faa31ba Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2faa31ba Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2faa31ba Branch: refs/heads/parrot Commit: 2faa31baf0ba7c4afb947b152ee0830d0a60b34f Parents: 597a8d5 Author: paulk Authored: Mon Oct 10 15:48:02 2016 +1000 Committer: paulk Committed: Mon Oct 10 15:48:02 2016 +1000 -- .../groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy | 8 1 file changed, 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/2faa31ba/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy -- diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy index 0f67c6c..22a59de 100644 --- a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy +++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy @@ -16,14 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - - - - - - - - package org.codehaus.groovy.classgen.asm.sc.bugs import groovy.transform.stc.StaticTypeCheckingTestCase
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X 6fd5c31df -> 4eadbde40 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/4eadbde4 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/4eadbde4 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/4eadbde4 Branch: refs/heads/GROOVY_2_4_X Commit: 4eadbde40c6d284c4054ca75bb3d1b8483b282fc Parents: 6fd5c31 Author: paulk Authored: Mon Oct 10 15:48:02 2016 +1000 Committer: paulk Committed: Mon Oct 10 15:51:02 2016 +1000 -- .../groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy | 8 1 file changed, 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/4eadbde4/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy -- diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy index 0f67c6c..22a59de 100644 --- a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy +++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy @@ -16,14 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - - - - - - - - package org.codehaus.groovy.classgen.asm.sc.bugs import groovy.transform.stc.StaticTypeCheckingTestCase
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/master 597a8d563 -> 2faa31baf formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2faa31ba Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2faa31ba Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2faa31ba Branch: refs/heads/master Commit: 2faa31baf0ba7c4afb947b152ee0830d0a60b34f Parents: 597a8d5 Author: paulk Authored: Mon Oct 10 15:48:02 2016 +1000 Committer: paulk Committed: Mon Oct 10 15:48:02 2016 +1000 -- .../groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy | 8 1 file changed, 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/2faa31ba/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy -- diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy index 0f67c6c..22a59de 100644 --- a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy +++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy @@ -16,14 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - - - - - - - - package org.codehaus.groovy.classgen.asm.sc.bugs import groovy.transform.stc.StaticTypeCheckingTestCase
groovy git commit: formatting and general tidy up of some tests
Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X 13d1abe80 -> 331a2c524 formatting and general tidy up of some tests Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/331a2c52 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/331a2c52 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/331a2c52 Branch: refs/heads/GROOVY_2_4_X Commit: 331a2c52479b44ffd931e0f4d623bf1327324f14 Parents: 13d1abe Author: paulk Authored: Tue Oct 4 10:59:04 2016 +1000 Committer: paulk Committed: Tue Oct 4 11:01:55 2016 +1000 -- gradle/pomconfigurer.gradle | 12 + src/tck/test/gls/ch03/s01/Unicode1.groovy | 11 +++- src/tck/test/gls/ch03/s01/Unicode2.groovy | 18 + .../gls/ch03/s02/LexicalTranslation1.groovy | 4 +-- src/tck/test/gls/ch03/s02/Longest1.groovy | 2 -- .../test/gls/ch03/s03/UnicodeEscapes1.groovy| 5 +--- .../test/gls/ch03/s03/UnicodeEscapes2.groovy| 27 ++-- 7 files changed, 39 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/331a2c52/gradle/pomconfigurer.gradle -- diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle index c105f15..2877e8a 100644 --- a/gradle/pomconfigurer.gradle +++ b/gradle/pomconfigurer.gradle @@ -567,6 +567,18 @@ project.ext.pomConfigureClosureWithoutTweaks = { contributor { name 'Marcin Grzejszczak' } +contributor { +name 'Pap LÅrinc' +} +contributor { +name 'Guillaume Balaine' +} +contributor { +name 'Santhosh Kumar T' +} +contributor { +name 'Alan Green' +} } mailingLists { mailingList { http://git-wip-us.apache.org/repos/asf/groovy/blob/331a2c52/src/tck/test/gls/ch03/s01/Unicode1.groovy -- diff --git a/src/tck/test/gls/ch03/s01/Unicode1.groovy b/src/tck/test/gls/ch03/s01/Unicode1.groovy index 45ab780..92984ab 100644 --- a/src/tck/test/gls/ch03/s01/Unicode1.groovy +++ b/src/tck/test/gls/ch03/s01/Unicode1.groovy @@ -17,17 +17,14 @@ * under the License. */ package gls.ch03.s01; + /** * Except for comments, identifiers and the contents of ... string * literals, all input elements are formed from ASCII characters. * * TODO: Find a better way to test these things * Note that this is a little hard to test since the input file is ASCII. - * - * @author Alan Green - * @author Jeremy Rayner */ - class Unicode1 extends GroovyTestCase { //TODO: find some way to assert that Unicode3.0 + is available @@ -35,7 +32,7 @@ class Unicode1 extends GroovyTestCase { * This doc comment checks that Unicode is allowed in javadoc. * e.g. \u05D0\u2136\u05d3\u05d7 */ -public void testComments() { +void testComments() { // Unicode is allowed in comments // This is a comment \u0410\u0406\u0414\u0419 /* Another comment \u05D0\u2136\u05d3\u05d7 */ @@ -44,12 +41,12 @@ class Unicode1 extends GroovyTestCase { /***/ // Also valid } -public void testStringLiterals() { +void testStringLiterals() { assert 1 == "\u0040".length() assert "A" == "\u0041" } -public void testCharNotAvailableAsLiteral() { +void testCharNotAvailableAsLiteral() { char a = 'x' char b = "x" def c = "x".charAt(0) http://git-wip-us.apache.org/repos/asf/groovy/blob/331a2c52/src/tck/test/gls/ch03/s01/Unicode2.groovy -- diff --git a/src/tck/test/gls/ch03/s01/Unicode2.groovy b/src/tck/test/gls/ch03/s01/Unicode2.groovy index be60ff6..35fbf72 100644 --- a/src/tck/test/gls/ch03/s01/Unicode2.groovy +++ b/src/tck/test/gls/ch03/s01/Unicode2.groovy @@ -17,24 +17,20 @@ * under the License. */ package gls.ch03.s01; + /** * Except for comments, identifiers and the contents of ... string * literals, all input elements are formed from ASCII characters. - * - * TODO: Find a better way to test these things - * Note that this is a little hard to test since the input file is ASCII. - * - * @author Jeremy Rayner */ - class Unicode2 extends GroovyTestCase { -//todo - this doesn't seem to work in raw Java5.0 either -//public void testUTF16SupplementaryCharacters() { -//assert 1 == "\uD840\uDC00".length() -//} +void testUTF16SupplementaryCharacters() { +def s = "\uD840\uDC00" +assert 2 == s.length() // number of Unicode code units +assert 1 =
groovy git commit: formatting and general tidy up of some tests
Repository: groovy Updated Branches: refs/heads/master 55c186f42 -> 94137c913 formatting and general tidy up of some tests Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/94137c91 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/94137c91 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/94137c91 Branch: refs/heads/master Commit: 94137c91379b8152afe7e76e59c6537dc5a12ef3 Parents: 55c186f Author: paulk Authored: Tue Oct 4 10:59:04 2016 +1000 Committer: paulk Committed: Tue Oct 4 10:59:32 2016 +1000 -- gradle/pomconfigurer.gradle | 3 +++ src/tck/test/gls/ch03/s01/Unicode1.groovy | 11 +++- src/tck/test/gls/ch03/s01/Unicode2.groovy | 18 + .../gls/ch03/s02/LexicalTranslation1.groovy | 4 +-- src/tck/test/gls/ch03/s02/Longest1.groovy | 2 -- .../test/gls/ch03/s03/UnicodeEscapes1.groovy| 5 +--- .../test/gls/ch03/s03/UnicodeEscapes2.groovy| 27 ++-- 7 files changed, 30 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/gradle/pomconfigurer.gradle -- diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle index 3f08f4a..2877e8a 100644 --- a/gradle/pomconfigurer.gradle +++ b/gradle/pomconfigurer.gradle @@ -576,6 +576,9 @@ project.ext.pomConfigureClosureWithoutTweaks = { contributor { name 'Santhosh Kumar T' } +contributor { +name 'Alan Green' +} } mailingLists { mailingList { http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode1.groovy -- diff --git a/src/tck/test/gls/ch03/s01/Unicode1.groovy b/src/tck/test/gls/ch03/s01/Unicode1.groovy index 45ab780..92984ab 100644 --- a/src/tck/test/gls/ch03/s01/Unicode1.groovy +++ b/src/tck/test/gls/ch03/s01/Unicode1.groovy @@ -17,17 +17,14 @@ * under the License. */ package gls.ch03.s01; + /** * Except for comments, identifiers and the contents of ... string * literals, all input elements are formed from ASCII characters. * * TODO: Find a better way to test these things * Note that this is a little hard to test since the input file is ASCII. - * - * @author Alan Green - * @author Jeremy Rayner */ - class Unicode1 extends GroovyTestCase { //TODO: find some way to assert that Unicode3.0 + is available @@ -35,7 +32,7 @@ class Unicode1 extends GroovyTestCase { * This doc comment checks that Unicode is allowed in javadoc. * e.g. \u05D0\u2136\u05d3\u05d7 */ -public void testComments() { +void testComments() { // Unicode is allowed in comments // This is a comment \u0410\u0406\u0414\u0419 /* Another comment \u05D0\u2136\u05d3\u05d7 */ @@ -44,12 +41,12 @@ class Unicode1 extends GroovyTestCase { /***/ // Also valid } -public void testStringLiterals() { +void testStringLiterals() { assert 1 == "\u0040".length() assert "A" == "\u0041" } -public void testCharNotAvailableAsLiteral() { +void testCharNotAvailableAsLiteral() { char a = 'x' char b = "x" def c = "x".charAt(0) http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode2.groovy -- diff --git a/src/tck/test/gls/ch03/s01/Unicode2.groovy b/src/tck/test/gls/ch03/s01/Unicode2.groovy index be60ff6..35fbf72 100644 --- a/src/tck/test/gls/ch03/s01/Unicode2.groovy +++ b/src/tck/test/gls/ch03/s01/Unicode2.groovy @@ -17,24 +17,20 @@ * under the License. */ package gls.ch03.s01; + /** * Except for comments, identifiers and the contents of ... string * literals, all input elements are formed from ASCII characters. - * - * TODO: Find a better way to test these things - * Note that this is a little hard to test since the input file is ASCII. - * - * @author Jeremy Rayner */ - class Unicode2 extends GroovyTestCase { -//todo - this doesn't seem to work in raw Java5.0 either -//public void testUTF16SupplementaryCharacters() { -//assert 1 == "\uD840\uDC00".length() -//} +void testUTF16SupplementaryCharacters() { +def s = "\uD840\uDC00" +assert 2 == s.length() // number of Unicode code units +assert 1 == s.codePointCount(0, s.length()) // number of Unicode code points +} -public void testIdentifiers() { +void testIdentifiers() { def foo\u0044 = 12 assert 20 == foo\u0044 + 8 } http://git-wip-us.apache.org/repos/asf/groovy/blob
[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/5b06149b Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5b06149b Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5b06149b Branch: refs/heads/master Commit: 5b06149b93585545e391acb68920fea2341619b0 Parents: 2da308c Author: John Wagenleitner Authored: Sun Sep 18 10:56:55 2016 -0700 Committer: John Wagenleitner Committed: Mon Sep 19 20:22:48 2016 -0700 -- .../stc/StaticTypeCheckingSupport.java | 22 ++-- src/test/groovy/bugs/Groovy7922Bug.groovy | 19 + 2 files changed, 30 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/5b06149b/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 10f5e01..e2d5d29 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 removeCovariantsAndInterfaceEquivalents(Collection collection) { -if (collection.size()<=1) return collection; +if (collection.size() <= 1) return collection; List toBeRemoved = new LinkedList(); List list = new LinkedList(new HashSet(collection)); -for (int i=0;i 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/5b06149b/src/test/groovy/bugs/Groovy7922Bug.groovy -- diff --git a/src/test/groovy/bugs/Groovy7922Bug.groovy b/src/test/groovy/bugs/Groovy7922Bug.groovy index c71d774..57ee8de 100644 --- a/src/test/groovy/bugs/Groovy7922Bug.groovy +++ b/src/test/groovy/bugs/Groovy7922Bug.groovy @@ -1,3 +1,22 @@ +/* + * 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;
[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 Authored: Sun Sep 18 10:56:55 2016 -0700 Committer: John Wagenleitner 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 removeCovariantsAndInterfaceEquivalents(Collection collection) { -if (collection.size()<=1) return collection; +if (collection.size() <= 1) return collection; List toBeRemoved = new LinkedList(); List list = new LinkedList(new HashSet(collection)); -for (int i=0;i 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;
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/master 8b11b22f1 -> 679eb23ce formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/679eb23c Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/679eb23c Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/679eb23c Branch: refs/heads/master Commit: 679eb23cea2858dec2ea2e24e5a896ef2350797a Parents: 8b11b22 Author: paulk Authored: Mon Jul 25 19:29:33 2016 +1000 Committer: paulk Committed: Mon Jul 25 19:29:33 2016 +1000 -- .../groovy/runtime/typehandling/NumberMath.java | 103 ++- src/test/groovy/NumberMathTest.groovy | 20 ++-- 2 files changed, 62 insertions(+), 61 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/679eb23c/src/main/org/codehaus/groovy/runtime/typehandling/NumberMath.java -- diff --git a/src/main/org/codehaus/groovy/runtime/typehandling/NumberMath.java b/src/main/org/codehaus/groovy/runtime/typehandling/NumberMath.java index 0ef83a0..c953ffd 100644 --- a/src/main/org/codehaus/groovy/runtime/typehandling/NumberMath.java +++ b/src/main/org/codehaus/groovy/runtime/typehandling/NumberMath.java @@ -21,75 +21,71 @@ package org.codehaus.groovy.runtime.typehandling; import java.math.BigDecimal; import java.math.BigInteger; - /** * Stateless objects used to perform math on the various Number subclasses. * Instances are required so that polymorphic calls work properly, but each * subclass creates a singleton instance to minimize garbage. All methods * must be thread-safe. - * + * * The design goals of this class are as follows: * * Support a 'least surprising' math model to scripting language users. This * means that exact, or decimal math should be used for default calculations. This * scheme assumes that by default, groovy literals with decimal points are instantiated - * as BigDecimal objects rather than binary floating points (Float, Double). - * Do not force the appearance of exactness on a number that is by definition not - * guaranteed to be exact. In particular this means that if an operand in a NumberMath - * operation is a binary floating point number, ensure that the result remains a binary floating point - * number (i.e. never automatically promote a binary floating point number to a BigDecimal). + * as BigDecimal objects rather than binary floating points (Float, Double). + * Do not force the appearance of exactness on a number that is by definition not + * guaranteed to be exact. In particular this means that if an operand in a NumberMath + * operation is a binary floating point number, ensure that the result remains a binary floating point + * number (i.e. never automatically promote a binary floating point number to a BigDecimal). * This has the effect of preserving the expectations of binary floating point users and helps performance. - * Provide an implementation that is as close as practical to the Java 1.5 BigDecimal math model - * which implements precision based floating point decimal math (ANSI X3.274-1996 and - * ANSI X3.274-1996/AM 1-2000 (section 7.4). + * Provide an implementation that is as close as practical to the Java 1.5 BigDecimal math model which implements + * precision based floating point decimal math (ANSI X3.274-1996 and ANSI X3.274-1996/AM 1-2000 (section 7.4). * - * - * @author Steve Goetze */ public abstract class NumberMath { - + public static Number abs(Number number) { return getMath(number).absImpl(number); } - + public static Number add(Number left, Number right) { -return getMath(left, right).addImpl(left,right); +return getMath(left, right).addImpl(left, right); } - + public static Number subtract(Number left, Number right) { -return getMath(left,right).subtractImpl(left,right); +return getMath(left, right).subtractImpl(left, right); } - + public static Number multiply(Number left, Number right) { -return getMath(left,right).multiplyImpl(left,right); +return getMath(left, right).multiplyImpl(left, right); } - + public static Number divide(Number left, Number right) { -return getMath(left,right).divideImpl(left,right); - } - +return getMath(left, right).divideImpl(left, right); +} + public static int compareTo(Number left, Number right) { -return getMath(left,right).compareToImpl(left, right); +return getMath(left, right).compareToImpl(left, right); } - + public static Number or(Number left, Number right) { -return getMath(left,right).orImpl(left, right); +return getMath(left, right).orImpl(left, r
groovy git commit: formatting
Repository: groovy Updated Branches: refs/heads/master 0d86565c5 -> 6f6735356 formatting Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6f673535 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6f673535 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6f673535 Branch: refs/heads/master Commit: 6f67353565e98c3c8c707f355974ff1296231275 Parents: 0d86565 Author: paulk Authored: Mon Jul 25 18:15:13 2016 +1000 Committer: paulk Committed: Mon Jul 25 18:15:13 2016 +1000 -- .../typehandling/DefaultTypeTransformation.java | 167 +-- 1 file changed, 80 insertions(+), 87 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/6f673535/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java -- diff --git a/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java b/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java index 94e0084..e55b574 100644 --- a/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java +++ b/src/main/org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.java @@ -24,7 +24,14 @@ import groovy.lang.GroovyRuntimeException; import org.codehaus.groovy.reflection.ReflectionCache; import org.codehaus.groovy.reflection.stdclasses.CachedSAMClass; -import org.codehaus.groovy.runtime.*; +import org.codehaus.groovy.runtime.DefaultGroovyMethods; +import org.codehaus.groovy.runtime.InvokerHelper; +import org.codehaus.groovy.runtime.InvokerInvocationException; +import org.codehaus.groovy.runtime.IteratorClosureAdapter; +import org.codehaus.groovy.runtime.MethodClosure; +import org.codehaus.groovy.runtime.NullObject; +import org.codehaus.groovy.runtime.ResourceGroovyMethods; +import org.codehaus.groovy.runtime.StringGroovyMethods; import java.io.File; import java.io.IOException; @@ -34,12 +41,17 @@ import java.lang.reflect.Modifier; import java.math.BigDecimal; import java.math.BigInteger; import java.text.MessageFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; /** * Class providing various type conversions, coercions and boxing/unboxing operations. - * - * @author Guillaume Laforge */ public class DefaultTypeTransformation { @@ -50,7 +62,7 @@ public class DefaultTypeTransformation { // // unboxing methods // - + public static byte byteUnbox(Object value) { Number n = castToNumber(value, byte.class); return n.byteValue(); @@ -87,7 +99,7 @@ public class DefaultTypeTransformation { public static double doubleUnbox(Object value) { Number n = castToNumber(value, double.class); return n.doubleValue(); -} +} // // boxing methods @@ -132,12 +144,12 @@ public class DefaultTypeTransformation { public static Object box(double value) { return Double.valueOf(value); } - + public static Number castToNumber(Object object) { // default to Number class in exception details, else use the specified Number subtype. return castToNumber(object, Number.class); } - + public static Number castToNumber(Object object, Class type) { if (object instanceof Number) return (Number) object; @@ -165,7 +177,7 @@ public class DefaultTypeTransformation { /** * Method used for coercing an object to a boolean value, - * thanks to an asBoolean() method added on types. + * thanks to an asBoolean() method added on types. * * @param object to coerce to a boolean value * @return a boolean value @@ -175,16 +187,16 @@ public class DefaultTypeTransformation { if (object == null) { return false; } - + // equality check is enough and faster than instanceof check, no need to check superclasses since Boolean is final -if (object.getClass() == Boolean.class) { -return ((Boolean)object).booleanValue(); +if (object.getClass() == Boolean.class) { +return ((Boolean) object).booleanValue(); } - + // if the object is not null and no Boolean, try to call an asBoolean() method on the object -return (Boolean)InvokerHelper.invokeMethod(object, "asBoolean", InvokerHel
groovy git commit: formatting only
Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X 0a8655263 -> 043999e09 formatting only Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/043999e0 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/043999e0 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/043999e0 Branch: refs/heads/GROOVY_2_4_X Commit: 043999e098d1e58e2f40d7749e064578c7765cfd Parents: 0a86552 Author: paulk Authored: Thu Apr 21 14:46:57 2016 +1000 Committer: paulk Committed: Thu Apr 21 14:48:35 2016 +1000 -- .../groovy/reflection/CachedMethod.java | 62 ++-- 1 file changed, 30 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/043999e0/src/main/org/codehaus/groovy/reflection/CachedMethod.java -- diff --git a/src/main/org/codehaus/groovy/reflection/CachedMethod.java b/src/main/org/codehaus/groovy/reflection/CachedMethod.java index 3ef4744..cff72f2 100644 --- a/src/main/org/codehaus/groovy/reflection/CachedMethod.java +++ b/src/main/org/codehaus/groovy/reflection/CachedMethod.java @@ -142,59 +142,57 @@ public class CachedMethod extends MetaMethod implements Comparable { return compareToMethod((Method)o); } -private int compareToCachedMethod(CachedMethod m) { -if (m == null) - return -1; +private int compareToCachedMethod(CachedMethod other) { +if (other == null) +return -1; -final int strComp = getName().compareTo(m.getName()); +final int strComp = getName().compareTo(other.getName()); if (strComp != 0) - return strComp; +return strComp; -final int retComp = getReturnType().getName().compareTo(m.getReturnType().getName()); +final int retComp = getReturnType().getName().compareTo(other.getReturnType().getName()); if (retComp != 0) - return retComp; +return retComp; -CachedClass[] params = getParameterTypes(); -CachedClass [] mparams = m.getParameterTypes(); +CachedClass[] params = getParameterTypes(); +CachedClass[] otherParams = other.getParameterTypes(); -final int pd = params.length - mparams.length; +final int pd = params.length - otherParams.length; if (pd != 0) - return pd; +return pd; -for (int i = 0; i != params.length; ++i) -{ -final int nameComp = params[i].getName().compareTo(mparams[i].getName()); +for (int i = 0; i != params.length; ++i) { +final int nameComp = params[i].getName().compareTo(otherParams[i].getName()); if (nameComp != 0) - return nameComp; +return nameComp; } throw new RuntimeException("Should never happen"); } -private int compareToMethod(Method m) { -if (m == null) - return -1; +private int compareToMethod(Method other) { +if (other == null) +return -1; -final int strComp = getName().compareTo(m.getName()); +final int strComp = getName().compareTo(other.getName()); if (strComp != 0) - return strComp; +return strComp; -final int retComp = getReturnType().getName().compareTo(m.getReturnType().getName()); +final int retComp = getReturnType().getName().compareTo(other.getReturnType().getName()); if (retComp != 0) - return retComp; +return retComp; -CachedClass[] params = getParameterTypes(); -Class [] mparams = m.getParameterTypes(); +CachedClass[] params = getParameterTypes(); +Class[] mparams = other.getParameterTypes(); final int pd = params.length - mparams.length; if (pd != 0) - return pd; +return pd; -for (int i = 0; i != params.length; ++i) -{ +for (int i = 0; i != params.length; ++i) { final int nameComp = params[i].getName().compareTo(mparams[i].getName()); if (nameComp != 0) - return nameComp; +return nameComp; } return 0; @@ -218,14 +216,14 @@ public class CachedMethod extends MetaMethod implements Comparable { return cachedMethod.toString(); } -private Constructor getConstrcutor(SoftReference ref) { +private Constructor getConstructor(SoftReference ref) { if (ref==null) return null; return ref.get(); } public CallSite createPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class[] params) { if (!skipCompiled) { -Constructor constr = getConstrcutor(pogoCallSiteConstructor); +
groovy git commit: formatting only
Repository: groovy Updated Branches: refs/heads/master fc19d5160 -> c77180d87 formatting only Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/c77180d8 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c77180d8 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c77180d8 Branch: refs/heads/master Commit: c77180d87fcb81eaa3e44eebec4be2ced57cd790 Parents: fc19d51 Author: paulk Authored: Thu Apr 21 14:46:57 2016 +1000 Committer: paulk Committed: Thu Apr 21 14:47:30 2016 +1000 -- .../groovy/reflection/CachedMethod.java | 62 ++-- 1 file changed, 30 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/groovy/blob/c77180d8/src/main/org/codehaus/groovy/reflection/CachedMethod.java -- diff --git a/src/main/org/codehaus/groovy/reflection/CachedMethod.java b/src/main/org/codehaus/groovy/reflection/CachedMethod.java index 3ef4744..cff72f2 100644 --- a/src/main/org/codehaus/groovy/reflection/CachedMethod.java +++ b/src/main/org/codehaus/groovy/reflection/CachedMethod.java @@ -142,59 +142,57 @@ public class CachedMethod extends MetaMethod implements Comparable { return compareToMethod((Method)o); } -private int compareToCachedMethod(CachedMethod m) { -if (m == null) - return -1; +private int compareToCachedMethod(CachedMethod other) { +if (other == null) +return -1; -final int strComp = getName().compareTo(m.getName()); +final int strComp = getName().compareTo(other.getName()); if (strComp != 0) - return strComp; +return strComp; -final int retComp = getReturnType().getName().compareTo(m.getReturnType().getName()); +final int retComp = getReturnType().getName().compareTo(other.getReturnType().getName()); if (retComp != 0) - return retComp; +return retComp; -CachedClass[] params = getParameterTypes(); -CachedClass [] mparams = m.getParameterTypes(); +CachedClass[] params = getParameterTypes(); +CachedClass[] otherParams = other.getParameterTypes(); -final int pd = params.length - mparams.length; +final int pd = params.length - otherParams.length; if (pd != 0) - return pd; +return pd; -for (int i = 0; i != params.length; ++i) -{ -final int nameComp = params[i].getName().compareTo(mparams[i].getName()); +for (int i = 0; i != params.length; ++i) { +final int nameComp = params[i].getName().compareTo(otherParams[i].getName()); if (nameComp != 0) - return nameComp; +return nameComp; } throw new RuntimeException("Should never happen"); } -private int compareToMethod(Method m) { -if (m == null) - return -1; +private int compareToMethod(Method other) { +if (other == null) +return -1; -final int strComp = getName().compareTo(m.getName()); +final int strComp = getName().compareTo(other.getName()); if (strComp != 0) - return strComp; +return strComp; -final int retComp = getReturnType().getName().compareTo(m.getReturnType().getName()); +final int retComp = getReturnType().getName().compareTo(other.getReturnType().getName()); if (retComp != 0) - return retComp; +return retComp; -CachedClass[] params = getParameterTypes(); -Class [] mparams = m.getParameterTypes(); +CachedClass[] params = getParameterTypes(); +Class[] mparams = other.getParameterTypes(); final int pd = params.length - mparams.length; if (pd != 0) - return pd; +return pd; -for (int i = 0; i != params.length; ++i) -{ +for (int i = 0; i != params.length; ++i) { final int nameComp = params[i].getName().compareTo(mparams[i].getName()); if (nameComp != 0) - return nameComp; +return nameComp; } return 0; @@ -218,14 +216,14 @@ public class CachedMethod extends MetaMethod implements Comparable { return cachedMethod.toString(); } -private Constructor getConstrcutor(SoftReference ref) { +private Constructor getConstructor(SoftReference ref) { if (ref==null) return null; return ref.get(); } public CallSite createPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class[] params) { if (!skipCompiled) { -Constructor constr = getConstrcutor(pogoCallSiteConstructor); +Con