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 2023/09/03 13:49:00 UTC
[jira] [Closed] (GROOVY-5013) Instantioantion object of class with private constructor
[ https://issues.apache.org/jira/browse/GROOVY-5013?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles closed GROOVY-5013.
-------------------------------
Resolution: Information Provided
> Instantioantion object of class with private constructor
> --------------------------------------------------------
>
> Key: GROOVY-5013
> URL: https://issues.apache.org/jira/browse/GROOVY-5013
> Project: Groovy
> Issue Type: Sub-task
> Components: groovy-jdk
> Affects Versions: 1.8.2
> Reporter: Pavel Alexeev
> Priority: Major
>
> I have try use standard Singleton pattern in groovy script:
> {code:java}
> public class SingleTest {
> private static final Instance = new SingleTest();
> private SingleTest(){ }
> public SingleTest getInstance(){
> return Instance;
> }
> void test(){
> println 'test';
> }
> }
> SingleTest test = new SingleTest();
> test.test();
> {code}
> But groovy instantiate object even if constructor marked as private:
> {noformat}
> D:\imus\IdeaProjects\imus\instup\src\main\java\test-private-constructor>groovy test.groovy
> test
> {noformat}
> P.S. Sorry for noise with http://jira.codehaus.org/browse/GROOVY-5012 I'd expect what in cloning process I can be able change description of bug.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)