Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/420#discussion_r79292382
  
    --- 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 --
    
    I'd probably use 'stmt(callThisX("get" + propName))' instead of 'body'. 
That should give a slightly smaller class.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to