mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Fix deprecation warnings when resolving post-constructors and pre-destructors (fix #43)
This commit is contained in:
parent
d4ce13f8b1
commit
dfac28102e
|
@ -370,16 +370,17 @@ class AutowiredRegistration(RegistrationType : Object) : Registration
|
||||||
void delegate() preDestructor = null;
|
void delegate() preDestructor = null;
|
||||||
foreach (memberName; __traits(allMembers, RegistrationType))
|
foreach (memberName; __traits(allMembers, RegistrationType))
|
||||||
{
|
{
|
||||||
mixin(createImportsString!RegistrationType);
|
foreach (overload; __traits(getOverloads, instance, memberName))
|
||||||
enum QualifiedName = fullyQualifiedName!RegistrationType ~ `.` ~ memberName;
|
{
|
||||||
static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName)))
|
static if (__traits(compiles, __traits(getProtection, overload))
|
||||||
&& __traits(getProtection, __traits(getMember, instance, memberName)) == "public"
|
&& __traits(getProtection, overload) == "public"
|
||||||
&& isFunction!(mixin(QualifiedName))
|
&& isFunction!overload
|
||||||
&& hasUDA!(__traits(getMember, instance, memberName), PreDestroy))
|
&& hasUDA!(overload, PreDestroy))
|
||||||
{
|
{
|
||||||
preDestructor = &__traits(getMember, instance, memberName);
|
preDestructor = &__traits(getMember, instance, memberName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return preDestructor;
|
return preDestructor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,17 +471,18 @@ synchronized class DependencyContainer
|
||||||
{
|
{
|
||||||
foreach (memberName; __traits(allMembers, Type))
|
foreach (memberName; __traits(allMembers, Type))
|
||||||
{
|
{
|
||||||
mixin(createImportsString!Type);
|
foreach (overload; __traits(getOverloads, instance, memberName))
|
||||||
enum QualifiedName = fullyQualifiedName!Type ~ `.` ~ memberName;
|
{
|
||||||
static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName)))
|
static if (__traits(compiles, __traits(getProtection, overload))
|
||||||
&& __traits(getProtection, __traits(getMember, instance, memberName)) == "public"
|
&& __traits(getProtection, overload) == "public"
|
||||||
&& isFunction!(mixin(QualifiedName))
|
&& isFunction!overload
|
||||||
&& hasUDA!(__traits(getMember, instance, memberName), PostConstruct))
|
&& hasUDA!(overload, PostConstruct))
|
||||||
{
|
{
|
||||||
__traits(getMember, instance, memberName)();
|
__traits(getMember, instance, memberName)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all dependency registrations managed by this container.
|
* Clears all dependency registrations managed by this container.
|
||||||
|
|
|
@ -804,4 +804,19 @@ version (unittest)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AutowiredMethod
|
||||||
|
{
|
||||||
|
@Autowire
|
||||||
|
public int lala()
|
||||||
|
{
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowire
|
||||||
|
public int lala(int valla)
|
||||||
|
{
|
||||||
|
return valla;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue