[jira] [Resolved] (GROOVY-8898) Annotation value cannot take inline constant from enum.

2018-12-05 Thread Paul King (JIRA)


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

Paul King resolved GROOVY-8898.
---
   Resolution: Fixed
 Assignee: Paul King
Fix Version/s: 2.5.5
   3.0.0-alpha-4

Annotation constants can be primitives, Strings and enum constants. We had 
special logic to detect the enum constants case but it meant primitive and 
String constants within enums were skipped over. Should be fixed in the 
upcoming releases.

> Annotation value cannot take inline constant from enum.
> ---
>
> Key: GROOVY-8898
> URL: https://issues.apache.org/jira/browse/GROOVY-8898
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.4
> Environment:  - Windows 10 
>  - IntelliJ Idea 2018
>Reporter: Dmitrii Samotsvet
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> I've had enum MyProfiles
>  
> {code:java}
> public enum MyProfiles {
> /**some code is here
> */
> public final static String FIRST_PROFILE = "FIRST";
> public final static String SECOND_PROFILE = "SECOND";
> }
> {code}
> And I've used next code in Spock test
>  
>  
> {code:java}
> @ActiveProfiles([FIRST_PROFILE ,SECOND_PROFILE ])
> {code}
>  
> So, I've got next error at compile time
> Error: Groovyc: Expected 'MyProfiles.FIRST_PROFILE' to be an inline constant 
> of type java.lang.String not a property expression in 
> @org.springframework.test.context.ActiveProfiles
> Error: Groovyc:Attribute 'value' should have type java.lang.String but found 
> type java.lang.Object in @org.springframework.test.context.ActiveProfiles
>  
> But it works if I use 'class' instead of 'enum'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (GROOVY-8909) List literal type inference does not take its context into account

2018-12-05 Thread Daniil Ovchinnikov (JIRA)
Daniil Ovchinnikov created GROOVY-8909:
--

 Summary: List literal type inference does not take its context 
into account
 Key: GROOVY-8909
 URL: https://issues.apache.org/jira/browse/GROOVY-8909
 Project: Groovy
  Issue Type: Bug
  Components: Static Type Checker
Affects Versions: 2.5.4
Reporter: Daniil Ovchinnikov


{code:title=bug.groovy}
def methodAcceptingListOfObjects(List lo) {}

@groovy.transform.CompileStatic
def usage() {
methodAcceptingListOfObjects([1, 2, 3]) 
}
{code}
Compilation fails with
{noformat}
[Static type checking] - Cannot call 
#methodAcceptingListOfObjects(java.util.List ) with arguments 
[java.util.List ]
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)