inlined given resulting in runtime error java.lang.NoSuchFieldError: $outer
See original GitHub issueCompiler version
v3.0.2-RC1 (also tried on master branch)
Minimized code
trait DFC
given DFC = new DFC {}
trait TC
object TC:
def foo()(using DFC): Unit = {}
inline given (using DFC): TC = new TC:
foo()
class Foo(using DFC):
summon[TC]
val top = new Foo
Output
See scastie: https://scastie.scala-lang.org/yZG6miffRf6f4O6od68i2w
java.lang.NoSuchFieldError: $outer
at Playground$$anon$2.<init>(main.scala:11)
at Playground$Foo.<init>(main.scala:11)
at Playground$.<clinit>(main.scala:16)
at Main$.<clinit>(main.scala:20)
at Main.main(main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.Run.invokeMain(Run.scala:133)
at sbt.Run.execute$1(Run.scala:82)
at sbt.Run.$anonfun$runWithLoader$5(Run.scala:110)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:17)
at sbt.TrapExit$App.run(TrapExit.scala:258)
at java.lang.Thread.run(Thread.java:748)
Expectation
No runtime error.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Resolve the NoSuchFieldError in Java
The NoSuchFieldError error occurs if an application tries to access or modify a specified field of an object, and the object no longer...
Read more >debugging - NoSuchFieldError Java
When I try to access the field m_metatable in 'Part' I get this error, which is odd since the field ins't accessed a...
Read more >RuntimeException
java.util.concurrent ... DirectoryIteratorException, Runtime exception thrown if an I/O error is encountered when iterating over the entries in a directory.
Read more >NoSuchFieldError in Java
Finally, LinkageError extends Error and shows that a class has some dependency on another incompatibly changed class.
Read more >aosp/platform/external/libchrome
-12,9 +12,10 @@ # See the License for the specific language ... So for others - // tcmalloc will give a general error...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems inlining local classes has lots of problems. Can we outlaw it completely?
After #14568 the “bad type problem” is fixed. But we now get a new problem for the original code from @soronpo:
I verified that the same error occurs even without #14568 if we disable the “bad type problem” check.