Fix compiler crash when service enumerated in META-INF/service does not exist

This commit is contained in:
Alexey Andreev 2017-11-16 16:16:10 +03:00
parent 07f946e710
commit 2f73272ed7

View File

@ -62,9 +62,11 @@ public class ServiceLoaderSupport extends AbstractDependencyListener implements
writer.append(", "); writer.append(", ");
} }
String implName = implementations.get(i); String implName = implementations.get(i);
writer.append("[").appendClass(implName).append(", ").appendMethodBody( if (context.getClassSource().getClassNames().contains(implName)) {
new MethodReference(implName, new MethodDescriptor("<init>", ValueType.VOID))) writer.append("[").appendClass(implName).append(", ").appendMethodBody(
.append("]"); new MethodReference(implName, new MethodDescriptor("<init>", ValueType.VOID)))
.append("]");
}
} }
writer.append("];").softNewLine(); writer.append("];").softNewLine();
} }