You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2018/03/05 00:50:00 UTC
[jira] [Resolved] (GROOVY-8475) CLONE - I am unable to instantiate
objects using the "new" keyword
[ https://issues.apache.org/jira/browse/GROOVY-8475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Wagenleitner resolved GROOVY-8475.
---------------------------------------
Resolution: Fixed
Assignee: John Wagenleitner
Fix Version/s: 2.4.15
Thanks for reporting the issue.
> CLONE - I am unable to instantiate objects using the "new" keyword
> ------------------------------------------------------------------
>
> Key: GROOVY-8475
> URL: https://issues.apache.org/jira/browse/GROOVY-8475
> Project: Groovy
> Issue Type: Bug
> Components: Groovysh
> Affects Versions: 2.4.0, 2.4.12, 2.4.13
> Environment: Linux - Debian jessie/sid 64 bits
> Linux - Ubuntu 16 64 bits
> Reporter: Rémy Letient
> Assignee: John Wagenleitner
> Priority: Major
> Fix For: 2.4.15
>
> Attachments: image-2018-02-10-18-36-27-122.png, testA.groovy
>
>
> I am embedding Groovysh in a java application. After some tests, I realized that the "new" keyword seems to not work in the last groovysh version. When I try to do:
> {code}a = new A(){code}
> I obtain: "unable to resolve class A"
> This is an example:
> {code}
> groovy:000> class A {
> class A {
> groovy:001> public A() {
> public A() {
> groovy:002> name = "default"
> name = "default"
> groovy:003> }
> }
> groovy:004> String name;
> String name;
> groovy:005> }
> }
> ===> true
> groovy:000> a = new A()
> a = new A()
> ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
> startup failed:
> script14159599676571305654112.groovy: 1: unable to resolve class A
> @ line 1, column 5.
> a = new A()
> ^
> 1 error
> {code}
> However, if I use the newInstance method it works:
> {code}
> groovy:000> a = A.newInstance()
> a = A.newInstance()
> ===> A@2154cecb
> {code}
> I tested the same code in the previous version (2.3.7) and it works
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)