mfikes / ambly

ClojureScript REPL into embedded JavaScriptCore
http://ambly.fikesfarm.com
Eclipse Public License 1.0
541 stars 21 forks source link

REPL hangs upon NPE #57

Closed mfikes closed 9 years ago

mfikes commented 9 years ago

In Ambly Demo:

ClojureScript:cljs.user> (def foo (atom nil))
#<Atom: nil>
ClojureScript:cljs.user> (.-name @foo))
TypeError: null is not an object (evaluating 'cljs.core.deref.call(null,cljs.user.foo).name')
Exception in thread "main" java.net.MalformedURLException, compiling:(/private/var/folders/nm/97bx7f_n31z2t2g_gf2bn90w0h013l/T/form-init7315230464332166718.clj:1:142)
    at clojure.lang.Compiler.load(Compiler.java:7142)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.net.MalformedURLException
    at java.net.URL.<init>(URL.java:620)
    at java.net.URL.<init>(URL.java:483)
    at cljs.repl$mapped_stacktrace$iter__3668__3672$fn__3673$fn__3674.invoke(repl.clj:237)
    at cljs.repl$mapped_stacktrace$iter__3668__3672$fn__3673.invoke(repl.clj:235)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:31)
    at clojure.core$vec.invoke(core.clj:354)
    at cljs.repl$mapped_stacktrace.invoke(repl.clj:235)
    at ambly.repl.jsc.JscEnv._print_stacktrace(jsc.clj:298)
    at cljs.repl$display_error.invoke(repl.clj:327)
    at cljs.repl$repl_caught.invoke(repl.clj:570)
    at cljs.repl$repl_STAR_$fn__3805$fn__3812.invoke(repl.clj:690)
    at cljs.repl$repl_STAR_$fn__3805.invoke(repl.clj:687)
    at cljs.compiler$with_core_cljs.invoke(compiler.clj:912)
    at cljs.repl$repl_STAR_.invoke(repl.clj:653)
    at user$eval3933.invoke(form-init7315230464332166718.clj:3)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6666)
    at clojure.core$eval.invoke(core.clj:2927)
    at clojure.main$eval_opt.invoke(main.clj:288)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
    at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
    at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
    at user$eval5.invoke(form-init7315230464332166718.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6693)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    ... 11 more
Caused by: java.lang.NullPointerException
    at java.net.URL.<init>(URL.java:525)
    ... 56 more

After this REPL is inoperative

mfikes commented 9 years ago

For reference here is the same sequence in the Node REPL, which does not exhibit the problem:

Mike-Fikess-MacBook-Pro:clojurescript mfikes$ ./script/noderepljs
To quit, type: :cljs/quit
ClojureScript Node.js REPL server listening on 55665
ClojureScript:cljs.user> (def foo (atom nil))
#<Atom: nil>
ClojureScript:cljs.user> (.-name @foo))
TypeError: Cannot read property 'name' of null
    at repl:1:109
    at repl:13:4
    at [stdin]:41:34
    at b (domain.js:183:18)
    at Domain.run (domain.js:123:23)
    at Socket.<anonymous> ([stdin]:40:25)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:765:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:427:10)
ClojureScript:cljs.user> 
mfikes commented 9 years ago

No longer occurs on when Ambly is using ClojureScript master:

ClojureScript:cljs.user> (def foo (atom nil))
#<Atom: nil>
ClojureScript:cljs.user> (.-name @foo)
TypeError: null is not an object (evaluating 'cljs.core.deref.call(null,cljs.user.foo).name')
     global code (NO_SOURCE_FILE)
ClojureScript:cljs.user>