You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2019/10/29 15:54:00 UTC

[jira] [Comment Edited] (GROOVY-8893) Breakpoints aren't working on NetBeans for dynamically loaded Groovy

    [ https://issues.apache.org/jira/browse/GROOVY-8893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16962142#comment-16962142 ] 

Eric Milles edited comment on GROOVY-8893 at 10/29/19 3:53 PM:
---------------------------------------------------------------

See also GROOVY-9076

If you disable the primitive optimization or enable invoke-dynamic the generated bytecode does not contain a "fast-path" branch and this tends to resolve debugging issues.  You can try this out in your case by setting a CompilerConfiguration on GroovyClassLoader.

{code:java}
if (groovyLoader == null) {
  CompilerConfiguration groovyConfig = new CompilerConfiguration();
  groovyConfig.setOptimizationOptions(Collections.singletonMap("int", false)); // or "indy", true
  groovyLoader = new GroovyClassLoader(GroovyClass.class.getClassLoader(), groovyConfig, true);
}
{code}



was (Author: emilles):
See also GROOVY-9076

If you disable the primitive optimization or enable invoke-dynamic the generated bytecode does not contain a "fast-path" branch and this tends to resolve debugging issues.  You can try this out in your case by setting a CompilerConfiguration on GroovyClassLoader.

{code:java}
if (groovyLoader == null) {
  CompilerConfiguration groovyConfig = new CompilerConfiguration();
  groovyConfig.setOptimizationOptions(Collections.singletonMap("int", false)); // or "indy", true
  groovyLoader = new GroovyClassLoader(GroovyClass.class.getClassLoader(), groovyConfig, true);
}


> Breakpoints aren't working on NetBeans for dynamically loaded Groovy
> --------------------------------------------------------------------
>
>                 Key: GROOVY-8893
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8893
>             Project: Groovy
>          Issue Type: Bug
>          Components: bytecode
>    Affects Versions: 2.4.15
>            Reporter: Blake McBride
>            Priority: Major
>
> 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 & VSCode ignore the breakpoints.
>  
> I do a similar thing with Java files, and NetBeans & VSCode honors those breakpoints.
>  
> There must be something different between dynamically loaded Java and dynamically loaded Groovy.
>  
> Thanks.
>  
> Blake McBride



--
This message was sent by Atlassian Jira
(v8.3.4#803005)