groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7952) Property expressions for extension methods starting with 'is' fail STC
Date Thu, 06 Oct 2016 03:28:20 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15550742#comment-15550742
] 

ASF GitHub Bot commented on GROOVY-7952:
----------------------------------------

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

    https://github.com/apache/groovy/pull/436#discussion_r82111762
  
    --- Diff: src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
---
    @@ -158,19 +158,24 @@ public void makeGetPropertySite(Expression receiver, final String
methodName, fi
     
             // GROOVY-5580, it is still possible that we're calling a superinterface property
             String getterName = "get" + MetaClassHelper.capitalize(methodName);
    +        String altGetterName = "is" + MetaClassHelper.capitalize(methodName);
             if (receiverType.isInterface()) {
                 Set<ClassNode> allInterfaces = receiverType.getAllInterfaces();
                 MethodNode getterMethod = null;
                 for (ClassNode anInterface : allInterfaces) {
                     getterMethod = anInterface.getGetterMethod(getterName);
    -                if (getterMethod!=null) break;
    +                if (getterMethod == null) getterMethod = anInterface.getGetterMethod(altGetterName);
    +                if (getterMethod != null) break;
                 }
                 // GROOVY-5585
    -            if (getterMethod==null) {
    +            if (getterMethod == null) {
                     getterMethod = OBJECT_TYPE.getGetterMethod(getterName);
                 }
    +            if (getterMethod == null) {
    +                getterMethod = OBJECT_TYPE.getGetterMethod(altGetterName);
    --- End diff --
    
    There are no isXxx methods in Object? Is this needed?


> Property expressions for extension methods starting with 'is' fail STC
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-7952
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7952
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.4.7
>            Reporter: Shil Sinha
>            Assignee: Shil Sinha
>             Fix For: 2.4.8
>
>
> Example:
> {code}
> import groovy.transform.TypeChecked
> void test() {
>     assert !'abc'.allWhitespace
> }
> {code}
> The code above fails static type checking with the following error:
> {code}
> [Static type checking] - No such property: allWhitespace for class: java.lang.String
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message