diff options
-rw-r--r-- | src/compiler/scala/reflect/macros/runtime/JavaReflectionRuntimes.scala | 2 | ||||
-rw-r--r-- | test/files/run/t8437.check | 2 | ||||
-rw-r--r-- | test/files/run/t8437/Macros_1.scala | 18 | ||||
-rw-r--r-- | test/files/run/t8437/Test_2.scala | 4 |
4 files changed, 25 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/JavaReflectionRuntimes.scala b/src/compiler/scala/reflect/macros/runtime/JavaReflectionRuntimes.scala index ecdd48db22..be114efbc0 100644 --- a/src/compiler/scala/reflect/macros/runtime/JavaReflectionRuntimes.scala +++ b/src/compiler/scala/reflect/macros/runtime/JavaReflectionRuntimes.scala @@ -14,7 +14,7 @@ trait JavaReflectionRuntimes { def resolveJavaReflectionRuntime(classLoader: ClassLoader): MacroRuntime = { val implClass = Class.forName(className, true, classLoader) - val implMeths = implClass.getDeclaredMethods.find(_.getName == methName) + val implMeths = implClass.getMethods.find(_.getName == methName) // relies on the fact that macro impls cannot be overloaded // so every methName can resolve to at maximum one method val implMeth = implMeths getOrElse { throw new NoSuchMethodException(s"$className.$methName") } diff --git a/test/files/run/t8437.check b/test/files/run/t8437.check new file mode 100644 index 0000000000..fd3c81a4d7 --- /dev/null +++ b/test/files/run/t8437.check @@ -0,0 +1,2 @@ +5 +5 diff --git a/test/files/run/t8437/Macros_1.scala b/test/files/run/t8437/Macros_1.scala new file mode 100644 index 0000000000..6286ea2a8c --- /dev/null +++ b/test/files/run/t8437/Macros_1.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros._ + +abstract class AbstractBundle(val c: blackbox.Context) { + import c.Expr + import c.universe._ + def foo: Expr[Int] = Expr[Int](q"5") +} + +class ConcreteBundle(override val c: blackbox.Context) extends AbstractBundle(c) { + import c.Expr + val bar: Expr[Int] = foo +} + +object InvokeBundle { + def foo: Int = macro ConcreteBundle.foo // nope + def bar: Int = macro ConcreteBundle.bar // yep +}
\ No newline at end of file diff --git a/test/files/run/t8437/Test_2.scala b/test/files/run/t8437/Test_2.scala new file mode 100644 index 0000000000..47bb84ad0e --- /dev/null +++ b/test/files/run/t8437/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(InvokeBundle.foo) + println(InvokeBundle.bar) +}
\ No newline at end of file |