Java Annotation Injection at Runtime

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing Java deployment methods require modifying and recompiling source code to change annotations, making it cumbersome and non-scalable for customers to customize configurations, especially since modifications cannot be made dynamically during runtime.

Innovation Solution

The technique involves generating and injecting Java annotations at runtime or build time without access to the original source code, using instrumentation libraries or bytecode manipulation tools to add or modify annotations directly in the compiled source code, allowing for dynamic changes without recompilation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If annotations are compiled as part of the source code, then the metadata information is maintained as part of the program, but modifying the annotations requires source code modification, recompilation, and repackaging which is time-consuming and cannot be done dynamically at runtime

Engineering Contradiction:
Improvemetadata integrationVSAvoidmodification time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent separates the annotation modification process from the source code. Annotations are extracted as independent deployable units that can be modified and injected without touching the original source code, enabling independent modification cycles

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary mechanism (annotation injection tool) that acts as a bridge between the annotation definition and the compiled component. This intermediary allows annotations to be injected into the class file at runtime without requiring source code access or recompilation

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If deployment descriptors are used as external configuration files, then they can be changed without modifying source code, but the package must be unpackaged and repackaged after modification which is cumbersome and less scalable

Engineering Contradiction:
Improveconfiguration modificationVSAvoidpackage management
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The patent merges the advantages of both approaches by combining the external configurability of deployment descriptors with the integrated nature of annotations. Annotations are injected into the compiled code but can be modified externally through class file manipulation, merging the benefits of both methods

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent replaces the mechanical package unpacking/modifying/repackaging process with an automated annotation injection mechanism that directly modifies class files at runtime, eliminating the need for manual package management operations

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Adaptability or versatility

If source code possession is required to modify annotations, then customization is possible, but customers rarely possess source code and must request changes from software providers

Engineering Contradiction:
Improvecustomization capabilityVSAvoidmodification accessibility
Core Design Contradiction:
Adaptability or versatilityVSEase of operation

Solution Approach 1:

The patent introduces an intermediary tool that enables customers to modify annotations without possessing source code. The tool injects annotations directly into class files, acting as a mediator between the customer's customization needs and the compiled component

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent enables customers to perform annotation modifications themselves without needing to contact software providers. The annotation injection mechanism allows end-users to independently customize components by injecting annotations into class files

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS9471345B2Runtime generation and injection of java annotations
Publication Date: 2016.10.18 SAP SE
  • US9471345B2 patent drawing
  • US9471345B2 patent drawing
  • US9471345B2 patent drawing

AI summary

An annotation generator utility is implemented. The annotation generator utility reads, from a properties file, configurations of a Java component. The annotation generator utility generates annotations corresponding to the configurations. The annotation generator utility injects the annotations into compiled source code of the Java component. In one aspect, the annotations are injected into compiled source code of the Java component at build time. In another aspect, the annotations are injected into compiled source code of the Java component at runtime.