Skip to content

java.lang.IllegalAccessError when matching refined type in App #5134

Closed
@scabug

Description

@scabug
scala> object Test extends App {
     |   def b= new AnyRef {
     |     def a= ()
     |   }
     |   b.a match { case _ => () }
     | }
defined module Test

scala> Test
java.lang.IllegalAccessError: tried to access field Test$.reflParams$Cache1 from class Test$delayedInit$body
	at Test$delayedInit$body.<clinit>(<console>:11)
	at Test$.<init>(<console>:7)
	at Test$.<clinit>(<console>)
	at .<init>(<console>:9)
	at .<clinit>(<console>)
	at .<init>(<console>:11)
	at .<clinit>(<console>)
	at $export(<console>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:592)
	at scala.tools.nsc.interpreter.IMain$Request$$anonfun$10.apply(IMain.scala:828)
	at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
	at scala.tools.nsc.io.package$$anon$2.run(package.scala:31)
	at java.lang.Thread.run(Thread.java:662)

The same exception is thrown if the code is compiled and run.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions