Skip to content

Confusing warnings for inferred flexible types in public methods #24440

@flomebul

Description

@flomebul

Compiler version

3.7.4

Minimized code

//> using scala 3.7.4
//> using options-Yexplicit-nulls -Werror

trait AwtComponentLogging extends java.awt.Component, com.typesafe.scalalogging.StrictLogging:

  override def getPreferredSize: java.awt.Dimension =
    logger.trace("enter")
    val dim: java.awt.Dimension = super.getPreferredSize
    logger.trace("exit")
    dim

Output

method AwtComponentLogging$$super$getPreferredSize exposes a flexible type in its inferred result type (java.awt.Dimension)?. Consider annotating the type explicitly
    val dim: java.awt.Dimension = super.getPreferredSize

Expectation

No warning like in scala 3.7.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions