groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleitner <...@git.apache.org>
Subject [GitHub] groovy pull request #420: GROOVY-7940: @Lazy not generating "is" property ac...
Date Sat, 17 Sep 2016 22:59:31 GMT
Github user jwagenleitner commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/420#discussion_r79293601
  
    --- Diff: src/main/org/codehaus/groovy/transform/LazyASTTransformation.java ---
    @@ -156,8 +156,11 @@ private static void addNonThreadSafeBody(BlockStatement body, FieldNode
fieldNod
         private static void addMethod(FieldNode fieldNode, BlockStatement body, ClassNode
type) {
             int visibility = ACC_PUBLIC;
             if (fieldNode.isStatic()) visibility |= ACC_STATIC;
    -        final String name = "get" + MetaClassHelper.capitalize(fieldNode.getName().substring(1));
    -        fieldNode.getDeclaringClass().addMethod(name, visibility, type, Parameter.EMPTY_ARRAY,
ClassNode.EMPTY_ARRAY, body);
    +        String propName = MetaClassHelper.capitalize(fieldNode.getName().substring(1));
    +        fieldNode.getDeclaringClass().addMethod("get" + propName, visibility, type, Parameter.EMPTY_ARRAY,
ClassNode.EMPTY_ARRAY, body);
    +        if (ClassHelper.boolean_TYPE.equals(type)) {
    +            fieldNode.getDeclaringClass().addMethod("is" + propName, visibility, type,
Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, body);
    --- End diff --
    
    Thanks, I've updated so it delegates to the getter as suggested.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message