Code Stubs for Semantic Analysis of External References

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing code analysis tools lack precise semantic understanding due to the complexity of compilation and missing dependencies, leading to imprecise results and increased resource requirements.

Innovation Solution

A system that generates stubs for externally referenced code, enabling semantic analysis without full compilation, by retrieving information from code repositories and applying heuristics to select relevant stubs, thus simplifying the analysis process and reducing resource consumption.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If full compilation of reference code is performed to achieve precise semantic understanding, then semantic analysis accuracy is improved, but computing resource consumption increases

Engineering Contradiction:
Improvesemantic analysis accuracyVSAvoidcomputing resource consumption
Core Design Contradiction:
Measurement precisionVSUse of energy by moving object

Solution Approach 1:

The patent segments the reference code into two parts: stubs (interface definitions, signatures, type information) and implementation details. Only the essential stubs are included in the analysis input, while full compilation of the entire reference code is avoided. This segmentation allows semantic analysis to achieve sufficient accuracy without the computational overhead of compiling all reference code.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts only the necessary semantic information (stubs) from the reference code, separating essential interface definitions from implementation details. These extracted stubs are then used to enable semantic analysis without requiring full compilation of the reference code, thus reducing computing resource consumption while maintaining analysis accuracy.

Inventive Principle:
Principle #2Taking out (Extraction)

2Measurement precision

If full compilation of reference code is performed to achieve precise semantic understanding, then semantic analysis accuracy is improved, but system complexity increases

Engineering Contradiction:
Improvesemantic analysis accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system segments the complex compilation process into a simplified two-stage approach: (1) generate stubs from reference code, and (2) perform semantic analysis using only the stubs. This segmentation reduces system complexity by avoiding the need to manage and compile entire reference codebases, while still providing sufficient semantic information for accurate analysis.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts only the essential semantic components (stubs) from the reference code, removing unnecessary implementation details and complexity. This extraction simplifies the analysis input and reduces system complexity while maintaining the accuracy needed for semantic understanding.

Inventive Principle:
Principle #2Taking out (Extraction)

3Productivity

If stubs are generated for external references to reduce resource consumption, then computing efficiency is improved, but semantic analysis precision may deteriorate

Engineering Contradiction:
Improvecomputing efficiencyVSAvoidsemantic analysis precision
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The patent applies local quality by including detailed semantic information (stubs) only where needed in the source code, rather than providing full reference code everywhere. The stubs contain localized, precise information about interfaces, types, and signatures exactly where they are referenced, maintaining semantic analysis precision while improving computing efficiency.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent changes the parameter of reference code representation from full implementation details to condensed stubs with essential semantic information. This parameter change maintains sufficient precision for semantic analysis (interface definitions, type information, signatures) while dramatically improving computing efficiency by reducing the size and complexity of the analysis input.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS12099835B1Semantic analysis of source code using stubs for external references
Publication Date: 2024.09.24 BLACK DUCK SOFTWARE INC
  • US12099835B1 patent drawing
  • US12099835B1 patent drawing
  • US12099835B1 patent drawing

AI summary

A system receives source code for analysis. The system identifies external references to reference code in source code. The reference code is not included in the source code received for analysis. The system generates code stubs corresponding to the external references. Each code stub describes a semantic context for the corresponding external reference. The system provides the set of source code and the one or more code stubs for analysis of the code, for example, using a code analysis tool.