summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/Predef.scala3
-rw-r--r--src/reflect/scala/reflect/api/Symbols.scala42
-rw-r--r--src/reflect/scala/reflect/internal/Scopes.scala3
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala4
-rw-r--r--src/reflect/scala/reflect/runtime/JavaMirrors.scala11
5 files changed, 62 insertions, 1 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 44025d5358..f3d36473dd 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -115,8 +115,11 @@ object Predef extends LowPriorityImplicits {
@deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0")
val NoManifest = scala.reflect.NoManifest
+ @deprecated("Use scala.reflect.classTag[T] and scala.reflect.runtime.universe.typeTag[T] instead", "2.10.0")
def manifest[T](implicit m: Manifest[T]) = m
+ @deprecated("Use scala.reflect.classTag[T] instead", "2.10.0")
def classManifest[T](implicit m: ClassManifest[T]) = m
+ @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0")
def optManifest[T](implicit m: OptManifest[T]) = m
// Minor variations on identity functions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala
index 13f5f743f1..2fa8ccc044 100644
--- a/src/reflect/scala/reflect/api/Symbols.scala
+++ b/src/reflect/scala/reflect/api/Symbols.scala
@@ -158,10 +158,22 @@ trait Symbols extends base.Symbols { self: Universe =>
*/
def isOverride: Boolean
+ /** Is this symbol labelled as "abstract override"?
+ */
+ def isAbstractOverride: Boolean
+
/** Is this symbol a macro?
*/
def isMacro: Boolean
+ /** Is this symbol a parameter (either a method parameter or a type parameter)?
+ */
+ def isParameter: Boolean
+
+ /** Is this symbol a specialized type parameter or a generated specialized member?
+ */
+ def isSpecialized: Boolean
+
/******************* helpers *******************/
/** ...
@@ -240,6 +252,25 @@ trait Symbols extends base.Symbols { self: Universe =>
/** Setter method for a backing field of a val or a val, NoSymbol for all other term symbols.
*/
def setter: Symbol
+
+ /** Does this symbol represent a field of a class
+ * that was generated from a parameter of that class?
+ */
+ def isParamAccessor: Boolean
+
+ /** Does this symbol represent a field of a case class
+ * that corresponds to a parameter in the first parameter list of the
+ * primary constructor of that class?
+ */
+ def isCaseAccessor: Boolean
+
+ /** Does this symbol represent a parameter with a default value?
+ */
+ def isParamWithDefault: Boolean
+
+ /** Does this symbol represent a by-name parameter?
+ */
+ def isByNameParam: Boolean
}
/** The API of type symbols */
@@ -275,6 +306,13 @@ trait Symbols extends base.Symbols { self: Universe =>
/** The API of method symbols */
trait MethodSymbolApi extends TermSymbolApi with MethodSymbolBase { this: MethodSymbol =>
+ /** Does this method represent a constructor?
+ *
+ * If `owner` is a class, then this is a vanilla JVM constructor.
+ * If `owner` is a trait, then this is a mixin constructor.
+ */
+ def isConstructor: Boolean
+
/** For a polymorphic method, its type parameters, the empty list for all other methods */
def typeParams: List[Symbol]
@@ -286,6 +324,10 @@ trait Symbols extends base.Symbols { self: Universe =>
*/
def params: List[List[Symbol]]
+ /** Does this method support variable length argument lists?
+ */
+ def isVarargs: Boolean
+
/** The return type of the method */
def returnType: Type
}
diff --git a/src/reflect/scala/reflect/internal/Scopes.scala b/src/reflect/scala/reflect/internal/Scopes.scala
index ed390b5a3b..35d029afdc 100644
--- a/src/reflect/scala/reflect/internal/Scopes.scala
+++ b/src/reflect/scala/reflect/internal/Scopes.scala
@@ -324,6 +324,9 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
override def filter(p: Symbol => Boolean): Scope =
if (!(toList forall p)) newScopeWith(toList filter p: _*) else this
+ @deprecated("Use `toList.reverse` instead", "2.10.0")
+ def reverse: List[Symbol] = toList.reverse
+
override def mkString(start: String, sep: String, end: String) =
toList.map(_.defString).mkString(start, sep, end)
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index c356416112..9ae4302734 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -64,6 +64,8 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
def kind: String = kindString
def isExistential: Boolean = this.isExistentiallyBound
+ def isParamWithDefault: Boolean = this.hasDefault
+ def isByNameParam: Boolean = this.isValueParameter && (this hasFlag BYNAMEPARAM)
def newNestedSymbol(name: Name, pos: Position, newFlags: Long, isClass: Boolean): Symbol = name match {
case n: TermName => newTermSymbol(n, pos, newFlags)
@@ -2496,6 +2498,8 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
override def params: List[List[Symbol]] = paramss
+ override def isVarargs: Boolean = definitions.isVarArgsList(paramss.flatten)
+
override def returnType: Type = {
def loop(tpe: Type): Type =
tpe match {
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
index 64c47a5502..5eb7770de6 100644
--- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala
+++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -777,7 +777,16 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
lookupClass
else if (jclazz.isLocalClass0 || isInvalidClassName(jname))
// local classes and implementation classes not preserved by unpickling - treat as Java
- jclassAsScala(jclazz)
+ //
+ // upd. but only if they cannot be loaded as top-level classes
+ // otherwise we may mistake mangled symbolic names for mangled nested names
+ //
+ // in case when a Java binary name can be treated both as a top-level class and as a nested class
+ // (as described in http://groups.google.com/group/scala-internals/browse_thread/thread/10855403bbf04298)
+ // we check for a top-level class first
+ // this is totally correct, because a top-level class and a nested class with the same name cannot coexist
+ // so it's either one or another, but not both - therefore we always load $-bearing classes correctly
+ lookupClass orElse jclassAsScala(jclazz)
else if (jclazz.isArray)
ArrayClass
else