Skip to content

Commit e1586bc

Browse files
committed
Don't interpreter $init$ as a constructor when parsing Java files.
Fixes #851.
1 parent baaf522 commit e1586bc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ object JavaParsers {
114114

115115
def makeTemplate(parents: List[Tree], stats: List[Tree], tparams: List[TypeDef], needsDummyConstr: Boolean) = {
116116
def pullOutFirstConstr(stats: List[Tree]): (Tree, List[Tree]) = stats match {
117-
case (meth: DefDef) :: rest if meth.name.isConstructorName => (meth, rest)
117+
case (meth: DefDef) :: rest if meth.name == CONSTRUCTOR => (meth, rest)
118118
case first :: rest =>
119119
val (constr, tail) = pullOutFirstConstr(rest)
120120
(constr, first :: tail)

tests/pos/i851.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
interface I<T> {}
2+
3+
interface J<T> extends I<T> {
4+
default void $init$() {
5+
};
6+
}
7+
8+
class C<T> extends J<T> {}

0 commit comments

Comments
 (0)