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

Bootstrap failure: wrong static initializer of inner class #751

Closed
odersky opened this issue Aug 7, 2015 · 0 comments
Closed

Bootstrap failure: wrong static initializer of inner class #751

odersky opened this issue Aug 7, 2015 · 0 comments
Assignees

Comments

@odersky
Copy link
Contributor

odersky commented Aug 7, 2015

If I compile everything in src/dotty and run the resulting program without arguments I get:

dotc
Exception in thread "main" java.lang.NoSuchMethodError: dotty.tools.dotc.ast.Trees$Instance$TreeMap$: method ()V not found
at dotty.tools.dotc.ast.Trees$Instance$TreeMap$.(Trees.scala)
at dotty.tools.dotc.ast.Trees$Instance.(Trees.scala:1087)
at dotty.tools.dotc.ast.untpd$.(untpd.scala:13)
at dotty.tools.dotc.ast.untpd$.(untpd.scala)
at dotty.tools.dotc.core.Contexts$InitialContext.(Contexts.scala:467)
at dotty.tools.dotc.core.Contexts$ContextBase.(Contexts.scala:493)

Investigation with javap shows that TreeMap has a static initializer which tries to create a TreeMap object with an empty constructor. But TreeMap is an inner class, so the constructor takes an outer pointer.

Compiled from "Trees.scala"
public final class dotty.tools.dotc.ast.Trees$Instance$TreeMap$ {
public static final dotty.tools.dotc.ast.Trees$Instance$TreeMap$ MODULE$;

public static {};
Code:
0: new #2 // class dotty/tools/dotc/ast/Trees$Instance$TreeMap$
3: invokespecial #23 // Method "":()V
6: return

public dotty.tools.dotc.ast.Trees$Instance$TreeMap$(dotty.tools.dotc.ast.Trees$Instance);
Code:

The whole static initializer seems to be a random artefact, since TreeMap does not have a companion object.

Edit: No, it does have a synthetic companion object (which contains default arguments). But since it's an inner class of the outer class Instance it should not have a static initializer that creates an instance, it seems to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants