Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get a surface of a class with a protected constructor in Scala 3 #3419

Closed
OndrejSpanel opened this issue Feb 27, 2024 · 1 comment · Fixed by #3423
Closed

Unable to get a surface of a class with a protected constructor in Scala 3 #3419

OndrejSpanel opened this issue Feb 27, 2024 · 1 comment · Fixed by #3423

Comments

@OndrejSpanel
Copy link
Contributor

airframe-surface ver. 24.2.2, Scala 3.3.2

import wvlet.airframe.surface.Surface

import scala.collection.immutable.Queue

object Main {
  case class S(q: Queue[String])

  Surface.of[S]

  def main(args: Array[String]): Unit = {

  }
}

Fails with error

constructor Queue cannot be accessed as a member of scala.collection.immutable.Queue[String] from module class Main$.
Access to protected constructor Queue not permitted because enclosing object Main
is not a subclass of class Queue in package scala.collection.immutable where target is defined

Reduced repro:

  class Q protected {}

  Surface.of[Q]

There is no issue when the constructor is private.

@OndrejSpanel
Copy link
Contributor Author

OndrejSpanel commented Feb 27, 2024

Package private constructor has the same issue:

  object Obj {
    class Q private[Obj] {}
  }

  Surface.of[Obj.Q]

constructor Q cannot be accessed as a member of Main.Obj.Q from module class Main$.

@OndrejSpanel OndrejSpanel changed the title Unable to get surface of a class which parameter uses a protected constructor in Scala 3 Unable to get a surface of a class with a protected constructor in Scala 3 Feb 27, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Feb 28, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Feb 28, 2024
xerial added a commit that referenced this issue Feb 28, 2024
…cess (#3423)

Starting with tests - I hope I will be able to implement the fix as
well.

---------

Co-authored-by: Taro L. Saito <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant