diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-07 15:45:14 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-07 18:48:06 +0100 |
commit | 54a84a36d5b435a787d93ca48d45399136c7e162 (patch) | |
tree | 83680a470908114090b0d4babe44dda81aaff6c1 /test/files/run/t6548.scala | |
parent | 58969850a0991a72c360433540943eae4b10dc6b (diff) | |
download | scala-54a84a36d5b435a787d93ca48d45399136c7e162.tar.gz scala-54a84a36d5b435a787d93ca48d45399136c7e162.tar.bz2 scala-54a84a36d5b435a787d93ca48d45399136c7e162.zip |
SI-6548 reflection now correctly enters jinners
When completing Java classes, runtime reflection enumerates their
fields, methods, constructors and inner classes, loads them and
enters them into either the instance part (ClassSymbol) or the
static part (ModuleSymbol).
However unlike fields, methods and constructors, inner classes don't
need to be entered explicitly - they are entered implicitly when
being loaded.
This patch fixes the double-enter problem, make sure that enter-on-load
uses the correct owner, and also hardens jclassAsScala against double
enters that can occur in a different scenario.
Since the fix is about Java-compiled classes, the test needs *.class
artifacts produced by javac. Therefore I updated javac-artifacts.jar to
include the new artifacts along with their source code.
Diffstat (limited to 'test/files/run/t6548.scala')
-rw-r--r-- | test/files/run/t6548.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/run/t6548.scala b/test/files/run/t6548.scala new file mode 100644 index 0000000000..be3eb5b932 --- /dev/null +++ b/test/files/run/t6548.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class Bean { + @JavaAnnotationWithNestedEnum(JavaAnnotationWithNestedEnum.Value.VALUE) + def value = 1 +} + +object Test extends App { + println(cm.staticClass("Bean").isCaseClass) + println(typeOf[Bean].declaration(newTermName("value")).annotations) +} |