groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (GROOVY-6349) Static type checking error when accessing class of a primitive type
Date Thu, 06 Oct 2016 22:51:20 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-6349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul King resolved GROOVY-6349.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 2.4.1

> Static type checking error when accessing class of a primitive type
> -------------------------------------------------------------------
>
>                 Key: GROOVY-6349
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6349
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.1.7, 2.3.0, 2.4.0-beta-3
>            Reporter: Rodolfo Cruz
>             Fix For: 2.4.1
>
>         Attachments: TestCases.groovy
>
>
> There is an inconsistency between the behaviour in runtime and in the static type checker
when accessing the class of a Java primitive type. Suppose we have the following code:
> {code}
> void runMethod (){
> int i = 10
> println(i.class)
> }
> runMethod()
> {code}
> If I run this in the Groovy console everything runs fine, autoboxing is performed and
'class java.lang.Integer' is printed as the output. However, if I annotate the method with
@groovy.transform.TypeChecked, there is an exception stating '[Static type checking] - No
such property: class for class: int'. The same happens if I don't declare a variable and try
to use a literal int instead.
> As far as I know, this happens with all the primitive types. In addition, trying to access
their metaClass works well with or without the type checking enabled.
> I attach some of the examples I could come up with.



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

Mime
View raw message