Target Typing for Overloaded Method Argument Resolution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Programming languages that support overloading of methods and constructors face challenges in resolving overload ambiguity when arguments have context-dependent types, as traditional type checking methods rely on complete argument typing, which is not available for context-dependent expressions.

Innovation Solution

Implementing target typing, where the type of context-dependent expressions is inferred by determining the target type expected in a particular context, allowing the overload resolver to check compatibility and specificity of candidate declarations, and generate executable instructions for the most specific declaration.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional type checking methods are used that require complete argument typing before overload resolution, then type safety is maintained, but overload resolution fails for context-dependent expressions

Engineering Contradiction:
Improvetype safetyVSAvoidsupport for context-dependent expressions
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent performs preliminary type compatibility checking between context-dependent expressions and candidate parameter types before final overload resolution. The compiler evaluates whether an expression is compatible with each candidate parameter type in advance, storing this compatibility information for later use in selecting the most specific overload candidate, thus enabling resolution before the expression is fully typed.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces an intermediary compatibility checking mechanism that acts as a bridge between context-dependent expressions and overload resolution. This intermediary process evaluates type compatibility without requiring complete type information, allowing the system to proceed with overload resolution while maintaining type safety through subsequent verification.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If the compiler waits for complete argument type information before performing overload resolution, then accurate type checking is ensured, but compilation time increases and context-dependent expressions cannot be resolved

Engineering Contradiction:
Improvetype checking accuracyVSAvoidcompilation time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent performs preliminary compatibility evaluations between expressions and candidate parameter types during overload resolution, before complete type information is available. This preliminary action allows the compiler to narrow down candidate overloads early in the compilation process, reducing overall compilation time while maintaining accuracy through subsequent type verification.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements a dynamic overload resolution process that adapts to the availability of type information. The compiler can perform compatibility checking with partial type information and refine the resolution process as more type information becomes available, rather than requiring all type information to be complete before starting resolution.

Inventive Principle:
Principle #15Dynamics

3Adaptability or versatility

If multiple overloaded methods are allowed with the same name, then code reusability improves, but ambiguity in overload resolution increases

Engineering Contradiction:
Improvecode reusabilityVSAvoidoverload resolution complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent applies local quality by evaluating type compatibility specifically at the parameter type level for each overload candidate. Rather than requiring global type information for all arguments, the compiler checks compatibility locally for each expression-parameter pair, allowing more flexible overload resolution while maintaining precision where it matters.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent performs preliminary filtering of overload candidates based on type compatibility before applying specificity rules. This preliminary action reduces the number of candidates that need to be compared using complex specificity criteria, thereby reducing overall resolution complexity while preserving code reusability benefits.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9524175B2Target typing of overloaded method and constructor arguments
Publication Date: 2016.12.20 ORACLE INT CORP
  • US9524175B2 patent drawing
  • US9524175B2 patent drawing
  • US9524175B2 patent drawing

AI summary

Methods and apparatus for target typing of overloaded method and constructor arguments are described. A method comprises determining whether source code of a program includes, as an argument to an overloaded operation invocation, an expression whose type is context-dependent. The method further comprises, if the source code includes such an argument, providing the expression as an input to an overload resolver, and determining at the overload resolver whether (a) each argument of the invocation is compatible with types of corresponding parameters in one or more declarations and (b) whether a particular declaration among such a set of declarations can be identified as the most specific. If both conditions are met, the method comprises generating executable instructions for the invocation.