(groovy) branch master updated: update dependency metadata
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new e6b9133726 update dependency metadata e6b9133726 is described below commit e6b9133726af9cdea2bc6db7b55523cd88f7190e Author: Paul King AuthorDate: Wed Jun 19 11:56:00 2024 +1000 update dependency metadata --- gradle/verification-metadata.xml | 139 --- 1 file changed, 56 insertions(+), 83 deletions(-) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 68856788fd..c344e0ade0 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -184,49 +184,60 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + + + @@ -239,28 +250,11 @@ - - - - - - - - - - - - - - - - - @@ -268,14 +262,10 @@ + - - - - - @@ -310,6 +300,7 @@ + @@ -324,16 +315,16 @@ - - + + - + - - + + - + @@ -402,11 +393,6 @@ - - - - - @@ -442,12 +428,6 @@ - - - - - - @@ -531,15 +511,10 @@ - - - - - - + @@ -638,11 +613,6 @@ - - - - - @@ -780,6 +750,7 @@ + @@ -820,6 +791,7 @@ + @@ -840,6 +812,7 @@ + @@ -924,19 +897,19 @@ - - - + + + - - - + + + - - - + + +
(groovy) branch master updated: trivial refactor: remove findbugs warning
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new 8716fa1caa trivial refactor: remove findbugs warning 8716fa1caa is described below commit 8716fa1caabb877dfa9bafc8fc27f805e56ad468 Author: Paul King AuthorDate: Wed Jun 19 11:09:37 2024 +1000 trivial refactor: remove findbugs warning --- src/main/java/groovy/lang/GroovyClassLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/groovy/lang/GroovyClassLoader.java b/src/main/java/groovy/lang/GroovyClassLoader.java index 6e67bffeaa..5a081c1775 100644 --- a/src/main/java/groovy/lang/GroovyClassLoader.java +++ b/src/main/java/groovy/lang/GroovyClassLoader.java @@ -98,7 +98,7 @@ public class GroovyClassLoader extends URLClassLoader { protected final StampedCommonCache sourceCache = new StampedCommonCache<>(); private final CompilerConfiguration config; -private String sourceEncoding; +private final String sourceEncoding; private Boolean recompile; /**
(groovy) branch master updated: GROOVY-11403: STC: map property precedence: entry before super field
This is an automated email from the ASF dual-hosted git repository. emilles pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new 93f0d096c5 GROOVY-11403: STC: map property precedence: entry before super field 93f0d096c5 is described below commit 93f0d096c5c23256add266ff8f0f7d6a953a65ee Author: Eric Milles AuthorDate: Tue Jun 18 14:58:33 2024 -0500 GROOVY-11403: STC: map property precedence: entry before super field --- .../classgen/asm/sc/StaticTypesCallSiteWriter.java | 10 ++-- .../transform/stc/StaticTypeCheckingVisitor.java | 2 +- src/test/groovy/bugs/Groovy9007.groovy | 12 +++-- .../stc/FieldsAndPropertiesSTCTest.groovy | 58 -- 4 files changed, 66 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java index 874723724b..51b7f7d358 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java @@ -53,7 +53,6 @@ import org.objectweb.asm.MethodVisitor; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.function.BiPredicate; import java.util.function.Predicate; @@ -190,7 +189,7 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter { // GROOVY-5001, GROOVY-5491, GROOVY-5517, GROOVY-6144, GROOVY-8788: for map types, // replace "map.foo" with "map.get('foo')" -- if no public field "foo" is declared if (!isStaticProperty && isOrImplements(receiverType, MAP_TYPE) -&& Optional.ofNullable(getField(receiverType, propertyName)).filter(FieldNode::isPublic).isEmpty()) { +&& getField(receiverType, propertyName, FieldNode::isPublic) == null) { writeMapDotProperty(receiver, propertyName, safe); return; } @@ -416,8 +415,9 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter { // GROOVY-5001, GROOVY-5491, GROOVY-5517, GROOVY-6144, GROOVY-8788: for map types, // replace "map.foo" with "map.get('foo')" -- if no public field "foo" is declared if (isMapDotProperty -&& (!isThisExpression(receiver) || controller.isInGeneratedFunction()) // GROOVY-8978, GROOVY-11402 -&& Optional.ofNullable(getField(receiverType, propertyName)).filter(FieldNode::isPublic).isEmpty()) { +&& getField(receiverType, propertyName, FieldNode::isPublic) == null +// GROOVY-11367, GROOVY-11402, GROOVY-11403: "this.name" outside closure includes non-public fields of lexical scope +&& (!isThisExpression(receiver) || controller.isInGeneratedFunction() || receiverType.getDeclaredField(propertyName) == null)) { writeMapDotProperty(receiver, propertyName, safe); return; } @@ -800,7 +800,7 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter { // GROOVY-6954, GROOVY-11376: for map types, replace "map.foo = ..." // with "map.put('foo', ...)" if no public field exists if (!isClassReceiver[0] && isOrImplements(receiverType, MAP_TYPE) -&& Optional.ofNullable(getField(receiverType, name)).filter(FieldNode::isPublic).isEmpty()) { +&& getField(receiverType, name, FieldNode::isPublic) == null) { MethodVisitor mv = controller.getMethodVisitor(); // store value in temporary variable 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 f3195562bb..1990049d73 100644 --- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -1658,7 +1658,7 @@ out:if ((samParameterTypes.length == 1 && isOrImplements(samParameterTypes[0 if (field != null && publicOnly && !field.isPublic() // GROOVY-11367, GROOVY-11402, GROOVY-11403: -&& !(isThisExpression(objectExpression) && typeCheckingContext.getEnclosingClosure() == null)) { +&& (!receiverType.equals(current) || !isThisExpression(objectExpression) || typeCheckingContext.getEnclosingClosure() != null)) { field = null; } // skip property/accessor checks for "field", "this.field", "this.with { field }", etc. within the declaring class of the field diff --git a/src/test/groovy/bugs/Groovy9007.groovy
(groovy) branch master updated: GROOVY-11403: STC: map property precedence: entry before method (`this`)
This is an automated email from the ASF dual-hosted git repository. emilles pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new e94a196062 GROOVY-11403: STC: map property precedence: entry before method (`this`) e94a196062 is described below commit e94a1960626147df8a107ad03bf92be7e39da0d9 Author: Eric Milles AuthorDate: Tue Jun 18 11:02:40 2024 -0500 GROOVY-11403: STC: map property precedence: entry before method (`this`) --- ...icTypesBinaryExpressionMultiTypeDispatcher.java | 24 ++-- .../stc/FieldsAndPropertiesSTCTest.groovy | 151 +++-- 2 files changed, 153 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java index 7551d333b1..0a3d79666f 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java @@ -252,15 +252,15 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres } private boolean makeSetProperty(final Expression receiver, final Expression message, final Expression arguments, final boolean safe, final boolean spreadSafe, final boolean implicitThis, final boolean isAttribute) { -ClassNode receiverType = controller.getTypeChooser().resolveType(receiver, controller.getClassNode()); -boolean isThisReceiver = isThisExpression(receiver); -String property = message.getText(); +var receiverType = controller.getTypeChooser().resolveType(receiver, controller.getClassNode()); +var thisReceiver = isThisExpression(receiver); +var propertyName = message.getText(); -if (isAttribute || (isThisReceiver && receiverType.getDeclaredField(property) != null)) { +if (isAttribute || (thisReceiver && receiverType.getDeclaredField(propertyName) != null)) { ClassNode current = receiverType; FieldNode fn = null; while (fn == null && current != null) { -fn = current.getDeclaredField(property); +fn = current.getDeclaredField(propertyName); if (fn == null) { current = current.getSuperClass(); } @@ -282,7 +282,7 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres MethodVisitor mv = controller.getMethodVisitor(); mv.visitFieldInsn(fn.isStatic() ? PUTSTATIC : PUTFIELD, BytecodeHelper.getClassInternalName(fn.getOwner()), -property, +propertyName, BytecodeHelper.getTypeDescription(fn.getOriginType())); operandStack.remove(fn.isStatic() ? 1 : 2); return true; @@ -290,11 +290,11 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres } if (!isAttribute) { -String setterName = getSetterName(property); +String setterName = getSetterName(propertyName); MethodNode setterMethod = receiverType.getSetterMethod(setterName, false); if (setterMethod != null) { -if (isThisReceiver ? setterMethod.getDeclaringClass().equals(controller.getClassNode()) -: (!setterMethod.isPublic() && isOrImplements(receiverType, ClassHelper.MAP_TYPE))) { +if ((thisReceiver && setterMethod.getDeclaringClass().equals(controller.getClassNode())) +|| (!setterMethod.isPublic() && isOrImplements(receiverType, ClassHelper.MAP_TYPE))) { // this.x = ... should not use same-class setter // that.x = ... should not use non-public setter for map setterMethod = null; @@ -304,7 +304,7 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres if (setters.size() > 1) setterMethod = null; } } else { -PropertyNode propertyNode = receiverType.getProperty(property); +PropertyNode propertyNode = receiverType.getProperty(propertyName); if (propertyNode != null && !propertyNode.isFinal()) { setterMethod = new MethodNode( setterName, @@ -332,10 +332,10 @@ public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpres call.visit(controller.getAcg()); return true; } -if (isThisReceiver && !controller.isInGeneratedFunction()) { +if (thisReceiver &&