diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-08-01 15:07:18 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-08-01 15:14:13 -0700 |
commit | f5c939e3af56755f16053ce434ed6a91f47ca852 (patch) | |
tree | ec2e5c534e358e9ef422bc69e57cb25b21d8071f /src/compiler/scala/tools/nsc/javac/JavaParsers.scala | |
parent | 5eb19785c3d89b21919725a46375324890e993e7 (diff) | |
download | scala-f5c939e3af56755f16053ce434ed6a91f47ca852.tar.gz scala-f5c939e3af56755f16053ce434ed6a91f47ca852.tar.bz2 scala-f5c939e3af56755f16053ce434ed6a91f47ca852.zip |
Javadoc: ignore comments when deciding where to put interface methods
Diffstat (limited to 'src/compiler/scala/tools/nsc/javac/JavaParsers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 01ca8033ac..e1e14d9016 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -586,7 +586,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { case CLASS | ENUM | INTERFACE | AT => typeDecl(if (definesInterface(parentToken)) mods | Flags.STATIC else mods) case _ => - joinComment(termDecl(mods, parentToken)) + termDecl(mods, parentToken) } def makeCompanionObject(cdef: ClassDef, statics: List[Tree]): Tree = @@ -726,8 +726,15 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { in.nextToken() } else { if (in.token == ENUM || definesInterface(in.token)) mods |= Flags.STATIC - val decls = memberDecl(mods, parentToken) - (if (mods.hasStaticFlag || inInterface && !(decls exists (_.isInstanceOf[DefDef]))) + val decls = joinComment(memberDecl(mods, parentToken)) + + def isDefDef(tree: Tree): Boolean = tree match { + case _: DefDef => true + case DocDef(_, defn) => isDefDef(defn) + case _ => false + } + + (if (mods.hasStaticFlag || inInterface && !(decls exists isDefDef)) statics else members) ++= decls |