diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-06 14:12:56 -0800 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-03-07 20:56:18 +0100 |
commit | 60aa5771ea92f91ed34778f90c04113e226d09ca (patch) | |
tree | 460f5f6ce0d107c8f90e12a4c720c9b9ed437fc8 /src/reflect | |
parent | 2dddb03b267770afcd0249ad700e55d53019e637 (diff) | |
download | scala-60aa5771ea92f91ed34778f90c04113e226d09ca.tar.gz scala-60aa5771ea92f91ed34778f90c04113e226d09ca.tar.bz2 scala-60aa5771ea92f91ed34778f90c04113e226d09ca.zip |
SI-8367 revert SI-8192's change to primaryConstructor when isJavaDefined
this is some weird stuff
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 8 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index a5a50f1088..dddd3c0e61 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -919,6 +919,14 @@ trait Symbols { self: Universe => * For a Scala package class, NoSymbol. * For a Java class, NoSymbol. * + * Known issues: Due to SI-8367, primaryConstructor may return unexpected results + * when called for Java classes (for some vague definition of a "Java class", which apparently + * not only includes javac-produced classfiles, but also consists of classes defined in + * Scala programs under the java.lang package). What's even worse, for some Java classes + * we can't even guarantee stability of the return value - depending on your classloader configuration + * and/or JDK version you might get different primaryConstructor for the same ClassSymbol. + * We have logged these issues at SI-8193. + * * @group Class */ // TODO: SI-8193 I think we should only return a non-empty symbol if called for Scala classes diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 03d8f97831..595d638c28 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -1904,6 +1904,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** The next enclosing method. */ def enclMethod: Symbol = if (isSourceMethod) this else owner.enclMethod + /** The primary constructor of a class. */ def primaryConstructor: Symbol = NoSymbol /** The self symbol (a TermSymbol) of a class with explicit self type, or else the @@ -3188,8 +3189,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => override def primaryConstructor = { val c = info decl primaryConstructorName - if (isJavaDefined) NoSymbol // need to force info before checking the flag - else if (c.isOverloaded) c.alternatives.head else c + if (c.isOverloaded) c.alternatives.head else c } override def associatedFile = ( |