All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.chains_project.collector.module.ModuleCracker Maven / Gradle / Ivy

package io.github.chains_project.collector.module;

import java.lang.instrument.Instrumentation;

public interface ModuleCracker {

    void crack(Class source);

    static ModuleCracker noop() {
        return source -> {};
    }

    static ModuleCracker getApplicable(Instrumentation instrumentation) {
        try {
            Class.forName("java.lang.Module");
        } catch (ClassNotFoundException ignored) {
            return ModuleCracker.noop();
        }

        try {
            return (ModuleCracker) Class.forName("io.github.chains_project.collector.module.Java9ModuleCracker")
                    .getDeclaredConstructors()[0]
                    .newInstance(instrumentation);
        } catch (ReflectiveOperationException e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy