[ 
https://issues.apache.org/jira/browse/GROOVY-11116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles closed GROOVY-11116.
--------------------------------
    Resolution: Information Provided

> Groovy does not handle missing classes gracefully like Java does
> ----------------------------------------------------------------
>
>                 Key: GROOVY-11116
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11116
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.21, 3.0.15, 4.0.9
>            Reporter: Björn Kautler
>            Priority: Major
>
> When executing the snippet
> {code}
> @Grab('club.minnced:discord-webhooks:0.8.2')
> import club.minnced.discord.webhook.WebhookClientBuilder
> new WebhookClientBuilder(1, "").setWait(false)
> {code}
> Groovy fails with a {{ClassNotFoundException}}.
> Also using {{@CompileStatic}} does not help it just changes the thrown error 
> a bit.
> When Groovy tries to initialize the members of {{WebhookClientBuilder}}, it 
> tries to initialize internal method representations for all methods.
> Some of the methods use classes in their signature that are optional for that 
> library.
> From Java this works perfectly fine as long as you don't use any of the 
> methods that need those optional dependencies.
> But in Groovy, this does not work, as Groovy always tries to read all methods 
> fully.
> It would be nice if Groovy could be made more lenient here and only fail if 
> one of the methods with missing dependencies is actually tried to be used.
> The only work-around I found is using the {{WebhookClientBuilder}} only from 
> a Java class that is then used from the Groovy code



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to