[
https://issues.apache.org/jira/browse/GROOVY-11624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-11624.
----------------------------------
Fix Version/s: 5.0.0-alpha-13
Resolution: Fixed
> 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
> Fix For: 5.0.0-alpha-13
>
>
> 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)