From 3d9a4497668814dbc2027562ee8ef3657942fd55 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 17 Dec 2016 23:58:37 +0100 Subject: [PATCH] Fix aliases tripping up UDA discovery --- source/poodinis/autowire.d | 3 ++- source/poodinis/container.d | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index 7b3c728..cfc2708 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -265,7 +265,8 @@ class AutowiredRegistration(RegistrationType : Object) : Registration { private void delegate() getPreDestructor(RegistrationType instance) { void delegate() preDestructor = null; foreach (memberName; __traits(allMembers, RegistrationType)) { - static if (__traits(getProtection, __traits(getMember, instance, memberName)) == "public" + static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) + && __traits(getProtection, __traits(getMember, instance, memberName)) == "public" && isCallable!(__traits(getMember, instance, memberName)) && hasUDA!(__traits(getMember, instance, memberName), PreDestroy)) { preDestructor = &__traits(getMember, instance, memberName); diff --git a/source/poodinis/container.d b/source/poodinis/container.d index ab08e52..3b85e9c 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -391,7 +391,8 @@ synchronized class DependencyContainer { private void callPostConstructors(Type)(Type instance) { foreach (memberName; __traits(allMembers, Type)) { - static if (__traits(getProtection, __traits(getMember, instance, memberName)) == "public" + static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) + && __traits(getProtection, __traits(getMember, instance, memberName)) == "public" && isCallable!(__traits(getMember, instance, memberName)) && hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) { __traits(getMember, instance, memberName)();