Skip to content

Missing generic type in JVM signature of public field #17069

Closed
@christian-mibex

Description

@christian-mibex

Compiler version

3.2.2

Minimized code

//> using scala "3.2.2"
//> using repository "https://maven.atlassian.com/repository/public"
//> using lib "com.atlassian.bitbucket.server:bitbucket-rest-model:7.14.0"

import com.atlassian.bitbucket.rest.repository.RestRepository
import scala.beans.BeanProperty

case class SomeRequest(
    @BeanProperty var repos: java.util.List[RestRepository]
)

Output

Partial output of scalap -c -p

// public class generic_java_type$u002Esc$SomeRequest implements scala.Product,java.io.Serializable {
//   private java.util.List repos;
//   public java.util.List<com.atlassian.bitbucket.rest.repository.RestRepository> repos();
//     Code:
//        0: aload_0
//        1: getfield      #39                 // Field repos:Ljava/util/List;
//        4: areturn```

Expectation

Scala 2 and Java add the generic type of the java.util.List to the repos field. Changing the version //> scala 2 in the code above produces:

// public class generic_java_type$u002Esc$SomeRequest implements scala.Product,java.io.Serializable {
//   private java.util.List<com.atlassian.bitbucket.rest.repository.RestRepository> repos;
//   public java.util.List<com.atlassian.bitbucket.rest.repository.RestRepository> repos();
//     Code:
//        0: aload_0
//        1: getfield      #28                 // Field repos:Ljava/util/List;
//        4: areturn

We got hit by this when Jackson was unable to deserialize the class correctly because it could not reflect on the type of the list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions