diff options
Diffstat (limited to 'src')
21 files changed, 73 insertions, 74 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index 64146585e5..c0e0240210 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -9,6 +9,7 @@ package backend package icode import scala.collection.{ mutable, immutable } +import scala.reflect.internal.Flags import scala.reflect.internal.util.{ SourceFile, NoSourceFile } trait ReferenceEquality { @@ -217,7 +218,7 @@ trait Members { /** Is this method deferred ('abstract' in Java sense)? */ - def isAbstractMethod = symbol.isDeferred || symbol.owner.isInterface || native + def isAbstractMethod = symbol.isDeferred || (symbol.owner.isInterface && !symbol.hasFlag(Flags.JAVA_DEFAULTMETHOD)) || native def isStatic: Boolean = symbol.isStaticMember diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index 075a44ca22..9875ade113 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -581,10 +581,10 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { } val isNative = methSymbol.hasAnnotation(definitions.NativeAttr) - val isAbstractMethod = (methSymbol.isDeferred || methSymbol.owner.isInterface) + val isAbstractMethod = (methSymbol.isDeferred || methSymbol.owner.isInterface) && !methSymbol.hasFlag(Flags.JAVA_DEFAULTMETHOD) val flags = GenBCode.mkFlags( javaFlags(methSymbol), - if (claszSymbol.isInterface) asm.Opcodes.ACC_ABSTRACT else 0, + if (isAbstractMethod) asm.Opcodes.ACC_ABSTRACT else 0, if (methSymbol.isStrictFP) asm.Opcodes.ACC_STRICT else 0, if (isNative) asm.Opcodes.ACC_NATIVE else 0 // native methods of objects are generated in mirror classes ) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala index 8cccc50c69..df34326bbf 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala @@ -576,7 +576,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { import asm.Opcodes._ GenBCode.mkFlags( if (privateFlag) ACC_PRIVATE else ACC_PUBLIC, - if (sym.isDeferred || sym.hasAbstractFlag) ACC_ABSTRACT else 0, + if ((sym.isDeferred && !sym.hasFlag(symtab.Flags.JAVA_DEFAULTMETHOD))|| sym.hasAbstractFlag) ACC_ABSTRACT else 0, if (sym.isInterface) ACC_INTERFACE else 0, if (finalFlag && !sym.hasAbstractFlag) ACC_FINAL else 0, if (sym.isStaticMember) ACC_STATIC else 0, diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 7883ce7ffa..61abc55501 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -1395,10 +1395,11 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self => var resTpe: asm.Type = javaType(m.symbol.tpe.resultType) if (m.symbol.isClassConstructor) resTpe = asm.Type.VOID_TYPE + val isAbstractTraitMeth = isJInterface && !m.symbol.hasFlag(Flags.JAVA_DEFAULTMETHOD) val flags = mkFlags( javaFlags(m.symbol), - if (isJInterface) asm.Opcodes.ACC_ABSTRACT else 0, + if (isAbstractTraitMeth) asm.Opcodes.ACC_ABSTRACT else 0, if (m.symbol.isStrictFP) asm.Opcodes.ACC_STRICT else 0, if (method.native) asm.Opcodes.ACC_NATIVE else 0, // native methods of objects are generated in mirror classes if(isDeprecated(m.symbol)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo access flag diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 53a1347a48..998f0b22cb 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -697,7 +697,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { else debuglog("conflicting env for " + m + " env: " + env) } - else if (m.isDeferred) { // abstract methods + else if (m.isDeferred && m.isSpecialized) { // abstract methods val specMember = enterMember(cloneInSpecializedClass(m, _ | DEFERRED)) // debuglog("deferred " + specMember.fullName + " remains abstract") @@ -705,11 +705,11 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { // was: new Forward(specMember) { // override def target = m.owner.info.member(specializedName(m, env)) // } - } else if (m.isMethod && !m.hasAccessorFlag) { // other concrete methods + } else if (!sClass.isTrait && m.isMethod && !m.hasAccessorFlag) { // other concrete methods // log("other concrete " + m) forwardToOverload(m) - } else if (m.isMethod && m.hasFlag(LAZY)) { + } else if (!sClass.isTrait && m.isMethod && m.hasFlag(LAZY)) { forwardToOverload(m) } else if (m.isValue && !m.isMethod && !m.hasFlag(LAZY)) { // concrete value definition diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 2ccf375c45..c28cd8d69c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -957,7 +957,7 @@ trait Contexts { self: Analyzer => private def importedAccessibleSymbol(imp: ImportInfo, name: Name, requireExplicit: Boolean, record: Boolean): Symbol = imp.importedSymbol(name, requireExplicit, record) filter (s => isAccessible(s, imp.qual.tpe, superAccess = false)) - private def requiresQualifier(s: Symbol) = ( + private def requiresQualifier(s: Symbol): Boolean = ( s.owner.isClass && !s.owner.isPackageClass && !s.isTypeParameterOrSkolem @@ -967,8 +967,10 @@ trait Contexts { self: Analyzer => /** Must `sym` defined in package object of package `pkg`, if * it selected from a prefix with `pkg` as its type symbol? */ - def isInPackageObject(sym: Symbol, pkg: Symbol): Boolean = - pkg.isPackage && sym.owner != pkg && requiresQualifier(sym) + def isInPackageObject(sym: Symbol, pkg: Symbol): Boolean = { + if (sym.isOverloaded) sym.alternatives.exists(alt => isInPackageObject(alt, pkg)) + else pkg.isPackage && sym.owner != pkg && requiresQualifier(sym) + } def isNameInScope(name: Name) = lookupSymbol(name, _ => true).isSuccess diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index f26baf7d93..533ef13574 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -544,7 +544,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper tree match { case Ident(_) => val packageObject = - if (sym.owner.isModuleClass) sym.owner.sourceModule // historical optimization, perhaps no longer needed + if (!sym.isOverloaded && sym.owner.isModuleClass) sym.owner.sourceModule // historical optimization, perhaps no longer needed else pre.typeSymbol.packageObject Ident(packageObject) case Select(qual, _) => Select(qual, nme.PACKAGEkw) diff --git a/src/eclipse/.gitignore b/src/eclipse/.gitignore new file mode 100644 index 0000000000..8999e4d839 --- /dev/null +++ b/src/eclipse/.gitignore @@ -0,0 +1,2 @@ +**/.cache-* +**/.settings/ diff --git a/src/eclipse/README.md b/src/eclipse/README.md index 03c7403b04..a0152faa86 100644 --- a/src/eclipse/README.md +++ b/src/eclipse/README.md @@ -6,8 +6,8 @@ The following points describe how to get Scala to run in Eclipse. Please also ta 0. Import all projects into a [very recent version of Scala IDE for Eclipse](http://scala-ide.org/download/nightly.html) by choosing `File/Import Existing Projects` and navigate to `scala/src/eclipse`. Check all projects and click ok. -0. You need to define a `path variable` inside Eclipse. Define `SCALA_BASEDIR` in -`Preferences/General/Workspace/Linked Resources`. The value should be the absolute +0. You need to define a `path variable` inside Eclipse. Define `SCALA_BASEDIR` in +`Preferences/General/Workspace/Linked Resources`. The value should be the absolute path to your Scala checkout. All paths in the project files are relative to this one, so nothing will work before you do so. @@ -29,7 +29,7 @@ JDK. The Scala library uses such APIs, so you'd see this error: Access restriction: The method compareAndSwapObject(Object, long, Object, Object) from the type Unsafe is not accessible due to restriction on required library. - You can *fix* it by allowing calls to restricted APIs in `Java/Compiler/Errors/Warnings/Deprecated and Restricted API` + You can *fix* it by allowing calls to restricted APIs in `Java/Compiler/Errors/Warnings/Deprecated and Restricted API` settings. 0. Project files are tracked by Git, so adding them to `.gitignore` won't prevent them @@ -42,6 +42,13 @@ consider them unchanged: git update-index --no-assume-unchanged `find src/eclipse -iname .classpath -or -iname .project` +0. The 2.12, sources of Scala need to be built with a 2.12 version of the compiler. One can configure a 2.12 Scala installation +in Eclipse. In order to do this, go to `Window -> Preferences -> Scala -> Installations` and add a 2.12 installation. You can +either download a prepackaged version of 2.12 from the Scala homepage or you add the Scala installation that is part of the +`build/pack/lib` directory. The latter is required in case you absolutely need to depend on a nightly build of the compiler to +compile the compiler itself. Once the 2.12 Scala installation is created you need to select all Scala projects, do a right click +and select `Scala -> Set the Scala installation` where you have to choose the newly created 2.12 Scala installation. + If it doesn’t compile ===================== diff --git a/src/eclipse/asm/.classpath b/src/eclipse/asm/.classpath deleted file mode 100644 index 03d9e9788d..0000000000 --- a/src/eclipse/asm/.classpath +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path="asm-quick-bin"/> -</classpath> diff --git a/src/eclipse/asm/.project b/src/eclipse/asm/.project deleted file mode 100644 index c9051389af..0000000000 --- a/src/eclipse/asm/.project +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>asm</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> - <linkedResources> - <link> - <name>src</name> - <type>2</type> - <locationURI>SCALA_BASEDIR/src/asm</locationURI> - </link> - <link> - <name>asm-quick-bin</name> - <type>2</type> - <locationURI>SCALA_BASEDIR/build/asm/classes</locationURI> - </link> - </linkedResources> -</projectDescription> diff --git a/src/eclipse/interactive/.classpath b/src/eclipse/interactive/.classpath index 9e773a39d2..929ce65f2a 100644 --- a/src/eclipse/interactive/.classpath +++ b/src/eclipse/interactive/.classpath @@ -5,5 +5,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/> <classpathentry kind="output" path="build-quick-interactive"/> </classpath> diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath index de4acf8aa0..63f46f46cd 100644 --- a/src/eclipse/partest/.classpath +++ b/src/eclipse/partest/.classpath @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="partest-extras"/> - <classpathentry combineaccessrules="false" kind="src" path="/asm"/> <classpathentry combineaccessrules="false" kind="src" path="/repl"/> <classpathentry kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar"/> <classpathentry kind="var" path="M2_REPO/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"/> - <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.12.0-M1/1.0.7/scala-partest_2.12.0-M1-1.0.7.jar"/> + <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.12.0-M2/1.0.9/scala-partest_2.12.0-M2-1.0.9.jar"/> <classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/> <classpathentry kind="output" path="build-quick-partest-extras"/> </classpath> diff --git a/src/eclipse/repl/.classpath b/src/eclipse/repl/.classpath index 14f7e16670..085b58f668 100644 --- a/src/eclipse/repl/.classpath +++ b/src/eclipse/repl/.classpath @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="repl"/> - <classpathentry combineaccessrules="false" kind="src" path="/asm"/> - <classpathentry kind="var" path="M2_REPO/jline/jline/2.12.1/jline-2.12.1.jar"/> - <!-- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/repl/jline-2.12.jar"/> --> - <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> - <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path="build-quick-repl"/> + <classpathentry kind="src" path="repl"/> + <classpathentry kind="var" path="M2_REPO/jline/jline/2.12.1/jline-2.12.1.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> + <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/> + <classpathentry kind="output" path="build-quick-repl"/> </classpath> diff --git a/src/eclipse/scala-compiler/.classpath b/src/eclipse/scala-compiler/.classpath index e81cacca26..bbed3324c4 100644 --- a/src/eclipse/scala-compiler/.classpath +++ b/src/eclipse/scala-compiler/.classpath @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="compiler"/> - <classpathentry combineaccessrules="false" exported="true" kind="src" path="/asm"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/reflect"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/scala-library"/> <classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/> <classpathentry kind="output" path="build-quick-compiler"/> </classpath> diff --git a/src/eclipse/scaladoc/.classpath b/src/eclipse/scaladoc/.classpath index 2b8282cfb3..3a3ebf7799 100644 --- a/src/eclipse/scaladoc/.classpath +++ b/src/eclipse/scaladoc/.classpath @@ -6,8 +6,9 @@ <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/> <classpathentry combineaccessrules="false" kind="src" path="/partest-extras"/> - <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.12.0-M1/1.0.4/scala-xml_2.12.0-M1-1.0.4"/> - <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-parser-combinators_2.12.0-M1/1.0.4/scala-parser-combinators_2.12.0-M1-1.0.4.jar"/> - <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.12.0-M1/1.0.7/scala-partest_2.12.0-M1-1.0.7.jar"/> + <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.12.0-M2/1.0.5/scala-xml_2.12.0-M2-1.0.5.jar"/> + <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-parser-combinators_2.12.0-M2/1.0.4/scala-parser-combinators_2.12.0-M2-1.0.4.jar"/> + <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.12.0-M2/1.0.9/scala-partest_2.12.0-M2-1.0.9.jar"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/> <classpathentry kind="output" path="build-quick-scaladoc"/> </classpath> diff --git a/src/eclipse/test-junit/.classpath b/src/eclipse/test-junit/.classpath index 710d33b030..995d94aa91 100644 --- a/src/eclipse/test-junit/.classpath +++ b/src/eclipse/test-junit/.classpath @@ -8,5 +8,9 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/> <classpathentry combineaccessrules="false" kind="src" path="/repl"/> + <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/partest-extras"/> + <classpathentry combineaccessrules="false" kind="src" path="/scaladoc"/> + <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.12.0-M2/1.0.5/scala-xml_2.12.0-M2-1.0.5.jar"/> <classpathentry kind="output" path="build-test-junit"/> </classpath> diff --git a/src/library/scala/collection/concurrent/TrieMap.scala b/src/library/scala/collection/concurrent/TrieMap.scala index 74e0e0f7d2..426f9bf864 100644 --- a/src/library/scala/collection/concurrent/TrieMap.scala +++ b/src/library/scala/collection/concurrent/TrieMap.scala @@ -641,7 +641,8 @@ extends scala.collection.concurrent.Map[K, V] private var rootupdater = rtupd def hashing = hashingobj def equality = equalityobj - @volatile var root = r + @deprecated("This field will be made private", "2.12.0") + @volatile /*private*/ var root = r def this(hashf: Hashing[K], ef: Equiv[K]) = this( INode.newRootNode, @@ -685,11 +686,14 @@ extends scala.collection.concurrent.Map[K, V] } while (obj != TrieMapSerializationEnd) } - def CAS_ROOT(ov: AnyRef, nv: AnyRef) = rootupdater.compareAndSet(this, ov, nv) + @deprecated("This method will be made private", "2.12.0") + /*private*/ def CAS_ROOT(ov: AnyRef, nv: AnyRef) = rootupdater.compareAndSet(this, ov, nv) - def readRoot(abort: Boolean = false): INode[K, V] = RDCSS_READ_ROOT(abort) + @deprecated("This method will be made private", "2.12.0") + /*private[collection]*/ def readRoot(abort: Boolean = false): INode[K, V] = RDCSS_READ_ROOT(abort) - def RDCSS_READ_ROOT(abort: Boolean = false): INode[K, V] = { + @deprecated("This method will be made private", "2.12.0") + /*private[concurrent]*/ def RDCSS_READ_ROOT(abort: Boolean = false): INode[K, V] = { val r = /*READ*/root r match { case in: INode[K, V] => in @@ -884,7 +888,7 @@ extends scala.collection.concurrent.Map[K, V] * * If the specified mapping function throws an exception, * that exception is rethrown. - * + * * Note: This method will invoke op at most once. * However, `op` may be invoked without the result being added to the map if * a concurrent process is also trying to add a value corresponding to the @@ -1083,6 +1087,7 @@ private[collection] class TrieMapIterator[K, V](var level: Int, private var ct: Seq(this) } + @deprecated("This method will be removed", "2.12.0") def printDebug() { println("ctrie iterator") println(stackpos.mkString(",")) diff --git a/src/library/scala/collection/mutable/SortedSet.scala b/src/library/scala/collection/mutable/SortedSet.scala index 3dee57eb6d..304469916d 100644 --- a/src/library/scala/collection/mutable/SortedSet.scala +++ b/src/library/scala/collection/mutable/SortedSet.scala @@ -43,10 +43,12 @@ trait SortedSet[A] extends scala.collection.SortedSet[A] with scala.collection.S * */ object SortedSet extends MutableSortedSetFactory[SortedSet] { - implicit def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = new SortedSetCanBuildFrom[A] + def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = new SortedSetCanBuildFrom[A] def empty[A](implicit ord: Ordering[A]): SortedSet[A] = TreeSet.empty[A] + // Force a declaration here so that BitSet (which does not inherit from SortedSetFactory) can be more specific + override implicit def newCanBuildFrom[A](implicit ord : Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = super.newCanBuildFrom } /** Explicit instantiation of the `SortedSet` trait to reduce class file size in subclasses. */ diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala index 5c8ae17f5b..2933aa3892 100644 --- a/src/reflect/scala/reflect/internal/TreeGen.scala +++ b/src/reflect/scala/reflect/internal/TreeGen.scala @@ -129,7 +129,16 @@ abstract class TreeGen { /** Builds a reference to given symbol. */ def mkAttributedRef(sym: Symbol): RefTree = - if (sym.owner.isClass) mkAttributedRef(sym.owner.thisType, sym) + if (sym.owner.isStaticOwner) { + if (sym.owner.isRoot) + mkAttributedIdent(sym) + else { + val ownerModule = sym.owner.sourceModule + assert(ownerModule != NoSymbol, sym.owner) + mkAttributedSelect(mkAttributedRef(sym.owner.sourceModule), sym) + } + } + else if (sym.owner.isClass) mkAttributedRef(sym.owner.thisType, sym) else mkAttributedIdent(sym) def mkUnattributedRef(sym: Symbol): RefTree = mkUnattributedRef(sym.fullNameAsName('.')) diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index d0670f337a..50442519f2 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -124,9 +124,9 @@ private[scala] trait JavaMirrors extends internal.SymbolTable with api.JavaUnive private def ErrorArrayConstructor(sym: Symbol, owner: Symbol) = abort(s"Cannot instantiate arrays with mirrors. Consider using `scala.reflect.ClassTag(<class of element>).newArray(<length>)` instead") private def ErrorFree(member: Symbol, freeType: Symbol) = abort(s"cannot reflect ${member.kindString} ${member.name}, because it's a member of a weak type ${freeType.name}") private def ErrorNonExistentField(sym: Symbol) = abort( - sm"""Scala field ${sym.name} isn't represented as a Java field, neither it has a Java accessor method - |note that private parameters of class constructors don't get mapped onto fields and/or accessors, - |unless they are used outside of their declaring constructors.""") + sm"""Scala field ${sym.name} of ${sym.owner} isn't represented as a Java field, nor does it have a + |Java accessor method. One common reason for this is that it may be a private class parameter + |not used outside the primary constructor.""") /** Helper functions for extracting typed values from a (Class[_], Any) * representing an annotation argument. |