diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-07-22 18:34:47 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-08-13 13:26:50 +1000 |
commit | ad67700b1cc685f115da14a5af759b8859f1e9c2 (patch) | |
tree | ce4b1028ddc45281d9e87be8508e7a7204a3eeb3 /src/compiler/scala/tools/nsc/javac | |
parent | 4e822d74be9c21377189428ca474ec990af6cc87 (diff) | |
download | scala-ad67700b1cc685f115da14a5af759b8859f1e9c2.tar.gz scala-ad67700b1cc685f115da14a5af759b8859f1e9c2.tar.bz2 scala-ad67700b1cc685f115da14a5af759b8859f1e9c2.zip |
Javadoc: fix problems in community build
- fix initialization NPE in doc headers
- fix assertion errors for java fields
- ignore comments when deciding where to put interface methods
- consider DocDefs when checking for constructors
Diffstat (limited to 'src/compiler/scala/tools/nsc/javac')
-rw-r--r-- | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 22460b6ca8..e4bc055da4 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -117,11 +117,8 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { atPos(pkg.pos) { PackageDef(pkg, stats) } def makeTemplate(parents: List[Tree], stats: List[Tree]) = - Template( - parents, - noSelfType, - if (treeInfo.firstConstructor(stats) == EmptyTree) makeConstructor(List()) :: stats - else stats) + Template(parents, noSelfType, if (treeInfo.firstConstructor(stats) == EmptyTree) + makeConstructor(Nil) :: stats else stats) def makeSyntheticParam(count: Int, tpt: Tree): ValDef = makeParam(nme.syntheticParamName(count), tpt) @@ -586,7 +583,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 = @@ -708,8 +705,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 |