Details

      Description

      import scala.reflect.; import scala.reflect.mirror.
      Code.lift raises an exception:

      java.lang.NullPointerException
      at scala.reflect.runtime.JavaToScala$class.javaClass(JavaToScala.scala:46)
      at scala.reflect.runtime.Universe.javaClass(Universe.scala:11)
      at scala.reflect.runtime.JavaToScala$class.javaClass(JavaToScala.scala:44)
      at scala.reflect.runtime.Universe.javaClass(Universe.scala:11)
      at scala.reflect.runtime.JavaToScala$class.isJavaClass(JavaToScala.scala:51)
      at scala.reflect.runtime.Universe.isJavaClass(Universe.scala:11)
      at scala.reflect.runtime.Loaders$PackageScope.lookupEntry(Loaders.scala:113)
      at scala.reflect.internal.Types$Type.findDecl(Types.scala:872)
      at scala.reflect.internal.Types$Type.decl(Types.scala:498)
      at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:185)
      at scala.reflect.runtime.Loaders$LazyPackageType.complete(Loaders.scala:88)
      at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:910)
      at scala.reflect.runtime.JavaToScala$class.makeScalaPackage(JavaToScala.scala:334)
      at scala.reflect.runtime.Universe.makeScalaPackage(Universe.scala:11)
      at scala.reflect.runtime.JavaToScala$class.packageNameToScala(JavaToScala.scala:322)
      at scala.reflect.runtime.Universe.packageNameToScala(Universe.scala:11)
      at scala.reflect.runtime.JavaToScala$class.makeScalaPackage(JavaToScala.scala:331)
      at scala.reflect.runtime.Universe.makeScalaPackage(Universe.scala:11)
      at scala.reflect.runtime.JavaToScala$$anonfun$packageToScala$1.apply(JavaToScala.scala:314)
      at scala.reflect.runtime.JavaToScala$$anonfun$packageToScala$1.apply(JavaToScala.scala:314)
      at scala.reflect.runtime.ConversionUtil$TwoWayCache.toScala(ConversionUtil.scala:30)
      at scala.reflect.runtime.JavaToScala$class.packageToScala(JavaToScala.scala:313)
      at scala.reflect.runtime.Universe.packageToScala(Universe.scala:11)
      at scala.reflect.runtime.JavaToScala$class.scala$reflect$runtime$JavaToScala$$sOwner(JavaToScala.scala:249)
      at scala.reflect.runtime.JavaToScala$$anonfun$classToScala$1.apply(JavaToScala.scala:375)
      at scala.reflect.runtime.JavaToScala$$anonfun$classToScala$1.apply(JavaToScala.scala:354)
      at scala.reflect.runtime.ConversionUtil$TwoWayCache.toScala(ConversionUtil.scala:30)
      at scala.reflect.runtime.JavaToScala$class.classToScala(JavaToScala.scala:353)
      at scala.reflect.runtime.Universe.classToScala(Universe.scala:11)
      at scala.reflect.runtime.Universe.<init>(Universe.scala:41)
      at scala.reflect.runtime.Mirror.<init>(Mirror.scala:9)
      at scala.reflect.runtime.Mirror$.<init>(Mirror.scala:46)
      at scala.reflect.runtime.Mirror$.<clinit>(Mirror.scala)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at scala.reflect.ReflectionUtils$.singletonInstance(ReflectionUtils.scala:34)
      at scala.reflect.package$.mirror(package.scala:11)
      at .<init>(<console>:14)
      at .<clinit>(<console>)
      at .<init>(<console>:11)
      at .<clinit>(<console>)
      at $print(<console>)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:751)
      at scala.tools.nsc.interpreter.IMain$Request$$anonfun$13.apply(IMain.scala:992)
      at scala.tools.nsc.interpreter.Line.scala$tools$nsc$interpreter$Line$$runAndSetState(Line.scala:41)
      at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:47)
      at scala.tools.nsc.io.package$$anon$2.run(package.scala:19)
      at java.lang.Thread.run(Thread.java:680)

      That happens because of defaultReflectiveClassLoader returning null (JavaToScala.scala)
      I've applied a quick fix - ClassLoader.getSystemClassLoader works for me, not sure if it's ok

        Activity

        Hide
        Eugene Burmako added a comment -
        Show
        Eugene Burmako added a comment - Fixed by https://github.com/scala/scala/pull/67

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Natallie Baikevich
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development