Skip to content
Browse files

[nomaster] Revert "SI-6548 reflection now correctly enters jinners"

This reverts commit 54a84a3.

This is necessary to maintain binary compatibility with 2.10.0.

run/t6989.check had to be updated as it also (indirectly) tested SI-6548

Conflicts:
	test/files/lib/javac-artifacts.jar.desired.sha1
	test/files/run/t6548.check
	test/files/run/t6548/Test_2.scala
  • Loading branch information...
1 parent 2f9b708 commit 85b63b81d5951a78547641e3feab0886f6013ea1 @adriaanm adriaanm committed Feb 8, 2013
View
16 bincompat-backward.whitelist.conf
@@ -52,14 +52,14 @@ filter {
# matchName="scala.reflect.runtime.SymbolLoaders.initAndEnterClassAndModule"
# problemName=MissingMethodProblem
# },
- {
- matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala"
- problemName=MissingMethodProblem
- },
- {
- matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala"
- problemName=IncompatibleResultTypeProblem
- },
+ # {
+ # matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala"
+ # problemName=MissingMethodProblem
+ # },
+ # {
+ # matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala"
+ # problemName=IncompatibleResultTypeProblem
+ # },
# scala.reflect.internal
View
16 bincompat-forward.whitelist.conf
@@ -61,14 +61,14 @@ filter {
},
# scala.reflect.runtime
- {
- matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala"
- problemName=IncompatibleResultTypeProblem
- },
- {
- matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala1"
- problemName=MissingMethodProblem
- },
+ # {
+ # matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala"
+ # problemName=IncompatibleResultTypeProblem
+ # },
+ # {
+ # matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jclassAsScala1"
+ # problemName=MissingMethodProblem
+ # },
# {
# matchName="scala.reflect.runtime.SymbolLoaders.initClassAndModule"
# problemName=MissingMethodProblem
View
16 src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -686,9 +686,9 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni
def enter(sym: Symbol, mods: Int) =
(if (jModifier.isStatic(mods)) module.moduleClass else clazz).info.decls enter sym
- for (jinner <- jclazz.getDeclaredClasses)
- jclassAsScala(jinner) // inner class is entered as a side-effect
- // no need to call enter explicitly
+ for (jinner <- jclazz.getDeclaredClasses) {
+ enter(jclassAsScala(jinner, clazz), jinner.getModifiers)
+ }
pendingLoadActions = { () =>
@@ -1046,14 +1046,14 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni
* @param jclazz The Java class
* @return A Scala class symbol that wraps all reflection info of `jclazz`
*/
- private def jclassAsScala(jclazz: jClass[_]): ClassSymbol =
- toScala(classCache, jclazz)(_ jclassAsScala1 _)
+ private def jclassAsScala(jclazz: jClass[_]): Symbol = jclassAsScala(jclazz, sOwner(jclazz))
- private def jclassAsScala1(jclazz: jClass[_]): ClassSymbol = {
- val owner = sOwner(jclazz)
+ private def jclassAsScala(jclazz: jClass[_], owner: Symbol): ClassSymbol = {
val name = scalaSimpleName(jclazz)
val completer = (clazz: Symbol, module: Symbol) => new FromJavaClassCompleter(clazz, module, jclazz)
- createClassModule(owner, name, completer) match { case (clazz, module) => clazz }
+ val (clazz, module) = createClassModule(owner, name, completer)
+ classCache enter (jclazz, clazz)
+ clazz
}
/**
View
2 test/files/run/t6548.check
@@ -1,2 +0,0 @@
-false
-List(JavaAnnotationWithNestedEnum_1(value = VALUE))
View
17 test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java
@@ -1,17 +0,0 @@
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD,
- ElementType.TYPE, ElementType.PARAMETER})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface JavaAnnotationWithNestedEnum_1
-{
- public Value value() default Value.VALUE;
-
- public enum Value
- {
- VALUE;
- }
-}
View
12 test/files/run/t6548/Test_2.scala
@@ -1,12 +0,0 @@
-import scala.reflect.runtime.universe._
-import scala.reflect.runtime.{currentMirror => cm}
-
-class Bean {
- @JavaAnnotationWithNestedEnum_1(JavaAnnotationWithNestedEnum_1.Value.VALUE)
- def value = 1
-}
-
-object Test extends App {
- println(cm.staticClass("Bean").isCaseClass)
- println(typeOf[Bean].declaration(newTermName("value")).annotations)
-}
View
84 test/files/run/t6989.check
@@ -113,6 +113,18 @@ isProtected = false
isPublic = false
privateWithin = <none>
============
+sym = class $PrivateJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
+isPrivate = true
+isProtected = false
+isPublic = false
+privateWithin = <none>
+============
+sym = value this$0, signature = foo.JavaClass_1, owner = class $PrivateJavaClass
+isPrivate = false
+isProtected = false
+isPublic = false
+privateWithin = package foo
+============
sym = class $ProtectedJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
isPrivate = false
isProtected = true
@@ -131,6 +143,18 @@ isProtected = false
isPublic = false
privateWithin = package foo
============
+sym = class $ProtectedJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
+isPrivate = false
+isProtected = true
+isPublic = false
+privateWithin = package foo
+============
+sym = value this$0, signature = foo.JavaClass_1, owner = class $ProtectedJavaClass
+isPrivate = false
+isProtected = false
+isPublic = false
+privateWithin = package foo
+============
sym = class $PublicJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
isPrivate = false
isProtected = false
@@ -155,55 +179,97 @@ isProtected = false
isPublic = true
privateWithin = <none>
============
-sym = constructor JavaClass_1, signature = ()foo.JavaClass_1, owner = class JavaClass_1
+sym = class $PublicJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
isPrivate = false
isProtected = false
isPublic = true
privateWithin = <none>
============
-sym = object JavaClass_1, signature = foo.JavaClass_1.type, owner = package foo
+sym = constructor $PublicJavaClass, signature = (x$1: foo.JavaClass_1)JavaClass_1.this.$PublicJavaClass, owner = class $PublicJavaClass
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
+sym = value this$0, signature = foo.JavaClass_1, owner = class $PublicJavaClass
+isPrivate = false
+isProtected = false
+isPublic = false
+privateWithin = package foo
+============
+sym = constructor JavaClass_1, signature = ()foo.JavaClass_1, owner = class JavaClass_1
isPrivate = false
isProtected = false
isPublic = true
privateWithin = <none>
============
-sym = class PrivateStaticJavaClass, signature = ClassInfoType(...), owner = object JavaClass_1
+sym = class PrivateStaticJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
isPrivate = true
isProtected = false
isPublic = false
privateWithin = <none>
============
-sym = object PrivateStaticJavaClass, signature = foo.JavaClass_1.PrivateStaticJavaClass.type, owner = object JavaClass_1
+sym = object PrivateStaticJavaClass, signature = JavaClass_1.this.PrivateStaticJavaClass.type, owner = class JavaClass_1
isPrivate = true
isProtected = false
isPublic = false
privateWithin = <none>
============
-sym = class ProtectedStaticJavaClass, signature = ClassInfoType(...), owner = object JavaClass_1
+sym = class ProtectedStaticJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
isPrivate = true
isProtected = false
isPublic = false
privateWithin = <none>
============
-sym = object ProtectedStaticJavaClass, signature = foo.JavaClass_1.ProtectedStaticJavaClass.type, owner = object JavaClass_1
+sym = object ProtectedStaticJavaClass, signature = JavaClass_1.this.ProtectedStaticJavaClass.type, owner = class JavaClass_1
isPrivate = true
isProtected = false
isPublic = false
privateWithin = <none>
============
-sym = class PublicStaticJavaClass, signature = ClassInfoType(...), owner = object JavaClass_1
+sym = class PublicStaticJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
+sym = constructor PublicStaticJavaClass, signature = ()JavaClass_1.this.PublicStaticJavaClass, owner = class PublicStaticJavaClass
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
+sym = object PublicStaticJavaClass, signature = JavaClass_1.this.PublicStaticJavaClass.type, owner = class JavaClass_1
isPrivate = false
isProtected = false
isPublic = true
privateWithin = <none>
============
-sym = constructor PublicStaticJavaClass, signature = ()foo.JavaClass_1.PublicStaticJavaClass, owner = class PublicStaticJavaClass
+sym = object JavaClass_1, signature = foo.JavaClass_1.type, owner = package foo
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
+sym = class PrivateStaticJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
+isPrivate = true
+isProtected = false
+isPublic = false
+privateWithin = <none>
+============
+sym = class ProtectedStaticJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
+isPrivate = true
+isProtected = false
+isPublic = false
+privateWithin = <none>
+============
+sym = class PublicStaticJavaClass, signature = ClassInfoType(...), owner = class JavaClass_1
isPrivate = false
isProtected = false
isPublic = true
privateWithin = <none>
============
-sym = object PublicStaticJavaClass, signature = foo.JavaClass_1.PublicStaticJavaClass.type, owner = object JavaClass_1
+sym = constructor PublicStaticJavaClass, signature = ()JavaClass_1.this.PublicStaticJavaClass, owner = class PublicStaticJavaClass
isPrivate = false
isProtected = false
isPublic = true

0 comments on commit 85b63b8

Please sign in to comment.
Something went wrong with that request. Please try again.