Skip to content

False positives on dropped bridge method forwarders #388

Open
@dwijnand

Description

@dwijnand

scala/scala#6531 for Scala 2.13.0 and its backport scala/scala#7469 for Scala 2.12.8 causes MiMa users that upgrade Scala versions to get false positive problems like this (from https://travis-ci.org/twitter/algebird/jobs/586131912):

[error]  * static method one()java.lang.Object in class com.twitter.algebird.JFloatRing does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("com.twitter.algebird.JFloatRing.one")
[error]  * static method zero()java.lang.Object in class com.twitter.algebird.JFloatRing does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("com.twitter.algebird.JFloatRing.zero")

Here's a summary of the change. Given:

class A[T] {
  def get: T = ???
}

object T extends A[String] {
  override def get: String = "hi"
}

the class that extends A has the method

public get()Ljava/lang/String;

and also the bridge method

public bridge get()Ljava/lang/Object;

that calls the previous method.

But given T is an object it also gets a static forward for get, so it can be called from Java. Previously it was forwarding both methods, now it's only forwarding the one that's actually ever used.

MiMa could also handle this case by not emitting a problem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions