You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2023/02/06 21:17:00 UTC

[jira] [Created] (GROOVY-10928) Invalid stub code for interface field

Christopher Smith created GROOVY-10928:
------------------------------------------

             Summary: Invalid stub code for interface field
                 Key: GROOVY-10928
                 URL: https://issues.apache.org/jira/browse/GROOVY-10928
             Project: Groovy
          Issue Type: Bug
          Components: Stub generator / Joint compiler
    Affects Versions: 4.0.8
            Reporter: Christopher Smith


When compiling this interface:

{code:groovy}
@CompileStatic
interface Service {
  TypeReference<Map<String, Object>> STATE_TYPE_MAP = new TypeReference<Map<String, Object>>(){}
}
{code}

the stub generator produces code that does not compile under Java 11:

{code:java}
@groovy.transform.CompileStatic() public interface Service
<T> {
;
com.fasterxml.jackson.core.type.TypeReference<java.util.Map<java.lang.String, java.lang.Object>> STATE_TYPE_MAP;
static { STATE_TYPE_MAP = null; }
{code}

{code}
[ERROR] Service.java:[6,112] = expected
[ERROR] Service.java:[7,8] initializers not allowed in interfaces
{code}




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