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

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

eric-milles opened a new pull request, #2200:
URL: https://github.com/apache/groovy/pull/2200

   In case of references to external constants, `StaticCompilationVisitor` 
could replace constant arithmetic with methods calls before `Verifier` has a 
chance to fully inline.




> 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 (pulled in as byte code from a jar dependency)
>  
> {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. When I compile my groovy class with the 
> java jar in the dependency path,
>  
> {code:groovy}
> 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