Breakpoint in delayedInit body in objects is not hit
In the following case, the code is set in
SimpleApp$delayedInit$body
. As the breakpoint is located in an object, the debugger is only trying to set the request only on SimpleApp$
and SimpleAp$$*
.object SimpleApp extends App {
println("test") // breakpoint here
}
It might be a problem with the assumption of the naming of nested classes in objects.
Leave a comment
on 2012-12-04 05:21 *
By Mirco Dotta
It turns out that this issue is caused by the Structure Builder, so it may not be that easy to have a good fix (and this is going to be "risky" - read this as possible regressions in the Java/Scala interoperability).
That the bug is in the Structure Builder can easily be verified by removing the suffixed '$' to the `ScalaModuleElement` at this line https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/javaelements/ScalaElements.scala#L96 I'm not suggesting this is the right fix, but it does demonstrates that the problem is in the Strucutre Builder.
An additional test case that should be added to the regression suite is the following:
class A
object A {
class B {
val a = 2 /* put breakpoint at this line */
}
}
Create a Main app and launch the debugger, the debug session won't stop at the given breakpoint.
That the bug is in the Structure Builder can easily be verified by removing the suffixed '$' to the `ScalaModuleElement` at this line https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/javaelements/ScalaElements.scala#L96 I'm not suggesting this is the right fix, but it does demonstrates that the problem is in the Strucutre Builder.
An additional test case that should be added to the regression suite is the following:
class A
object A {
class B {
val a = 2 /* put breakpoint at this line */
}
}
Create a Main app and launch the debugger, the debug session won't stop at the given breakpoint.
on 2012-12-04 05:21 *
By Mirco Dotta
Oh, I forgot to add, this is really annoying :-)
I don't think the problem you uncovered is exactly the same as the original ticket.
In the original test case, the breakpoint is put (in code) on the object, so it makes sense that the breakpoint is set for 'SimpleApp$'. Even if behind the scene, the code is somewhere else.
The fix I have in mind (only using the part before the first '$' as the base name) should fix both issue of using the breakpoints, even if it doesn't fix the Structure Builder
In the original test case, the breakpoint is put (in code) on the object, so it makes sense that the breakpoint is set for 'SimpleApp$'. Even if behind the scene, the code is somewhere else.
The fix I have in mind (only using the part before the first '$' as the base name) should fix both issue of using the breakpoints, even if it doesn't fix the Structure Builder
on 2012-12-04 14:35 *
By Mirco Dotta
Agreed. I've created a new ticket (#1001367) and linked the two tickets.
(In scala-ide:5fb08789ca3e5c6bd4fac63a68ff07c2ae022a44) Breakpoints work even if referencing the wrong nested class
Now uses the name of the top level class as base name to set class prepare request.
This allow to put the breakpoint on any nested classes containing the line.
Fix #1001197, Re #1001367
Branch: master
Now uses the name of the top level class as base name to set class prepare request.
This allow to put the breakpoint on any nested classes containing the line.
Fix #1001197, Re #1001367
Branch: master