Decomposing Generic Classes Into Layers For Expanded Type Support
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing programming languages, such as Java, face challenges in expanding the domain of genericity to include both reference and primitive types due to built-in assumptions, which limits the flexibility and compatibility of generic classes.
Innovation Solution
The approach involves decomposing generic classes into multiple layers, allowing for a fully generic layer that supports expanded domains and a restricted layer that maintains compatibility with existing implementations, enabling the use of primitive and value types while preserving binary, source, and behavioral compatibility.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If generic classes are written with assumptions about restricted domain (e.g., reference types only), then implementation is simpler and existing code is more compatible, but the ability to generify over broader domain (e.g., including primitive types) is more difficult or problematic
Solution Approach 1:
The patent applies segmentation by dividing a generic class into multiple layers: a restricted layer that maintains compatibility with existing code and an expanded layer that supports broader genericity domains. This layering allows the class to function correctly for both reference types and primitive types without requiring complete rewriting of existing implementations.
Solution Approach 2:
The patent introduces a new dimension to class structure by adding layers. Instead of modifying the existing single-layer class structure, it adds dimensional depth through layered architecture, where each layer handles specific aspects of genericity requirements.
2Adaptability or versatility
If generic classes are expanded to support broader domain (e.g., primitive and value types), then flexibility and reusability are enhanced, but compatibility with existing implementations and clients may be compromised
Solution Approach 1:
By segmenting the class into restricted and expanded layers, the patent ensures that existing clients continue to interact with the restricted layer which maintains original behavior and compatibility guarantees, while the expanded layer provides additional capabilities for new use cases.
Solution Approach 2:
The patent performs preliminary action by explicitly designing the restricted layer to preserve existing compatibility requirements before adding expanded functionality. This ensures that legacy code continues to work without modification while new code can leverage extended capabilities.
3Adaptability or versatility
If methods with built-in assumptions about domain of genericity are retained, then existing code continues to work, but the class cannot be used with types outside the assumed domain
Solution Approach 1:
Methods are segmented and placed in appropriate layers based on their domain assumptions. Methods with built-in assumptions about reference types are placed in the restricted layer, while new methods or overloaded methods supporting primitive types are placed in the expanded layer, allowing seamless usage across different type domains.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
The domain of genericity of an existing generic class may be expanded to include not just reference types, but also primitive and value types even though some members of the existing class do not support the expanded genericity. A subdivided version of the class may be created that includes a generic layer including abstract versions of class members and a reference-specific layer that including non- abstract versions of class members that are abstract in the generic layer. The subdivided version of the class may also include information that indicates to which layer a class member belongs. Problematic methods (e.g., methods that have built-in assumptions regarding the domain of genericity) may be moved into the second, reference-specific, layer, thereby retaining compatibility with classes that currently instantiate or reference those methods, while still allowing use within the expanded domain of genericity.