@@ -120,12 +120,13 @@ object JavaParsers {
120120 // can call it.
121121 // This also avoids clashes between the constructor parameter names and member names.
122122 if (needsDummyConstr) {
123- if (constr1 == EmptyTree ) constr1 = makeConstructor(List (), Nil )
123+ if (constr1 == EmptyTree ) constr1 = makeConstructor(List (), Nil , Parsers .unimplementedExpr )
124124 stats1 = constr1 :: stats1
125- constr1 = makeConstructor(List (scalaDot(tpnme.Unit )), tparams, Flags .JavaDefined | Flags .PrivateLocal )
125+ constr1 =
126+ makeConstructor(List (scalaDot(tpnme.Unit )), tparams, EmptyTree , Flags .JavaDefined | Flags .PrivateLocal )
126127 }
127128 else if (constr1 == EmptyTree ) {
128- constr1 = makeConstructor(List (), tparams)
129+ constr1 = makeConstructor(List (), tparams, EmptyTree )
129130 }
130131 Template (constr1.asInstanceOf [DefDef ], parents, Nil , EmptyValDef , stats1)
131132 }
@@ -135,9 +136,9 @@ object JavaParsers {
135136 def makeParam (name : TermName , tpt : Tree ): ValDef =
136137 ValDef (name, tpt, EmptyTree ).withMods(Modifiers (Flags .JavaDefined | Flags .Param ))
137138
138- def makeConstructor (formals : List [Tree ], tparams : List [TypeDef ], flags : FlagSet = Flags .JavaDefined ): DefDef = {
139+ def makeConstructor (formals : List [Tree ], tparams : List [TypeDef ], body : Tree , flags : FlagSet = Flags .JavaDefined ): DefDef = {
139140 val vparams = formals.zipWithIndex.map { case (p, i) => makeSyntheticParam(i + 1 , p).withMods(Modifiers (flags)) }
140- DefDef (nme.CONSTRUCTOR , joinParams(tparams, List (vparams)), TypeTree (), EmptyTree ).withMods(Modifiers (flags))
141+ DefDef (nme.CONSTRUCTOR , joinParams(tparams, List (vparams)), TypeTree (), body ).withMods(Modifiers (flags))
141142 }
142143
143144 // ------------- general parsing ---------------------------
@@ -750,7 +751,7 @@ object JavaParsers {
750751 atSpan(cdef.span) {
751752 assert(cdef.span.exists)
752753 ModuleDef (cdef.name.toTermName,
753- makeTemplate(List (), statics, List (), false )).withMods((cdef.mods & Flags .RetainedModuleClassFlags ).toTermFlags)
754+ makeTemplate(List (), statics, List (), needsDummyConstr = false )).withMods((cdef.mods & Flags .RetainedModuleClassFlags ).toTermFlags)
754755 }
755756
756757 def addCompanionObject (statics : List [Tree ], cdef : TypeDef ): List [Tree ] =
@@ -821,7 +822,7 @@ object JavaParsers {
821822 val interfaces = interfacesOpt()
822823 val (statics, body) = typeBody(CLASS , name, tparams)
823824 val cls = atSpan(start, nameOffset) {
824- TypeDef (name, makeTemplate(superclass :: interfaces, body, tparams, true )).withMods(mods)
825+ TypeDef (name, makeTemplate(superclass :: interfaces, body, tparams, needsDummyConstr = true )).withMods(mods)
825826 }
826827 addCompanionObject(statics, cls)
827828 }
@@ -864,7 +865,7 @@ object JavaParsers {
864865 parents = superclass :: interfaces,
865866 stats = canonicalConstructor :: accessors ::: body,
866867 tparams = tparams,
867- true
868+ needsDummyConstr = true
868869 )
869870 ).withMods(mods)
870871 }
@@ -887,7 +888,7 @@ object JavaParsers {
887888 val iface = atSpan(start, nameOffset) {
888889 TypeDef (
889890 name,
890- makeTemplate(parents, body, tparams, false )).withMods(mods | Flags .JavaInterface )
891+ makeTemplate(parents, body, tparams, needsDummyConstr = false )).withMods(mods | Flags .JavaInterface )
891892 }
892893 addCompanionObject(statics, iface)
893894 }
@@ -940,7 +941,7 @@ object JavaParsers {
940941 }
941942 val constr = DefDef (nme.CONSTRUCTOR ,
942943 List (constructorParams), TypeTree (), EmptyTree ).withMods(Modifiers (Flags .JavaDefined ))
943- val templ = makeTemplate(annotationParents, constr :: body, List (), true )
944+ val templ = makeTemplate(annotationParents, constr :: body, List (), needsDummyConstr = true )
944945 val annot = atSpan(start, nameOffset) {
945946 TypeDef (name, templ).withMods(mods | Flags .JavaInterface | Flags .JavaAnnotation )
946947 }
@@ -992,7 +993,7 @@ object JavaParsers {
992993 Select (New (javaLangDot(tpnme.Enum )), nme.CONSTRUCTOR ), List (enumType)), Nil )
993994 val enumclazz = atSpan(start, nameOffset) {
994995 TypeDef (name,
995- makeTemplate(superclazz :: interfaces, body, List (), true )).withMods(mods | Flags .JavaEnum )
996+ makeTemplate(superclazz :: interfaces, body, List (), needsDummyConstr = true )).withMods(mods | Flags .JavaEnum )
996997 }
997998 addCompanionObject(consts ::: statics ::: predefs, enumclazz)
998999 }
0 commit comments