use of net.bytebuddy.jar.asm.ModuleVisitor in project mockito by mockito.
the class ModuleUtil method moduleInfo.
private static byte[] moduleInfo(boolean isExported, boolean isOpened) {
ClassWriter classWriter = new ClassWriter(OpenedClassReader.ASM_API);
classWriter.visit(Opcodes.V9, Opcodes.ACC_MODULE, "module-info", null, null, null);
ModuleVisitor mv = classWriter.visitModule("mockito.test", 0, null);
mv.visitRequire("java.base", Opcodes.ACC_MANDATED, null);
mv.visitPackage("sample");
if (isExported) {
mv.visitExport("sample", 0);
}
if (isOpened) {
mv.visitOpen("sample", 0);
}
mv.visitEnd();
classWriter.visitEnd();
return classWriter.toByteArray();
}
Aggregations