Dynamic Method Invocation Compilation in Statically-Typed Languages

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Statically-typed programming languages face challenges in compiling and executing dynamically-typed method calls, particularly when such calls contain illegal characters or require type definitions not available at compile-time, leading to inefficiencies and errors.

Innovation Solution

A method and system that differentiate between static and dynamic method calls in a statically-typed programming environment, allowing dynamic method invocations to be compiled without type checking and enabling the use of reserved types for dynamically-typed methods, thus avoiding compile-time method selection and illegal character errors.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If type checking is performed at compile-time for all method calls in a statically-typed programming language, then type safety is ensured, but dynamically-typed method calls containing illegal characters or requiring type definitions not available at compile-time cannot be compiled

Engineering Contradiction:
Improvesupport for dynamically-typed method callsVSAvoidtype safety
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent segments method calls into two distinct categories: static method calls and dynamic method calls. Static method calls undergo traditional compile-time type checking, while dynamic method calls are handled differently. This segmentation allows the system to maintain type safety for static calls while enabling flexibility for dynamic calls through runtime resolution, resolving the contradiction between adaptability and reliability.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary mechanism (dynamic method invocation interface) that bridges statically-typed and dynamically-typed method calls. This intermediary allows dynamic method calls with illegal characters or undefined types to be compiled without triggering type checking errors, while still maintaining type safety through runtime validation. The intermediary acts as a mediator that reconciles the conflicting requirements of compile-time type safety and runtime flexibility.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If traditional reflective API calls are used to handle dynamic method invocations, then dynamically-typed methods can be invoked, but processing efficiency decreases and resource usage increases

Engineering Contradiction:
Improvedynamic method invocation capabilityVSAvoidprocessing efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent performs preliminary actions during the compilation phase by creating optimized method invocation structures for dynamic method calls. Instead of using heavy reflective API calls at runtime, the compiler prepares optimized bytecode that directly invokes dynamic methods with reduced overhead. This preliminary preparation eliminates the need for inefficient runtime reflection, thereby improving processing efficiency while maintaining dynamic method invocation capability.

Inventive Principle:
Principle #10Preliminary action

3Manufacturing precision

If compile-time method selection is performed for all method calls, then type definitions must be available at compile-time, but this causes errors when type definitions are not available

Engineering Contradiction:
Improvemethod selection accuracyVSAvoidhandling of methods without compile-time type definitions
Core Design Contradiction:
Manufacturing precisionVSAdaptability or versatility

Solution Approach 1:

The patent introduces dynamic method invocation as a distinct mechanism that operates differently from static method calls. For dynamic method calls, the system does not require type definitions to be available at compile-time. Instead, method selection and validation are performed dynamically at runtime based on actual type information. This dynamic approach allows the system to handle methods without compile-time type definitions while maintaining method selection accuracy through runtime type checking.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS8387027B2Method and system for compiling a dynamically-typed method invocation in a statically-typed programming language
Publication Date: 2013.02.26 ORACLE AMERICAN INC
  • US8387027B2 patent drawing
  • US8387027B2 patent drawing
  • US8387027B2 patent drawing

AI summary

A method for compiling source code, involving: obtaining a statement of the source code comprising a method call, where the source code is composed in a statically-typed programming language; determining whether the method call is a dynamic method call; upon determining that the method call is a dynamic method call, compiling a dynamic method invocation without performing type checking on the method call; upon determining that the method call is not a dynamic method call: performing type checking on the method call, selecting a target method to invoke, and compiling a static method invocation to invoke the target method.