Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException on Code.lift #5226

Closed
scabug opened this issue Nov 26, 2011 · 2 comments
Closed

NullPointerException on Code.lift #5226

scabug opened this issue Nov 26, 2011 · 2 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Nov 26, 2011

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.(Universe.scala:41)
at scala.reflect.runtime.Mirror.(Mirror.scala:9)
at scala.reflect.runtime.Mirror$.(Mirror.scala:46)
at scala.reflect.runtime.Mirror$.(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 .(:14)
at .()
at .(:11)
at .()
at $print()
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

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 26, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5226?orig=1
Reporter: Natallie Baikevich (natallie)

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 22, 2011

@xeno-by said:
Fixed by scala/scala#67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.