provegard / ncdbg

A debugger for Nashorn that uses Chrome DevTools as frontend
BSD 3-Clause "New" or "Revised" License
31 stars 5 forks source link

Exception on startup #88

Closed benoitcerrina closed 6 years ago

benoitcerrina commented 6 years ago

not really a big deal and it could be closed as a restriction, however whenever I start the debugger I have an immediate exception stack: Failed to handle event com.sun.tools.jdi.EventSetImpl$VMStartEventImpl java.lang.NullPointerException: null at com.programmaticallyspeaking.ncd.nashorn.JDIExtensions$ExtEvent.handle(JDIExtensions.scala:24) at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.$anonfun$handleOperation$1(NashornDebuggerHost.scala:310) at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.$anonfun$handleOperation$1$adapted(NashornDebuggerHost.scala:307) at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59) at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.handleOperation(NashornDebuggerHost.scala:307) 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:498) at com.programmaticallyspeaking.ncd.infra.ExecutorProxy$Handler.$anonfun$invoke$3(ExecutorProxy.scala:42) at scala.util.Try$.apply(Try.scala:209) at com.programmaticallyspeaking.ncd.infra.ExecutorProxy$Handler.$anonfun$invoke$2(ExecutorProxy.scala:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

It doesn't look to good and should probably be caught and reported a little less abruptly

provegard commented 6 years ago

I have never seen this, but I added an extra safeguard against an event request that is null. Let me know if it works for you, re-open if it doesn't (GitHub auto-closed the issue).

benoitcerrina commented 6 years ago

it is fixed but I now have a compilation warning: E:\dev\ncdbg\src\main\scala\com\programmaticallyspeaking\ncd\nashorn\JDIExtensions.scala:26: non-variable type argument com.sun.jdi.event.Event in type pattern com.sun.jdi.event.Event => Boolean (the underlying of com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.EventHandler) is unchecked since it is elimin ated by erasure case h: EventHandler => h(event) ^ one warning found

Otherwise the startup traces with the fix look like this which seems fine to me:

NCDbg version: 0.6.0-95-ga50e471.dirty Local Java version: 1.8.0_144 Connecting to localhost:8000... Connected! Remote VM information:

provegard commented 6 years ago

Yed, I know there are some warnings, but they shouldn't matter. I don't know of any Scala mechanism for disabling individual warnings.