Skip to content

Cyclic reference involving class ClassSpecializer #18392

Open
@anjunar

Description

@anjunar

Compiler version

3.3.1-RC3 and latest Java version

Minimized code

  def inspect[T <: Untyped]() : mutable.Set[PackageStatement[T]] = {
    val classpath = System.getProperty("java.class.path")
    val classpathEntries = classpath.split(System.getProperty("path.separator"))

    val files : mutable.Set[String] = new mutable.HashSet[String]()
    val jars : mutable.Set[String] = new mutable.HashSet[String]()

    for (entry <- classpathEntries) {
      FileUtils.listFiles(new File(entry), Array("jar", "tasty"), true).forEach((file) => {
        val extension : String = FilenameUtils.getExtension(file.getAbsolutePath)

        if (extension.equals("tasty")) {
          files.add(file.getAbsolutePath)
        } else {
          jars.add(file.getAbsolutePath)
        }
      })
    }

    val tasties : mutable.Set[PackageStatement[T]] = new mutable.HashSet[PackageStatement[T]]()

    TastyInspector.inspectAllTastyFiles(files.toList, jars.toList, classpathEntries.toList)(new Inspector {
      override def inspect(using q: Quotes)(tastys: List[Tasty[quotes.type]]): Unit = {
        given Contexts.Context = q.asInstanceOf[QuotesImpl].ctx

        val results = tastys.map(tasty => tasty.ast match
          case packageDef: PackageDef[T] => PackageStatement[T](packageDef)
        )

        tasties.addAll(results)
      }
    })

    tasties
  }

Code: https://github.com/anjunar/reflections

Expectation

The Java Implementation of ClassSpecializer in the JVM should not produce this kind of Error

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