You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Blake McBride <bl...@gmail.com> on 2018/11/17 19:30:31 UTC

Breakpoints aren't working on NetBeans for dynamically loaded Groovy

Greetings,

I am using Groovy 2.4.15 under NetBeans 8.2 and Java 8 on a 64 bit Linux
box.

I am dynamically loading Groovy with the following code:

if (groovyLoader == null)
groovyLoader = new GroovyClassLoader(GroovyClass.class.getClassLoader());
groovyClass = groovyLoader.parseClass(new GroovyCodeSource(new File(path +
sourceFile)), false);


Doing it this way, when debugging the loaded class, I am able to set
breakpoints from within IntelliJ and it works as expected.  However,
NetBeans ignores the breakpoints.

I do a similar thing with Java files, and NetBeans honors those breakpoints.

Any help would sure be appreciated.

Thanks.

Blake McBride

Re: Breakpoints aren't working on NetBeans for dynamically loaded Groovy

Posted by Jochen Theodorou <bl...@gmx.org>.
On 17.11.18 20:30, Blake McBride wrote:
> Greetings,
> 
> I am using Groovy 2.4.15 under NetBeans 8.2 and Java 8 on a 64 bit Linux 
> box.
> 
> I am dynamically loading Groovy with the following code:
> 
> if (groovyLoader == null)
> groovyLoader = new GroovyClassLoader(GroovyClass.class.getClassLoader());
> groovyClass = groovyLoader.parseClass(new GroovyCodeSource(new File(path 
> + sourceFile)), false);
> 
> 
> Doing it this way, when debugging the loaded class, I am able to set 
> breakpoints from within IntelliJ and it works as expected.  However, 
> NetBeans ignores the breakpoints.
> 
> I do a similar thing with Java files, and NetBeans honors those breakpoints.

since it works under Intellij, it means it cannot be broken totally on 
our side.

Afaik both use the Java debugger behind the scenes. And afaik you just 
tell the debugger to stop at that line in that and that class. Or at 
that class in a certain method, maybe at a certain variable init.. To 
set a breakpoint in a groovy class You need thus to know the class name. 
Maybe Netbeans is unable to generate such a name for something that is 
not a regular source file? Frankly this is all very much speculation. I 
would actucally suggest you create an issue for netbeans to get somebody 
on the netbeans teams with knowledge on the debugger interface to notice 
it, and then we can continue to analyse this together.

Since there is no real documentation about how to plant line number 
information in the bytecode to let jdb and others stop at the right 
position, this is all a lot of trial and error. We do have several 
issues around debugging we cannot really resolve, because we miss the 
required information. At least I have yet to meet a person that can tell 
me. Who knows, maybe there is one in the netbeans team.

bye Jochen