[GitHub] groovy pull request #840: [20181213]Bump dependencies to the latest version
Github user danielsun1106 closed the pull request at: https://github.com/apache/groovy/pull/840 ---
[GitHub] groovy pull request #841: Avoid `gradlew assemble` before running tests on t...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/841 Avoid `gradlew assemble` before running tests on travis-ci You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-travisci-build Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/841.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #841 commit 4c47589609f6ff4cfa7cb3b00f76bb49a638dc20 Author: danielsun1106 Date: 2018-12-12T18:03:12Z Avoid `gradlew assemble` before running tests on travis-ci ---
[GitHub] groovy pull request #840: [20181213]Bump dependencies to the latest version
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/840 [20181213]Bump dependencies to the latest version You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy bump-deps-1 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/840.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #840 commit df72ec7ce3a4f8671bf64d6214415d4ac0439d48 Author: danielsun1106 Date: 2018-12-12T17:09:04Z GROOVY-8921: Bump build-scan gradle plugin to 2.1 commit 78c6e461d5113769f1bdfb277dbd6b624afed5c1 Author: danielsun1106 Date: 2018-12-12T17:12:44Z GROOVY-8922: Bump spotbugs gradle plugin to 1.6.6 and bump spotbugs-annotations to 3.1.9 commit 451a2b2a5011128ca92a9ff6d4cc480e58f7dd0f Author: danielsun1106 Date: 2018-12-12T17:15:50Z GROOVY-8923: Bump gradle-license-report to 1.3 commit 7dd433bb57b625c5de42fd3153e47bb8d3c7ad72 Author: danielsun1106 Date: 2018-12-12T17:17:38Z GROOVY-8924: Bump creadur-rat-gradle to 0.3.1 commit 035eb7914ea3e244610e72bbba65834b6a5c95cc Author: danielsun1106 Date: 2018-12-12T17:45:22Z GROOVY-8925: Bump picocli to 3.8.2 commit a1c9bc0dfe216355e153da479ac7e35e7e6a4951 Author: danielsun1106 Date: 2018-12-12T17:49:24Z GROOVY-8886: Bump asciidoctor-gradle-plugin to 1.5.9.2 ---
[GitHub] groovy pull request #838: GROOVY-8920: Fails to infer parameter and return t...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/838 GROOVY-8920: Fails to infer parameter and return type of SAM on RHS You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-type-inference-assignment Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/838.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #838 commit 9e601ae2ec09bb95b3c1ebe04c0e99c50de620e7 Author: danielsun1106 Date: 2018-12-12T07:56:42Z GROOVY-8920: Fails to infer parameter and return type of SAM on RHS ---
[GitHub] groovy pull request #837: GROOVY-8917: Failed to infer parameter type of som...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/837#discussion_r240468415 --- Diff: src/main/java/org/codehaus/groovy/classgen/asm/util/TypeUtil.java --- @@ -213,4 +220,15 @@ private static String makeRefDescription(String name) { long.class, Long.class, short.class, Short.class ); + +private static final Map PRIMITIVE_CLASSNODE_TO_WRAPPED_CLASSNODE_MAP = Maps.of( +ClassHelper.byte_TYPE, ClassHelper.Byte_TYPE, +ClassHelper.boolean_TYPE, ClassHelper.Boolean_TYPE, +ClassHelper.char_TYPE, ClassHelper.Character_TYPE, +ClassHelper.double_TYPE, ClassHelper.Double_TYPE, +ClassHelper.float_TYPE, ClassHelper.Float_TYPE, +ClassHelper.int_TYPE, ClassHelper.Integer_TYPE, +ClassHelper.long_TYPE, ClassHelper.Long_TYPE, +ClassHelper.short_TYPE, ClassHelper.Short_TYPE +); --- End diff -- @paulk-asert I've refined the PR according to your suggestion ;-) ---
[GitHub] groovy pull request #837: GROOVY-8917: Failed to infer parameter type of som...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/837#discussion_r240451854 --- Diff: src/main/java/org/codehaus/groovy/classgen/asm/util/TypeUtil.java --- @@ -213,4 +220,15 @@ private static String makeRefDescription(String name) { long.class, Long.class, short.class, Short.class ); + +private static final Map PRIMITIVE_CLASSNODE_TO_WRAPPED_CLASSNODE_MAP = Maps.of( +ClassHelper.byte_TYPE, ClassHelper.Byte_TYPE, +ClassHelper.boolean_TYPE, ClassHelper.Boolean_TYPE, +ClassHelper.char_TYPE, ClassHelper.Character_TYPE, +ClassHelper.double_TYPE, ClassHelper.Double_TYPE, +ClassHelper.float_TYPE, ClassHelper.Float_TYPE, +ClassHelper.int_TYPE, ClassHelper.Integer_TYPE, +ClassHelper.long_TYPE, ClassHelper.Long_TYPE, +ClassHelper.short_TYPE, ClassHelper.Short_TYPE +); --- End diff -- Gotcha. I will use the map you suggest instead. ---
[GitHub] groovy pull request #837: GROOVY-8917: Failed to infer parameter type of som...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/837#discussion_r240445739 --- Diff: src/main/java/org/codehaus/groovy/classgen/asm/util/TypeUtil.java --- @@ -213,4 +220,15 @@ private static String makeRefDescription(String name) { long.class, Long.class, short.class, Short.class ); + +private static final Map PRIMITIVE_CLASSNODE_TO_WRAPPED_CLASSNODE_MAP = Maps.of( +ClassHelper.byte_TYPE, ClassHelper.Byte_TYPE, +ClassHelper.boolean_TYPE, ClassHelper.Boolean_TYPE, +ClassHelper.char_TYPE, ClassHelper.Character_TYPE, +ClassHelper.double_TYPE, ClassHelper.Double_TYPE, +ClassHelper.float_TYPE, ClassHelper.Float_TYPE, +ClassHelper.int_TYPE, ClassHelper.Integer_TYPE, +ClassHelper.long_TYPE, ClassHelper.Long_TYPE, +ClassHelper.short_TYPE, ClassHelper.Short_TYPE +); --- End diff -- @paulk-asert As we can see, the existing type mapping is Class to Class, but we need map ClassNode to ClassNode. Though we can convert ClassNode to Class and get the mapping result then convert the result to ClassNode, it is less efficient. https://github.com/apache/groovy/blob/9cea59b95367c1d563e719ebeddcdecb58199750/src/main/java/org/codehaus/groovy/classgen/asm/util/TypeUtil.java#L213 ---
[GitHub] groovy pull request #837: GROOVY-8917: Failed to infer parameter type of som...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/837 GROOVY-8917: Failed to infer parameter type of some SAM, e.g. BinaryO⦠â¦perator You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-type-inference Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/837.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #837 commit 3669f04205265b62e3a3f339aa1b81fbf3003ecb Author: danielsun1106 Date: 2018-12-10T19:06:29Z GROOVY-8917: Failed to infer parameter type of some SAM, e.g. BinaryOperator ---
[GitHub] groovy pull request #836: GROOVY-8915: [Parrot] Make groovydoc configuration...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/836 GROOVY-8915: [Parrot] Make groovydoc configuration flexible You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8915 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/836.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #836 commit ad507fe8dc18ab1e08c47b7e66e35349b1af520a Author: danielsun1106 Date: 2018-12-08T12:39:57Z GROOVY-8915: [Parrot] Make groovydoc configuration flexible ---
[GitHub] groovy pull request #835: GROOVY-8908: Bump gradle to 5.0
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/835#discussion_r238350588 --- Diff: subprojects/parser-antlr4/build.gradle --- @@ -30,9 +30,11 @@ def srcBase = "subprojects/parser-antlr4/src" def srcMain = "$srcBase/main" def srcTest = "$srcBase/test" -final PARSER_PACKAGE_NAME = 'org.apache.groovy.parser.antlr4' generateGrammarSource { +maxHeapSize = '1g' --- End diff -- https://travis-ci.org/danielsun1106/groovy/jobs/460259483 ``` > Task :generateGrammarSource FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':generateGrammarSource'. > Java heap space ``` Groovy's grammar is quite complicated, so more memory will be consumed. As you can see, the `generateGrammarSource` task fails if the heap size is a bit small, e.g. `512m`. Also, you can try to clone apache/groovy and set the heap size to `maxHeapSize = '512m'` then run `gradlew clean generateGrammarSource --no-build-cache` locally, I believe OOM can be reproduced. ---
[GitHub] groovy pull request #835: GROOVY-8908: Bump gradle to 5.0
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/835 GROOVY-8908: Bump gradle to 5.0 You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8908 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/835.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #835 commit e4c993d9c58d0296b3a49ee80b3984a535e2b478 Author: danielsun1106 Date: 2018-12-03T15:31:27Z GROOVY-8908: Bump gradle to 5.0 ---
[GitHub] groovy pull request #691: GROOVY-8561: Support java-like array
Github user danielsun1106 closed the pull request at: https://github.com/apache/groovy/pull/691 ---
[GitHub] groovy pull request #831: GROOVY-8901: Add DGSM `countDistinct[By]`, `sum[By...
Github user danielsun1106 closed the pull request at: https://github.com/apache/groovy/pull/831 ---
[GitHub] groovy pull request #708: GROOVY-6668: Static compiler doesn't coerce GStrin...
Github user danielsun1106 closed the pull request at: https://github.com/apache/groovy/pull/708 ---
[GitHub] groovy pull request #832: GROOVY-8902: Add method `mapAll` to tuples
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/832 GROOVY-8902: Add method `mapAll` to tuples You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy tuple-mapall Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/832.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #832 commit 75c87c77d7346ba7232178d4a269e0e358dd84b5 Author: danielsun1106 Date: 2018-11-24T15:36:00Z GROOVY-8902: Add method `mapAll` to tuples ---
[GitHub] groovy pull request #831: GROOVY-8901: Add DGSM `countDistinct[By]`, `sum[By...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/831 GROOVY-8901: Add DGSM `countDistinct[By]`, `sum[By]`, `avg[By]` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy enhance_collectors2 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/831.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #831 commit 2b85777550e2610cbf9321f0b8e57862a26f854a Author: danielsun1106 Date: 2018-11-23T16:32:53Z GROOVY-8901: Add DGSM `countDistinct[By]`, `sum[By]`, `avg[By]` ---
[GitHub] groovy pull request #829: GROOVY-8900: Make class `Tuple0`, `Tuple1`...`Tupl...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/829 GROOVY-8900: Make class `Tuple0`, `Tuple1`...`Tuple16` final You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8900 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/829.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #829 commit a9004a38c01401e0b92f8ff50003154e6347cf4d Author: danielsun1106 Date: 2018-11-22T16:21:16Z GROOVY-8900: Make class `Tuple0`, `Tuple1`...`Tuple16` final ---
[GitHub] groovy pull request #828: GROOVY-8899: Add DGSM `first` and `last`
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/828 GROOVY-8899: Add DGSM `first` and `last` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy enhance-collectors Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/828.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #828 commit dbeb1881633c4ed43188b2ee9d4bf845fd8a8ff9 Author: danielsun1106 Date: 2018-11-22T16:07:16Z GROOVY-8899: Add DGSM `first` and `last` ---
[GitHub] groovy pull request #826: GROOVY-8894: Improve performance of DGM `leftShift...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/826 GROOVY-8894: Improve performance of DGM `leftShift(OutputStream, Inpu⦠â¦tStream)` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-io-leftshift Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/826.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #826 commit 43abd7b1dddea45240a53d1848c2aaba001809e4 Author: danielsun1106 Date: 2018-11-19T16:46:21Z GROOVY-8894: Improve performance of DGM `leftShift(OutputStream, InputStream)` ---
[GitHub] groovy pull request #825: GROOVY-8890: Make "Inspect Tokens" of groovy conso...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/825 GROOVY-8890: Make "Inspect Tokens" of groovy console support Parrot's⦠⦠tokens You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-console-tokens Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/825.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #825 commit 83ce8a2b87fc6f8d25421543cd1c7fafd53bcfa0 Author: danielsun1106 Date: 2018-11-18T12:37:01Z GROOVY-8890: Make "Inspect Tokens" of groovy console support Parrot's tokens ---
[GitHub] groovy pull request #824: GROOVY-8887: Support multi-assignment of tuples in...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/824 GROOVY-8887: Support multi-assignment of tuples in STC You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy stc-tuple Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/824.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #824 commit b405028c7bd113f974b8db22c1075d032bd7fa2e Author: danielsun1106 Date: 2018-11-17T11:02:38Z GROOVY-8887: Support multi-assignment of tuples in STC ---
[GitHub] groovy pull request #821: GROOVY-8874: Refine tuples to support functional p...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/821 GROOVY-8874: Refine tuples to support functional programming better You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8874 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/821.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #821 commit c70c4fa23396b65255ff2f220986d9d674aaf9e8 Author: danielsun1106 Date: 2018-11-11T07:47:21Z GROOVY-8874: Refine tuples to support functional programming better ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/7d2d6319f694b87fc4e646d3d22679315e1411bf#commitcomment-31185553 In src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java: In src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java on line 132: It's better to move `power` implementation to `NumberMath`, and `DefaultGroovyMethods`'s `power` invoke `NumberMath`'s `power` ---
[GitHub] groovy pull request #819: GROOVY-7975/GROOVY-3278/GROOVY-7854: improved acce...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/819#discussion_r230589376 --- Diff: src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java --- @@ -18,20 +18,205 @@ */ package org.apache.groovy.ast.tools; +import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.FieldNode; +import org.codehaus.groovy.ast.expr.BinaryExpression; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.ListExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; +import org.codehaus.groovy.ast.expr.VariableExpression; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; + +import static org.codehaus.groovy.syntax.Types.DIVIDE; +import static org.codehaus.groovy.syntax.Types.MINUS; +import static org.codehaus.groovy.syntax.Types.MULTIPLY; +import static org.codehaus.groovy.syntax.Types.PLUS; public class ExpressionUtils { +private static ArrayList handledTypes = new ArrayList(); + private ExpressionUtils() { } -// resolve constant-looking expressions statically (do here as gets transformed away later) +static { +handledTypes.add(PLUS); +handledTypes.add(MINUS); +handledTypes.add(MULTIPLY); +handledTypes.add(DIVIDE); +} + +public static ConstantExpression transformBinaryConstantExpression(BinaryExpression be, ClassNode targetType) { +if (isTypeOrArrayOfType(targetType, ClassHelper.STRING_TYPE, false)) { +if (be.getOperation().getType() == PLUS) { +Expression left = transformInlineConstants(be.getLeftExpression(), targetType); +Expression right = transformInlineConstants(be.getRightExpression(), targetType); +if (left instanceof ConstantExpression && right instanceof ConstantExpression) { +ConstantExpression newExp = new ConstantExpression((String) ((ConstantExpression) left).getValue() + +((ConstantExpression) right).getValue()); +newExp.setSourcePosition(be); +return newExp; +} +} +} else if (isTypeOrArrayOfType(targetType, ClassHelper.Integer_TYPE, false) || isTypeOrArrayOfType(targetType, ClassHelper.int_TYPE, false)) { +int type = be.getOperation().getType(); +if (handledTypes.contains(type)) { +Expression left = transformInlineConstants(be.getLeftExpression(), targetType); +Expression right = transformInlineConstants(be.getRightExpression(), targetType); +if (left instanceof ConstantExpression && right instanceof ConstantExpression) { +Integer newVal = null; +switch(type) { +case PLUS: +newVal = (Integer) ((ConstantExpression) left).getValue() + +(Integer) ((ConstantExpression) right).getValue(); +break; +case MINUS: +newVal = (Integer) ((ConstantExpression) left).getValue() - +(Integer) ((ConstantExpression) right).getValue(); +break; +case MULTIPLY: +newVal = (Integer) ((ConstantExpression) left).getValue() * +(Integer) ((ConstantExpression) right).getValue(); +break; +case DIVIDE: +newVal = (Integer) ((ConstantExpression) left).getValue() / +(Integer) ((ConstantExpression) right).getValue(); +break; +} +if (newVal != null) { +ConstantExpression newExp = new ConstantExpression(newVal, true); +newExp.setSourcePosition(be); +return newExp; +} +} +} +} else if (isTypeOrArrayOfType(targetType, ClassHelper.Double_TYPE, false) || isTypeOrArrayOfType(targetType, ClassHelper.double_TYPE, false)) { --- End diff -- looks like some template code, which is duplicated now. It's better to refactor it IMO ---
[GitHub] groovy pull request #818: GROOVY-8866: Implement `GProperties` to handle pro...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/818 GROOVY-8866: Implement `GProperties` to handle properties file smartly You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy gproperties Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/818.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #818 commit 26c11ead52c31992b4be5a66c841c585ddd4ca13 Author: danielsun1106 Date: 2018-11-01T16:11:23Z GROOVY-8866: Implement `GProperties` to handle properties file smartly ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/3341dcd9a4f151b71b90ceb0be59fcdca403c300#commitcomment-31075653 No one can assure Groovy users will not create GroovyCodeSource instances with different names for the same source code. The current implementation can avoid the problems too. ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/3341dcd9a4f151b71b90ceb0be59fcdca403c300#commitcomment-31075542 e.g. GroovyShell evaluates same script with different file names, which results in loading classes repeatedly and the classes and the relevant InnerLoader instances can't be GC. ---
[GitHub] groovy pull request #817: GROOVY-8861: Simplify the switch for runtime groov...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/817 GROOVY-8861: Simplify the switch for runtime groovydoc You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-runtime-groovydoc Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/817.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #817 commit 6da5d75c7e8fc9231a166ed40507311f30523c97 Author: danielsun1106 Date: 2018-10-28T10:36:47Z GROOVY-8861: Simplify the switch for runtime groovydoc ---
[GitHub] groovy pull request #816: GROOVY-8858: Refine GCL to avoid occupying Permane...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/816 GROOVY-8858: Refine GCL to avoid occupying Permanent Area/Metaspace repeatedly for same source code You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-gcl Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/816.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #816 commit dc4fac58a09b96a920a8872a61ba6ff8842a9993 Author: danielsun1106 Date: 2018-10-27T11:10:02Z Refine GCL to avoid keeping occupying a lot of Permanent Area/Metaspace ---
[GitHub] groovy pull request #813: GROOVY-8851: Refine safe indexing for named proper...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/813 GROOVY-8851: Refine safe indexing for named properties You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-safe-index Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/813.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #813 commit 27fc472e1ca1f1242a31cac93138dd318cdbbcec Author: danielsun1106 Date: 2018-10-20T07:24:34Z GROOVY-8851: Refine safe indexing for named properties ---
[GitHub] groovy pull request #809: GROOVY-8842: Refine highlighting source code in gr...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/809 GROOVY-8842: Refine highlighting source code in groovy console editor You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy smart-editor Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/809.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #809 commit fa538f0d08793152cc1310762fcbf833fd5bc303 Author: danielsun1106 Date: 2018-10-12T19:35:34Z GROOVY-8842: Refine highlighting source code in groovy console editor ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/fd21ad4e3b6d2a4297944d079ba8948e8d8e6052#commitcomment-30846491 Using Java 8 API causes the test failure when running on Java 7 ---
[GitHub] groovy pull request #807: GROOVY-8819: java.lang.VerifyError when calling th...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/807 GROOVY-8819: java.lang.VerifyError when calling this() with static fi⦠â¦nal field from a super class You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8819 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/807.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #807 commit 070f98bfc7a07e06d941cc5d148ccbec6e9da690 Author: danielsun1106 Date: 2018-10-07T11:11:56Z GROOVY-8819: java.lang.VerifyError when calling this() with static final field from a super class ---
[GitHub] groovy pull request #806: GROOVY-8831: Add instance methods from `String` to...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/806 GROOVY-8831: Add instance methods from `String` to `GString` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-gstring Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/806.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #806 commit 31767294220d4d6974e702cb91bcf710973fa353 Author: danielsun1106 Date: 2018-10-06T13:42:00Z GROOVY-8831: Add instance methods from `String` to `GString` ---
[GitHub] groovy pull request #805: Refine compileJava task
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/805 Refine compileJava task You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-compile-java-task Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/805.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #805 commit 334361edf13b070a852d7d17d1b1dbf66f0dd65a Author: danielsun1106 Date: 2018-10-06T08:20:13Z Refine compileJava task ---
[GitHub] groovy pull request #802: GROOVY-8818: Bump asm to 7.0-beta
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/802 GROOVY-8818: Bump asm to 7.0-beta You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy bump-asm-7beta Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/802.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #802 commit c3eff7b0ee1f44c47dcda276b5ba5f7dfafe5247 Author: danielsun1106 Date: 2018-09-30T14:33:32Z Bump asm to 7.0-beta ---
[GitHub] groovy pull request #801: GROOVY-8327: Parser regression. Can't access stati...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/801 GROOVY-8327: Parser regression. Can't access static instance method b⦠â¦efore class is constructed You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8327 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/801.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #801 commit 4d285954134a45c88257aaa7b24775ea1f3a6a71 Author: danielsun1106 Date: 2018-09-22T15:49:06Z GROOVY-8327: Parser regression. Can't access static instance method before class is constructed ---
[GitHub] groovy pull request #800: GROOVY-8808: Add DGM `Throwable.asString`
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/800 GROOVY-8808: Add DGM `Throwable.asString` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy throwable-asstring Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/800.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #800 ---
[GitHub] groovy pull request #797: GROOVY-8794: Add groovy-yaml subproject to support...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/797#discussion_r217901272 --- Diff: subprojects/groovy-yaml/src/spec/doc/yaml-userguide.adoc --- @@ -0,0 +1,112 @@ +// + + 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. + +// + += Processing YAML + +Groovy comes with integrated support for converting between Groovy objects and YAML. The classes dedicated to --- End diff -- OK. I will refine the docs according to your suggestions later. ---
[GitHub] groovy pull request #797: GROOVY-8794: Add groovy-yaml subproject to support...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/797#discussion_r217900520 --- Diff: subprojects/groovy-yaml/src/spec/doc/yaml-userguide.adoc --- @@ -0,0 +1,112 @@ +// + + 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. + +// + += Processing YAML + +Groovy comes with integrated support for converting between Groovy objects and YAML. The classes dedicated to +YAML serialisation and parsing are found in the `groovy.yaml` package. + +[[yaml_yamlslurper]] +== YamlSlurper + +`YamlSlurper` is a class that parses YAML text or reader content into Groovy data structures (objects) such as maps, lists and +primitive types like `Integer`, `Double`, `Boolean` and `String`. + +The class comes with a bunch of overloaded `parse` methods plus some special methods such as `parseText` +and others. For the next example we will use the `parseText` method. It parses a YAML `String` and recursively converts it to a +list or map of objects. The other `parse*` methods are similar in that they return a YAML `String` but for different parameter +types. + +[source,groovy] + +include::{rootProjectDir}/subprojects/groovy-yaml/src/spec/test/groovy/yaml/YamlParserTest.groovy + + +Notice the result is a plain map and can be handled like a normal Groovy object instance. `YamlSlurper` parses the +given YAML as defined by the http://yaml.org/spec/1.2/spec.html[YAML Ainât Markup Language (YAMLâ¢)]. + +In addition to maps `YamlSlurper` supports YAML arrays which are converted to lists. + +[source,groovy] + +include::{rootProjectDir}/subprojects/groovy-yaml/src/spec/test/groovy/yaml/YamlParserTest.groovy + + +The YAML standard supports the following primitive data types: string, number, object, `true`, `false` and `null`. `YamlSlurper` +converts these YAML types into corresponding Groovy types. + +[source,groovy] + +include::{rootProjectDir}/subprojects/groovy-yaml/src/spec/test/groovy/yaml/YamlParserTest.groovy --- End diff -- To be frank, I do not know how to use tags to write docs... If you could give me a hand, that would be great. ---
[GitHub] groovy pull request #797: GROOVY-8794: Add groovy-yaml subproject to support...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/797#discussion_r217900457 --- Diff: build.gradle --- @@ -160,6 +160,8 @@ ext { spockVersion = '1.2-groovy-2.4-SNAPSHOT' // supports 3.0 antlr4Version = '4.7.1' jsr305Version = '3.0.2' +jacksondataformatyamlVersion = '2.9.6' +jacksondatabindVersion = '2.9.6' --- End diff -- I will move them later. ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/522fd4996b6314caa05d16590f3896bf750eb83e#commitcomment-30515521 I've merged the commit into https://github.com/danielsun1106/groovy-parser with your information reserved :-) https://github.com/danielsun1106/groovy-parser/commit/e2bc9d708d955f830d2309cf8bcfaf09c3fa69a6 ---
[GitHub] groovy pull request #797: GROOVY-8794: Add groovy-yaml subproject to support...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/797 GROOVY-8794: Add groovy-yaml subproject to support parsing yaml You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy groovy-yaml Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/797.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #797 commit 4e7712f13fbf25bda5705a5df296ef96daf37b12 Author: danielsun1106 Date: 2018-09-15T00:07:35Z Add groovy-yaml subproject to support parsing yaml ---
[GitHub] groovy pull request #793: GROOVY-8780: Add `sha256` DGM
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/793#discussion_r216121282 --- Diff: src/main/java/org/codehaus/groovy/runtime/EncodingGroovyMethods.java --- @@ -389,6 +390,26 @@ public static String md5(byte[] self) throws NoSuchAlgorithmException { return digest(self, MD5); } +/** + * Calculate SHA-256 of the CharSequence instance + * @return SHA-256 value + * @throws NoSuchAlgorithmException if SHA-256 algorithm not found + * @since 2.5.0 + */ +public static String sha256(CharSequence self) throws NoSuchAlgorithmException { +return digest(self, SHA_256); +} + +/** + * Calculate SHA-256 of the byte array + * @return SHA-256 value + * @throws NoSuchAlgorithmException if SHA-256 algorithm not found + * @since 2.5.0 --- End diff -- OK. I'll fix it. Thanks ;-) ---
[GitHub] groovy pull request #793: GROOVY-8780: Add `sha256` DGM
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/793 GROOVY-8780: Add `sha256` DGM You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy more-digest Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/793.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #793 commit c6a8a1ecbd82a83aeffb8502afed19ba5dcfc0cf Author: danielsun1106 Date: 2018-09-08T04:15:43Z GROOVY-8780: Add `sha256` DGM ---
[GitHub] groovy pull request #792: GROOVY-8778: Cast short-hand breaks for empty map
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/792#discussion_r216116090 --- Diff: subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java --- @@ -2337,14 +2337,11 @@ public Expression visitPathElement(PathElementContext ctx) { this.visitNamedPropertyArgs(ctx.namedPropertyArgs()); Expression right; -if (mapEntryExpressionList.size() == 1) { -MapEntryExpression mapEntryExpression = mapEntryExpressionList.get(0); - -if (mapEntryExpression.getKeyExpression() instanceof SpreadMapExpression) { -right = mapEntryExpression.getKeyExpression(); -} else { -right = mapEntryExpression; -} +if (mapEntryExpressionList.size() == 0) { +// expecting list of MapEntryExpressions later so use SpreadMap to smuggle empty MapExpression to later stages +right = new SpreadMapExpression(configureAST(new MapExpression(), ctx.namedPropertyArgs())); --- End diff -- The implementation of parser should not decouple with back end(i.e. not rely on the implementation of back end). If the implementation of resolve visitor changes in the future, the expression is not thrown away, the node position is missing. ---
[GitHub] groovy pull request #792: GROOVY-8778: Cast short-hand breaks for empty map
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/792#discussion_r216113948 --- Diff: subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java --- @@ -2337,14 +2337,11 @@ public Expression visitPathElement(PathElementContext ctx) { this.visitNamedPropertyArgs(ctx.namedPropertyArgs()); Expression right; -if (mapEntryExpressionList.size() == 1) { -MapEntryExpression mapEntryExpression = mapEntryExpressionList.get(0); - -if (mapEntryExpression.getKeyExpression() instanceof SpreadMapExpression) { -right = mapEntryExpression.getKeyExpression(); -} else { -right = mapEntryExpression; -} +if (mapEntryExpressionList.size() == 0) { +// expecting list of MapEntryExpressions later so use SpreadMap to smuggle empty MapExpression to later stages +right = new SpreadMapExpression(configureAST(new MapExpression(), ctx.namedPropertyArgs())); --- End diff -- It's better to `configureAST` the instance of `SpreadMapExpression` too, or its node position will be missing. ---
[GitHub] groovy pull request #789: GROOVY-8090: Incorrectly processing method-level t...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/789 GROOVY-8090: Incorrectly processing method-level type generics inform⦠â¦ation You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8090 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/789.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #789 commit eb559b9bf5766746e24bfadef738273df36dc296 Author: danielsun1106 Date: 2018-08-26T06:22:25Z GROOVY-8090: Incorrectly processing method-level type generics information ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/35a3df1436b76f315a925f7d30479c8d092805c0#commitcomment-30151884 GROOVY-8741: Make single character GString behave like similar String in '==' #782 ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/ed3814a053eee8a4480c85c23485e161fd74c16a#commitcomment-30046088 Nice! The codebase is much cleaner than before :-) ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/ec7b147b4b90c55e1d117f3bac63b060eeb79386#commitcomment-30043824 `UnlimitedConcurrentCache`'s `getAndPut` on 2.5 branch is not thread safe, so the commit is only for the master. ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/a798866fcfd98f7b2cd46e948b37217a8349f609#commitcomment-29728201 Some tests failed. It seems that picocli 3.3.0 is not compatible with 3.2.0 https://travis-ci.org/apache/groovy/jobs/404235362 ``` > Task :groovy-cli-picocli:test groovy.cli.picocli.CliBuilderTest > testMixedBurstingAndLongOptions FAILED junit.framework.AssertionFailedError at junit.framework.Assert.fail(Assert.java:55) at junit.framework.Assert.assertTrue(Assert.java:22) at junit.framework.Assert.assertTrue(Assert.java:31) at junit.framework.TestCase.assertTrue(TestCase.java:201) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1554) at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:64) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:197) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:209) at groovy.cli.picocli.CliBuilderTest.testMixedBurstingAndLongOptions(CliBuilderTest.groovy:526) groovy.cli.picocli.CliBuilderTest > testLongOptionsRequireDoubleHyphenByDefault FAILED junit.framework.AssertionFailedError at junit.framework.Assert.fail(Assert.java:55) at junit.framework.Assert.assertTrue(Assert.java:22) at junit.framework.Assert.assertTrue(Assert.java:31) at junit.framework.TestCase.assertTrue(TestCase.java:201) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1554) at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:64) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:197) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:209) at groovy.cli.picocli.CliBuilderTest.testLongOptionsRequireDoubleHyphenByDefault(CliBuilderTest.groovy:920) ``` ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/3143944c30f340208be40e9452e2e5be2e4a33be#commitcomment-29574669 In src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java: In src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java on line 673: Done. https://github.com/apache/groovy/commit/c7272cfa2571a4beb5974d044127bbafaf1e71d9 ---
[GitHub] groovy pull request #765: GROOVY-8675: GenericsUtils.PARAMETERIZED_TYPE_CACH...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/765 GROOVY-8675: GenericsUtils.PARAMETERIZED_TYPE_CACHE is static and pri⦠â¦vate You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8675 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/765.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #765 commit 211d3a1fe79a6b10bf35e9aed9fd23503bd30500 Author: Daniel Sun Date: 2018-07-02T01:12:11Z GROOVY-8675: GenericsUtils.PARAMETERIZED_TYPE_CACHE is static and private ---
[GitHub] groovy pull request #755: Fix inferring return type issues
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/755 Fix inferring return type issues When methods are mixed with other expressions in the return statement, `isNestedOrSandwichedMethodCall` fails to handle all cases and the source of issues. As `isNestedOrSandwichedMethodCall` is a temporary solution, it's useless and can be removed now. You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy infer-return-type Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/755.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #755 commit 09a8aa7c3db575be529e860d068e2702262970a0 Author: Daniel Sun Date: 2018-06-14T06:39:17Z Fix inferreing return type issues ---
[GitHub] groovy pull request #752: Add openjdk10 build
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/752 Add openjdk10 build You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy java10 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/752.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #752 commit 544be957a197d0a6f6534e22fc110d9b704dfd85 Author: Daniel Sun Date: 2018-06-06T11:18:16Z Add openjdk10 build ---
[GitHub] groovy pull request #751: Bump asm to 6.2
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/751 Bump asm to 6.2 You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy bump-asm-62 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/751.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #751 commit 629e1bd2907722075ad85cb8f2a6d2b5069c81cb Author: Daniel Sun Date: 2018-06-06T10:57:21Z Bump asm to 6.2 ---
[GitHub] groovy pull request #748: GROOVY-8628: Groovydoc fails to parse Java static ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/748#discussion_r193360798 --- Diff: subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/JavaStaticNestedClassWithDiamond.java --- @@ -18,12 +18,17 @@ */ package org.codehaus.groovy.tools.groovydoc.testfiles; -public abstract class JavaStaticNestedClassWithDiamond { +public class JavaStaticNestedClassWithDiamond { --- End diff -- OK. I see. It does not matter IMO. ---
[GitHub] groovy pull request #748: GROOVY-8628: Groovydoc fails to parse Java static ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/748#discussion_r193360554 --- Diff: src/main/antlr2/org/codehaus/groovy/antlr/java/java.g --- @@ -402,10 +402,9 @@ wildcardType (("extends" | "super")=> typeArgumentBounds)? ; -typeArgumentsDiamond -{Token first = LT(1);} +typeArgumentsOrDiamond : LT! GT! -{#typeArgumentsDiamond = #(create(TYPE_ARGUMENTS, "TYPE_ARGUMENTS",first,LT(1)), #typeArgumentsDiamond);} --- End diff -- Could you explain the reason why the line should be removed? ---
[GitHub] groovy pull request #748: GROOVY-8628: Groovydoc fails to parse Java static ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/748#discussion_r193270629 --- Diff: subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/JavaStaticNestedClassWithDiamond.java --- @@ -18,12 +18,17 @@ */ package org.codehaus.groovy.tools.groovydoc.testfiles; -public abstract class JavaStaticNestedClassWithDiamond { +public class JavaStaticNestedClassWithDiamond { --- End diff -- Why should `abstract` be removed? ---
[GitHub] groovy pull request #750: Refine the parameterized type cache
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/750 Refine the parameterized type cache Use `SoftReference` instance to hold value to release memory after STC is done. You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-parameterized-type-cache Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/750.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #750 commit ba08108d01d748394e4cfb5d774bb768182e03a2 Author: Daniel Sun Date: 2018-06-04T10:42:56Z Refine the parameterized type cache ---
[GitHub] groovy pull request #749: GROOVY-8629: Groovy STC fails on return of nested ...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/749 GROOVY-8629: Groovy STC fails on return of nested class using generics You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8629 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/749.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #749 commit 03e01742722e6436a315508de373b8a600cc8471 Author: Daniel Sun Date: 2018-06-04T07:22:03Z GROOVY-8629: Groovy STC fails on return of nested class using generics ---
[GitHub] groovy pull request #748: GROOVY-8628: Groovydoc fails to parse Java static ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/748#discussion_r192608515 --- Diff: subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/JavaStaticNestedClassWithDiamond.java --- @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.groovy.tools.groovydoc.testfiles; + +public abstract class JavaStaticNestedClassWithDiamond { + +JavaStaticNestedClassWithDiamond() { +} + +static class Nested extends JavaStaticNestedClassWithDiamond { --- End diff -- Would you mind add some javadoc to this inner class and test whether its javadoc can be extracted properly? ---
[GitHub] groovy pull request #746: Refine the rule for missing right parenthesis
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/746 Refine the rule for missing right parenthesis You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-missing-right-parenthesis Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/746.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #746 commit f1f507aabdaa859e6fa2c0365f76e381fc376b62 Author: Daniel Sun Date: 2018-06-02T15:25:00Z Refine the rule for missing right parenthesis ---
[GitHub] groovy pull request #744: GROOVY-8613: GCE in elvis assignment evaluation
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/744 GROOVY-8613: GCE in elvis assignment evaluation You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8613 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/744.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #744 commit 402b6ab6879bffc402f6056061efc7a97c194406 Author: Daniel Sun Date: 2018-06-01T16:32:44Z GROOVY-8613: GCE in elvis assignment evaluation ---
[GitHub] groovy pull request #739: Refine GROOVY-8595: Fix type inference of method c...
Github user danielsun1106 closed the pull request at: https://github.com/apache/groovy/pull/739 ---
[GitHub] groovy pull request #739: Refine GROOVY-8595: Fix type inference of method c...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/739 Refine GROOVY-8595: Fix type inference of method call in property exp⦠â¦ression You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-GROOVY-8595 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/739.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #739 commit 6b241318ebe3b1f78364d3e920deeddf6782cbc4 Author: Daniel Sun Date: 2018-06-01T07:59:52Z Refine GROOVY-8595: Fix type inference of method call in property expression ---
[GitHub] groovy pull request #738: Make classpath table of groovy console not editabl...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/738 Make classpath table of groovy console not editable You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-classpath-table Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/738.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #738 commit d9ce9f51c2757846c9ff10fdf2f1e072cd50e376 Author: Daniel Sun Date: 2018-06-01T02:41:06Z Make classpath table not editable ---
[GitHub] groovy pull request #735: Fix file descriptor leak in AST transform discover...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/735#discussion_r191637941 --- Diff: src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java --- @@ -221,7 +222,9 @@ private static void doAddGlobalTransforms(ASTTransformationsContext context, boo String className; BufferedReader svcIn = null; try { -svcIn = new BufferedReader(new InputStreamReader(service.openStream(), "UTF-8")); +URLConnection urlConnection = service.openConnection(); +urlConnection.setUseCaches(false); +svcIn = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), "UTF-8")); --- End diff -- Readers will close their underlying Readers(e.g. `BufferedReader`(i.e. `svcIn`) --closes--> `InputStreamReader` --closes--> the stream instance created by `service.openStream()`), and `svcIn` will be closed in the `finally` block, could you please explain how file descriptor leaks? ---
[GitHub] groovy pull request #734: Make some groovy classes compile static
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/734 Make some groovy classes compile static In order to reduce the size of class files and improve the performance of groovy console, the PR tries to make as many groovy classes as possible compile static. You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy compilestatic-groovyconsole Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/734.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #734 commit a50b2b1f7094922011ad5372c5c0ae8b1d47a169 Author: Daniel Sun Date: 2018-05-29T11:10:02Z Make some groovy class compile static ---
[GitHub] groovy pull request #733: Trivial refactoring: Use `AtomicInteger` instead o...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/733 Trivial refactoring: Use `AtomicInteger` instead of `synchronized` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy trivial-refactoring-for-groovyshell Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/733.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #733 commit 6bf2af70e1678884748da34f6f1c6b102824f41e Author: Daniel Sun Date: 2018-05-29T01:03:37Z Trivial refactoring: Use `AtomicInteger` instead of `synchronized` commit f732538b9d5a0ab25b733b86b7d5bdbf36216d29 Author: Daniel Sun Date: 2018-05-29T01:29:59Z Initialize `counter` ---
[GitHub] groovy pull request #732: Refine the usage of `toArray` in `GroovyShell`
Github user danielsun1106 closed the pull request at: https://github.com/apache/groovy/pull/732 ---
[GitHub] groovy pull request #732: Refine the usage of `toArray` in `GroovyShell`
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/732 Refine the usage of `toArray` in `GroovyShell` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-groovyshell Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/732.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #732 commit 7c408540bf6f84be264aa0a98de5a0d5c4851301 Author: Daniel Sun Date: 2018-05-28T11:23:26Z Refine the usage of `toArray` in `GroovyShell` ---
[GitHub] groovy pull request #730: GROOVY-8609 Fails to compile when upper bound has ...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/730 GROOVY-8609 Fails to compile when upper bound has generics You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8609 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/730.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #730 commit e07d69b37c44ce636ca57b1a658304972cb590ce Author: Daniel Sun Date: 2018-05-28T04:41:48Z GROOVY-8609 Fails to compile when upper bound has generics ---
[GitHub] groovy pull request #726: Minor refactoring: use another extracting placehol...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/726 Minor refactoring: use another extracting placeholder logic You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy minor-refactoring-another-extracting-placeholder-logic Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/726.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #726 commit c68c4c0e0213a50b91550404953eca14636cfa31 Author: Daniel Sun Date: 2018-05-26T05:44:26Z Minor refactoring: use another extracting placeholder logic ---
[GitHub] groovy pull request #722: Request YourKit Java Profiler Open Source License
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/722 Request YourKit Java Profiler Open Source License Here is the link to YourKit and search "Open source project license" in the page: https://www.yourkit.com/purchase/ **Open source project license** ``` The license is granted to developers of non-commercial Open Source projects, with an established and active community. The license is free. However, we ask you to add a reference to YourKit website on the web pages of your Open Source project. ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy request-yourkit-open-source-license Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/722.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #722 commit f2b2930a502c47a771c160120c06853a25715db2 Author: Daniel Sun Date: 2018-05-25T01:50:59Z Add a reference to YourKit website ---
[GitHub] groovy pull request #721: Cache the parameterized info for better performanc...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/721 Cache the parameterized info for better performance Finding the parameterized type is expensive, so it's better to cache it. You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy parameterized-info-cache Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/721.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #721 commit 19627bfe95e92e188f53ac1fa7f1f40d9b071b19 Author: Daniel Sun Date: 2018-05-24T13:01:12Z Cache the parameterized info for better performance Finding the parameterized type is expensive, so it's better to cache it. commit 939e5ab50263d58a93facc3427cc06fc8cf4c6d8 Author: Daniel Sun Date: 2018-05-24T13:08:06Z Sync the changes from apache/groovy and resolve conflicts ---
[GitHub] groovy pull request #717: Groovy 8562 wrong closure delegation for property ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/717#discussion_r190359768 --- Diff: src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java --- @@ -596,6 +597,26 @@ public void visitVariableExpression(VariableExpression vexp) { } else if (accessedVariable instanceof FieldNode) { FieldNode fieldNode = (FieldNode) accessedVariable; +TypeCheckingContext.EnclosingClosure enclosingClosure = typeCheckingContext.getEnclosingClosure(); +if (enclosingClosure != null) { +// GROOVY-8562 +// when vexp has the same name as a property of the owner, +// the IMPLICIT_RECEIVER must be set in case it's the delegate +if (tryVariableExpressionAsProperty(vexp, vexp.getName())) { +// IMPLICIT_RECEIVER is handled elsewhere +// however other access needs to be fixed for private access +if (vexp.getNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER) == null) { +boolean lhsOfEnclosingAssignment = isLHSOfEnclosingAssignment(vexp); +ClassNode owner = (ClassNode) vexp.getNodeMetaData(StaticCompilationMetadataKeys.PROPERTY_OWNER); +if (owner != null) { +fieldNode = owner.getField(vexp.getName()); +vexp.setAccessedVariable(fieldNode); +checkOrMarkPrivateAccess(vexp, fieldNode, lhsOfEnclosingAssignment); --- End diff -- `lhsOfEnclosingAssignment` is only used here(in the `if` block) ---
[GitHub] groovy pull request #717: Groovy 8562 wrong closure delegation for property ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/717#discussion_r190359237 --- Diff: src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java --- @@ -596,6 +597,26 @@ public void visitVariableExpression(VariableExpression vexp) { } else if (accessedVariable instanceof FieldNode) { FieldNode fieldNode = (FieldNode) accessedVariable; +TypeCheckingContext.EnclosingClosure enclosingClosure = typeCheckingContext.getEnclosingClosure(); +if (enclosingClosure != null) { +// GROOVY-8562 +// when vexp has the same name as a property of the owner, +// the IMPLICIT_RECEIVER must be set in case it's the delegate +if (tryVariableExpressionAsProperty(vexp, vexp.getName())) { +// IMPLICIT_RECEIVER is handled elsewhere +// however other access needs to be fixed for private access +if (vexp.getNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER) == null) { +boolean lhsOfEnclosingAssignment = isLHSOfEnclosingAssignment(vexp); --- End diff -- `lhsOfEnclosingAssignment` seems to be able to inline ---
[GitHub] groovy pull request #718: Bump ivy to 2.5.0-rc1
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/718 Bump ivy to 2.5.0-rc1 You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy bump-ivy-2.5.0-rc1 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/718.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #718 commit 47a19330a0afa4d03da67f92eb89edab517a0e16 Author: Daniel Sun Date: 2018-05-23T09:26:16Z Bump ivy to 2.5.0-rc1 ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/b0d79332a3e897e821e62983ba38e5d926fa7cdd#commitcomment-29062398 author is not blank ;-) ---
[GitHub] groovy pull request #714: GROOVY-8586: Support Java 9 ARM blocks
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/714 GROOVY-8586: Support Java 9 ARM blocks You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8586 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/714.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #714 commit b7c77c2c817b148c1d30462ba3e7f74718c2 Author: Daniel Sun Date: 2018-05-21T14:59:59Z GROOVY-8586: Support Java 9 ARM blocks commit 5329b60eb13e0174559fa00778aabd0d294583ef Author: Daniel Sun Date: 2018-05-21T15:02:14Z Add license header ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/869c365161457c050d5a54c7ff43d73d3263f34e#commitcomment-29055018 I've synchronized your changes to https://github.com/danielsun1106/groovy-parser with your contribution info kept ;-) https://github.com/danielsun1106/groovy-parser/commit/757eace44e5764983332cca5cd9e2801396cae52 ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/c2cea059fecc3bc4a2c01adc6a30d2a1508bd64b#commitcomment-29031873 author is not blank ð ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/c9eea7c30ececdc0a24939fb780c56c27eec798f#commitcomment-29020550 GROOVY-4151 test has been recovered by https://github.com/apache/groovy/commit/ef2fbe68d25ae7dce57ee2580c975c54e3dbaace ---
[GitHub] groovy pull request #708: GROOVY-6668: Static compiler doesn't coerce GStrin...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/708#discussion_r188837462 --- Diff: src/test/groovy/bugs/Groovy6668Bug.groovy --- @@ -0,0 +1,65 @@ +/* + * 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 + +class Groovy6668Bug extends GroovyTestCase{ +void testGroovy6668() { +assertScript ''' +@groovy.transform.CompileStatic +class OtherThing { +OtherThing() { +Map m = [:] +def k = "foo" +m["$k"].toUpperCase() +} +} + +OtherThing --- End diff -- I've fixed that according your suggestion :-) ---
[GitHub] groovy pull request #708: GROOVY-6668: Static compiler doesn't coerce GStrin...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/708#discussion_r188826337 --- Diff: src/test/groovy/bugs/Groovy6668Bug.groovy --- @@ -0,0 +1,65 @@ +/* + * 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 + +class Groovy6668Bug extends GroovyTestCase{ +void testGroovy6668() { +assertScript ''' +@groovy.transform.CompileStatic +class OtherThing { +OtherThing() { +Map m = [:] +def k = "foo" +m["$k"].toUpperCase() +} +} + +OtherThing --- End diff -- I just keep the code of the issue as it is. the `new OtherThing()` version is `testGroovy6668WithData` ;-) ---
[GitHub] groovy pull request #708: GROOVY-6668: Static compiler doesn't coerce GStrin...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/708#discussion_r188825988 --- Diff: src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java --- @@ -4101,13 +4101,17 @@ protected static ClassNode getGroupOperationResultType(ClassNode a, ClassNode b) return Number_TYPE; } -protected ClassNode inferComponentType(final ClassNode containerType, final ClassNode indexType) { +private static ClassNode convertGStringToStringType(ClassNode cn) { +return GSTRING_TYPE.equals(cn) ? STRING_TYPE : cn; +} + +protected ClassNode inferComponentType(final ClassNode containerType, ClassNode indexType) { final ClassNode componentType = containerType.getComponentType(); if (componentType == null) { // GROOVY-5521 // try to identify a getAt method typeCheckingContext.pushErrorCollector(); -MethodCallExpression vcall = callX(varX("_hash_", containerType), "getAt", varX("_index_", indexType)); +MethodCallExpression vcall = callX(varX("_hash_", containerType), "getAt", varX("_index_", convertGStringToStringType(indexType))); --- End diff -- Good idea! ```groovy /** * Get the value via the string value of the key * See GROOVY-6668 and the PR#708 (https://github.com/apache/groovy/pull/708) * * @param self a map * @param key a key * @param value type * @return the value */ public static V getAt(Map self, GString key) { if (null == key) { return null; } return self.get(key.toString()); } ``` but I wonder why we should not treat GString as String? As a groovy user, I won't write code like `GString str = "${'someString'}"`, and I just write `String str = "${'someString'}"` or `def str = "${'someString'}"` then treat `str` as a `String`... ---
[GitHub] groovy pull request #708: GROOVY-6668: Static compiler doesn't coerce GStrin...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/708 GROOVY-6668: Static compiler doesn't coerce GString for getAt() call You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-6668 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/708.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #708 commit f3c3939b473c33acf0de5d95074bc2eb8bd61555 Author: Daniel Sun Date: 2018-05-17T01:49:00Z GROOVY-6668: Static compiler doesn't coerce GString for getAt() call ---
[GitHub] groovy pull request #706: GROOVY-8355: Instanceof inference does not work on...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/706 GROOVY-8355: Instanceof inference does not work on field assigning You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-8355 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/706.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #706 commit cdf254c3814415bebba622da43f2e5243cfdbcf5 Author: Daniel Sun Date: 2018-05-15T11:34:24Z GROOVY-8355: Instanceof inference does not work on field assigning ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/62f877abd28c62e3058a383905bb93624ef36130#commitcomment-28966000 @paulk-asert author is not blank again? o_O ---
[GitHub] groovy pull request #705: GROOVY-7883 Static compiler prefers private constr...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/705#discussion_r187764707 --- Diff: subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java --- @@ -3973,7 +3973,7 @@ protected final ResultSet executePreparedQuery(String sql, List params) * @return the resulting list of rows * @throws SQLException if a database error occurs */ -protected List asList(String sql, ResultSet rs, +public List asList(String sql, ResultSet rs, --- End diff -- The test accesses the `protected` method `asList`, which is not allowed. so I change its visibility to `public`. groovy.sql.SqlSTCTest#testAsList ``` void testAsList() { shell.evaluate ''' def test(groovy.sql.Sql sql, java.sql.ResultSet rs) { sql.asList('SELECT * FROM FOO', rs) { println it.columnCount } } ''' } ``` ---
[GitHub] groovy pull request #705: GROOVY-7883 Static compiler prefers private constr...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/705 GROOVY-7883 Static compiler prefers private constructor over public ⦠â¦if private matches be You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-7883 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/705.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #705 commit 394db983d51446f849205efc4f9cca21601cc47c Author: Daniel Sun Date: 2018-05-12T04:35:01Z GROOVY-7883 Static compiler prefers private constructor over public if private matches be ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/3f650cc681cf1702860a47247bfa728c4c793ef8#commitcomment-28943410 @paulk-asert author field is not blank again? ;-) ---
[GitHub] groovy pull request #699: GROOVY-7204: Static type checking and compilation ...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/699 GROOVY-7204: Static type checking and compilation fail when multiple ⦠â¦generics in use You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy GROOVY-7204 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/699.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #699 commit 1adb32dc73f13f07cc61124711d3bba92dd6ec82 Author: Daniel Sun Date: 2018-05-09T17:38:30Z GROOVY-7204: Static type checking and compilation fail when multiple generics in use ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/c80d02b13005efd87eb69ca66958def9becc56e1#commitcomment-28855880 @paulk-asert you can check whether the Author field in the commit dialog of IntelliJ IDEA is blank. ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/c80d02b13005efd87eb69ca66958def9becc56e1#commitcomment-28855805 @paulk-asert I have not contributed the commit... ---
[GitHub] groovy pull request #693: Allow methodMissing/propertyMissing to be defined ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/693#discussion_r185901767 --- Diff: src/main/groovy/groovy/lang/MetaClassImpl.java --- @@ -945,6 +945,15 @@ private Object invokeMissingMethod(Object instance, String methodName, Object[] onInvokeMethodFoundInHierarchy(method); return method.invoke(instance, invokeMethodArgs); } + +// last resort look in the category +if (method == null && GroovyCategorySupport.hasCategoryInCurrentThread()) { +method = getCategoryMethodMissing(instanceKlazz); +if (method != null) { +//TODO add onMethodMissingFound(method) --- End diff -- I see a `TODO` here. Are you going to refine it later? ---
[GitHub] groovy pull request #:
Github user danielsun1106 commented on the pull request: https://github.com/apache/groovy/commit/aa1ad8fe2ab2c37a0b95215e692e73bdc37297f7#commitcomment-28806379 weird... I have not contributed such a change, but the author is me... ---
[GitHub] groovy pull request #691: Support java-like array
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/691 Support java-like array ## Background In order to improve the compatibility with Java(Copy & Paste), Java array is one of features widely applied in Java projects. The PR will make Groovy support java-like array. Here are [some tests](https://github.com/danielsun1106/groovy/blob/f20deb8bd6a1a90a4bfee8458e13438f7adf3732/subprojects/parser-antlr4/src/test/resources/core/Array_02x.groovy) for reference. ## Known breaking changes ### 1. `Closure` array Original ``` Closure[] y = { {-> 1 + 1 } } assert y[0].call().call() == 2 ``` Current ``` Closure[] y = { {-> 1 + 1 } } assert y[0].call() == 2 ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy java-array Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/691.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #691 commit f20deb8bd6a1a90a4bfee8458e13438f7adf3732 Author: Daniel Sun Date: 2018-04-26T07:59:08Z Support java-like array ---