Add constructor invokers to refmap when type is implied, closes #454

This commit is contained in:
Mumfrey committed 2024-05-12 21:31:13 +01:00
1 parent 5f57d5006b
commit f0d2cd21df
1 file changed
+11 -3
@@ -138,7 +138,7 @@ class AnnotatedMixinElementHandlerAccessor extends AnnotatedMixinElementHandler
static class AnnotatedElementInvoker extends AnnotatedElementAccessor {
private AccessorType type = AccessorType.METHOD_PROXY;
public AnnotatedElementInvoker(ExecutableElement element, AnnotationHandle annotation, IMixinContext context, boolean shouldRemap) {
super(element, annotation, context, shouldRemap);
}
@@ -165,16 +165,24 @@ class AnnotatedMixinElementHandlerAccessor extends AnnotatedMixinElementHandler
for (String prefix : AccessorType.OBJECT_FACTORY.getExpectedPrefixes()) {
if (prefix.equals(accessorName.prefix)
&& (Constants.CTOR.equals(accessorName.name) || target.getSimpleName().equals(accessorName.name))) {
&& (Constants.CTOR.equals(accessorName.name) || target.getSimpleName().equalsIgnoreCase(accessorName.name))) {
this.type = AccessorType.OBJECT_FACTORY;
return;
}
}
}
@Override
public String getAnnotationValue() {
String value = super.getAnnotationValue();
return (this.type == AccessorType.OBJECT_FACTORY && value == null) ? this.returnType.toString() : value;
}
@Override
public boolean shouldRemap() {
return (this.type == AccessorType.METHOD_PROXY || this.getAnnotationValue() != null) && super.shouldRemap();
return (this.type == AccessorType.OBJECT_FACTORY
|| this.type == AccessorType.METHOD_PROXY
|| this.getAnnotationValue() != null) && super.shouldRemap();
}
@Override