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

Saravanan commented on GROOVY-11624:
------------------------------------

{quote}I think order of operations is your greatest hurdle here.
{quote}
I am not sure what you mean here. The Java code is compiled into byte code 
(assume I am pulling the Java class from a jar dependency)
{quote}It is javac that gives the error "error: element value must be a 
constant expression".
{quote}
Where is JavaC running for this error to show up? To be clear, 
MyDefinitionInJava is a java class from a jar file. The other stuff is groovy 
using it

> Unable to use statically imported const string in annotation
> ------------------------------------------------------------
>
>                 Key: GROOVY-11624
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11624
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation
>    Affects Versions: 5.0.0-alpha-12
>            Reporter: Saravanan
>            Assignee: Eric Milles
>            Priority: Minor
>
> I have a java class defined
>  
> {code:java}
> package com.org.nativecompiler.cli;
> public final class MyDefinitionInJava {
>     public static final String MYTEXTINJAVA = "asdsad";
> }
> {code}
> I am using this in my Groovy class
>  
> {code:java}
> import static com.org.nativecompiler.cli.MyDefinitionInJava.MYTEXTINJAVA;
> public interface Interfaces {
>     String OTHERTEXT = MYTEXTINJAVA + "1234";
>     @Deprecated(since = OTHERTEXT)
>     public interface InnerClass {
>     }
> }
> {code}
> I get a compile error (in comple static mode) in the use of OTHERTEXT
>     Expected 
> 'com.org.nativecompiler.cli.MyDefinitionInJava.MYTEXTINJAVA.plus(1234)' to be 
> an inline constant of type java.lang.String in @java.lang.Deprecated
> This seems to be an issue only if I static import it. This works if I use 
> MyDefintionInJava.MYTEXTINJAVA directly



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to