private void parse()

in bytekit-core/src/main/java/com/alibaba/bytekit/asm/instrument/InstrumentTemplate.java [140:181]


    private void parse(InstrumentParseResult result, byte[] classBytes, boolean triggerRetransform) {
        ClassNode classNode = AsmUtils.toClassNode(classBytes);

        if (!AsmUtils.fitCurrentJvmMajorVersion(classNode)) {
            logger.error(
                    "The current jvm major version is {}, less than the Instrument class major version: {}, ignore this class: {}",
                    AsmUtils.currentJvmMajorVersion(), AsmUtils.getMajorVersion(classNode.version), classNode.name);
            return;
        }

        // 清除apm类的行号
        AsmUtils.removeLineNumbers(classNode);

        boolean updateMajorVersion = Boolean.parseBoolean((String) AsmAnnotationUtils.queryAnnotationValue(classNode.visibleAnnotations,
                Type.getDescriptor(Instrument.class), "updateMajorVersion"));

        List<String> matchClassList = AsmAnnotationUtils.queryAnnotationArrayValue(classNode.visibleAnnotations,
                Type.getDescriptor(Instrument.class), "Class");

        if (matchClassList != null && !matchClassList.isEmpty()) {
            SimpleClassMatcher classMatcher = new SimpleClassMatcher(matchClassList);
            result.addInstrumentConfig(new InstrumentConfig(classNode, classMatcher, updateMajorVersion, triggerRetransform));
        }

        List<String> matchSuperclassList = AsmAnnotationUtils.queryAnnotationArrayValue(classNode.visibleAnnotations,
                Type.getDescriptor(Instrument.class), "Superclass");

        if (!matchSuperclassList.isEmpty()) {
            SimpleSubclassMatcher matcher = new SimpleSubclassMatcher(matchSuperclassList);
            result.addInstrumentConfig(new InstrumentConfig(classNode, matcher, updateMajorVersion, triggerRetransform));
        }

        List<String> matchInterfaceList = AsmAnnotationUtils.queryAnnotationArrayValue(classNode.visibleAnnotations,
                Type.getDescriptor(Instrument.class), "Interface");

        if (!matchInterfaceList.isEmpty()) {
            SimpleInterfaceMatcher matcher = new SimpleInterfaceMatcher(matchInterfaceList);
            result.addInstrumentConfig(new InstrumentConfig(classNode, matcher, updateMajorVersion, triggerRetransform));
        }

        // TODO 处理 @NewField
    }