From 898dfd89431d39d35de6f5bd6c44e142e88de03b Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Mon, 26 Dec 2016 15:33:39 +0100 Subject: [PATCH] Remove deprecated getInstance() --- CHANGES.md | 3 ++- source/poodinis/container.d | 12 ------------ test/poodinis/containertest.d | 7 ------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ead54af..8e56a53 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,8 @@ Poodinis Changelog * ADD @PostConstruct UDA for marking methods which should be called after a dependency is resolved and autowired. * ADD @PreDestroy UDA for marking methods which should be called when the container loses a dependency's registration. It is called when removeRegistration or clearAllRegistrations is called. It is also called when the container is destroyed. -* FIX nullpointer exception in instance factory when debugging with poodinisVerbose +* FIX nullpointer exception in instance factory when debugging with poodinisVerbose. +* REMOVE previously deprecated getInstance(). **Version 7.0.1** * FIX codegeneration of constructor injection factories for constructors with dependencies from foreign modules, diff --git a/source/poodinis/container.d b/source/poodinis/container.d index df7f5aa..d29bd35 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -437,18 +437,6 @@ synchronized class DependencyContainer { } } - /** - * Returns a global singleton instance of a dependency container. - * Deprecated: create new instance with new keyword or implement your own singleton factory (method) - */ - deprecated public static shared(DependencyContainer) getInstance() { - static shared DependencyContainer instance; - if (instance is null) { - instance = new DependencyContainer(); - } - return instance; - } - /** * Apply persistent registration options which will be used everytime register() is called. */ diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index c274983..217ba25 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -53,13 +53,6 @@ version(unittest) { assertThrown!ResolveException(container.resolve!TestClass, "Resolving cleared type does not fail"); } - // Test get singleton of container (DEPRECATED) - unittest { - auto instance1 = DependencyContainer.getInstance(); - auto instance2 = DependencyContainer.getInstance(); - assert(instance1 is instance2, "getInstance does not return the same instance"); - } - // Test resolve single instance for type unittest { auto container = new shared DependencyContainer();