Detecting Implicit Receiver Errors in Function Calls

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Programming errors often go undetected when the 'this' parameter is omitted in function calls, leading to unexpected program behaviors, as some languages implicitly bind 'this' without explicit specification, making it difficult for commercial static analysis tools to identify these mistakes effectively.

Innovation Solution

A code testing system that analyzes function call sites to identify omissions of the 'this' parameter by using two sub-analyses: one to determine if a function uses the 'this' parameter meaningfully and another to generate a callgraph to identify potential receiver functions, thereby detecting errors before execution-based testing without imposing new coding conventions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If commercial static analysis tools are used to detect software defects, then general programming errors can be identified, but errors related to implicit 'this' parameter binding are not detected

Engineering Contradiction:
Improveerror detection accuracyVSAvoidlanguage feature coverage
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The analysis is divided into two independent sub-analyses: one that identifies receiver functions by examining function definitions and 'this' parameter usage, and another that generates callgraphs to identify function call sites. This segmentation allows each analysis to specialize in its specific task, improving overall detection accuracy for implicit 'this' parameter errors.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

A callgraph is introduced as an intermediary data structure that connects function definitions to their call sites. The callgraph enables the system to trace which functions may be called at each call site, allowing the analysis to determine whether an implicit 'this' parameter binding could occur without requiring direct execution or complex language-specific parsing.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If execution-based testing is used to detect errors, then runtime behavior can be observed, but errors cannot be detected before program execution

Engineering Contradiction:
Improveerror detection reliabilityVSAvoidtesting time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs static analysis of function definitions and call sites before program execution to identify potential errors. By analyzing the code structure and calling patterns in advance, the system can detect implicit 'this' parameter binding errors during the coding phase, eliminating the need for time-consuming execution-based testing to catch these specific errors.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If new coding conventions are imposed on programmers, then error prevention can be improved, but ease of operation deteriorates

Engineering Contradiction:
Improveerror preventionVSAvoidprogramming convenience
Core Design Contradiction:
ReliabilityVSEase of operation

Solution Approach 1:

The system automatically analyzes existing code to identify functions that use the 'this' parameter and generates warnings at call sites where the receiver object is omitted. This self-service approach allows the tool to adapt to existing coding conventions without requiring programmers to change their coding style, maintaining ease of operation while improving error prevention.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS10474555B2Detecting errors for function calls with an implicit receiver object
Publication Date: 2019.11.12 BLACK DUCK SOFTWARE INC
  • US10474555B2 patent drawing
  • US10474555B2 patent drawing
  • US10474555B2 patent drawing

AI summary

A code testing system identifies possible code errors that may generate unexpected application behaviors. The code testing system identifies function calls in the system by identifying function call sites that do not specify a receiver object but may invoke a function that uses a receiver object. To identify these call sites, the code testing system analyzes function operation to determine receiver functions that use a receiver object, and may exclude functions that use the receiver object in a pro forma way or that does not rely on or affect properties of the object. A callgraph is generated for the functions in the code to identify possible functions called from a call site. When a call site, based on the callgraph, may invoke a receiver function, the call site is analyzed to determine whether it specifies a receiver object for the called function and identifies an error when the call site does not specify a receiver object.