Code Detection Using Class Loader for Accuracy

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional static code detection methods face challenges such as version mismatches between detection tools and programming languages, and inconsistencies between detection environments and actual compilation environments, leading to low accuracy in code detection results.

Innovation Solution

A code detection method and apparatus that utilizes a class loader to obtain first class information of the code to be detected, and performs code detection based on this information, thereby improving detection accuracy by aligning with the actual compilation environment.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If static detection is used to test code, then detection speed is improved, but detection accuracy deteriorates due to version mismatches and environment inconsistencies

Engineering Contradiction:
Improvedetection speedVSAvoiddetection accuracy
Core Design Contradiction:
SpeedVSMeasurement precision

Solution Approach 1:

The patent applies preliminary action by pre-loading the code into the JVM and obtaining class information through a class loader before detection occurs. This prepares the code in its actual runtime environment, ensuring version alignment and environment consistency prior to detection, thereby resolving the accuracy issues while maintaining detection efficiency

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces a class loader as an intermediary between the detection system and the code being detected. This intermediary retrieves class information from the actual compilation environment within the JVM, serving as a bridge that ensures version compatibility and environment consistency, thus improving detection accuracy without sacrificing speed

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If version alignment between detection tool and programming language is achieved, then detection accuracy is improved, but system complexity increases

Engineering Contradiction:
Improvedetection accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent applies self-service by leveraging the JVM's built-in class loading mechanism and reflection capabilities. The system uses the programming language's own runtime environment and class loader to retrieve version-aligned class information, eliminating the need for external version management tools or complex synchronization mechanisms, thus improving accuracy without significantly increasing system complexity

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS20250190335A1Code detection method and apparatus, electronic device, and storage medium
Publication Date: 2025.06.12 LEMON INC(GB)
  • US20250190335A1 patent drawing
  • US20250190335A1 patent drawing
  • US20250190335A1 patent drawing

AI summary

Embodiments of the present disclosure provide a code detection method and apparatus, an electronic device, and a storage medium. The method includes: loading code to be detected; obtaining, through a class loader, first class information of the code to be detected; and performing code detection on the code to be detected based on class information of the code to be detected, to obtain a detection result of the code to be detected, where the class information includes the first class information.