From a3d03ab8667e09e53c74d3fbb0cd7b8ae00fc8c9 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 9 May 2013 12:07:03 +0200 Subject: fixes a crash in ReflectionUtils.systemProperties Due to SI-7465 we were erroneously assuming that System.getProperties only contains string key and string values. This led to a CCE when there was something else. --- test/files/run/macro-system-properties.check | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/files/run/macro-system-properties.check (limited to 'test/files/run/macro-system-properties.check') diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check new file mode 100644 index 0000000000..dce976df02 --- /dev/null +++ b/test/files/run/macro-system-properties.check @@ -0,0 +1,26 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import language.experimental._, reflect.macros.Context +import language.experimental._ +import reflect.macros.Context + +scala> object GrabContext { + def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context]) + // System.properties lets you stash true globals (unlike statics which are classloader scoped) + def impl(c: Context)() = { System.getProperties.put("lastContext", c); c.literalUnit } + def grab() = macro impl + } +defined module GrabContext + +scala> object Test { class C(implicit a: Any) { GrabContext.grab } } +defined module Test + +scala> object Test { class C(implicit a: Any) { GrabContext.grab } } +defined module Test + +scala> + +scala> -- cgit v1.2.3