1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-01-10 20:27:58 +01:00

ImplementationFactory: Avoid accessing subclass in parent class initialization

This commit is contained in:
Paul Schaub 2021-08-15 15:40:04 +02:00
parent 8539157405
commit adc69caa51

View file

@ -42,13 +42,16 @@ import org.pgpainless.util.Passphrase;
public abstract class ImplementationFactory {
private static ImplementationFactory FACTORY_IMPLEMENTATION = new BcImplementationFactory();
private static ImplementationFactory FACTORY_IMPLEMENTATION;
public static void setFactoryImplementation(ImplementationFactory implementation) {
FACTORY_IMPLEMENTATION = implementation;
}
public static ImplementationFactory getInstance() {
if (FACTORY_IMPLEMENTATION == null) {
FACTORY_IMPLEMENTATION = new BcImplementationFactory();
}
return FACTORY_IMPLEMENTATION;
}