diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-08-09 16:18:16 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-08-13 13:25:34 +1000 |
commit | 4e822d74be9c21377189428ca474ec990af6cc87 (patch) | |
tree | c7fc4bcb478cf6d1838b5807a720f33a73768aba /src/compiler/scala/tools/nsc/javac | |
parent | 4b77734b28f82e2573446bd997e739b80de4af1d (diff) | |
download | scala-4e822d74be9c21377189428ca474ec990af6cc87.tar.gz scala-4e822d74be9c21377189428ca474ec990af6cc87.tar.bz2 scala-4e822d74be9c21377189428ca474ec990af6cc87.zip |
Javadoc: java static name resolution
[Jakob Odersky <jodersky@gmail.com>: remove obsolete comments and fix tests]
Diffstat (limited to 'src/compiler/scala/tools/nsc/javac')
-rw-r--r-- | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 01ca8033ac..22460b6ca8 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -600,26 +600,8 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { Import(Ident(cdef.name.toTermName), ImportSelector.wildList) } - // Importing the companion object members cannot be done uncritically: see - // ticket #2377 wherein a class contains two static inner classes, each of which - // has a static inner class called "Builder" - this results in an ambiguity error - // when each performs the import in the enclosing class's scope. - // - // To address this I moved the import Companion._ inside the class, as the first - // statement. This should work without compromising the enclosing scope, but may (?) - // end up suffering from the same issues it does in scala - specifically that this - // leaves auxiliary constructors unable to access members of the companion object - // as unqualified identifiers. - def addCompanionObject(statics: List[Tree], cdef: ClassDef): List[Tree] = { - def implWithImport(importStmt: Tree) = deriveTemplate(cdef.impl)(importStmt :: _) - // if there are no statics we can use the original cdef, but we always - // create the companion so import A._ is not an error (see ticket #1700) - val cdefNew = - if (statics.isEmpty) cdef - else deriveClassDef(cdef)(_ => implWithImport(importCompanionObject(cdef))) - - List(makeCompanionObject(cdefNew, statics), cdefNew) - } + def addCompanionObject(statics: List[Tree], cdef: ClassDef): List[Tree] = + List(makeCompanionObject(cdef, statics), cdef) def importDecl(): List[Tree] = { accept(IMPORT) |