Incremental Modification Detector for Java Annotation Processing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The existing Annotation Processing Tool (APT) in Java software development reprocesses all annotations every time a modification is made to the source code, regardless of the extent or nature of the change, leading to unnecessary re-execution of annotation processors and increased compilation time, which negatively affects productivity and resource utilization.

Innovation Solution

An incremental modification detecting tool (IMDT) is introduced to selectively reprocess annotations by calculating hash values for annotations and their structural members, comparing these values with stored snapshots, and only invoking processors for annotations that have changed, thereby reducing unnecessary reprocessing.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If all annotations are reprocessed every time source code is modified, then annotation processing completeness is ensured, but compilation time increases and productivity decreases

Engineering Contradiction:
Improveannotation processing completenessVSAvoidcompilation speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent segments the annotation processing task by dividing annotations into groups that are processed separately. Each annotation processor handles only its specific annotations rather than all annotations in the source file, enabling selective reprocessing based on which annotations have actually changed.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements partial action by reprocessing only the subset of annotations that have changed since the last compilation, rather than reprocessing all annotations. The system identifies changed annotations through timestamp comparison and invokes only the necessary annotation processors for those specific annotations.

Inventive Principle:
Principle #16Partial or excessive action

2Measurement precision

If annotation processors are invoked on every source file modification, then all annotation changes are detected, but computing resources are wasted on unchanged annotations

Engineering Contradiction:
Improvedetection accuracy of annotation changesVSAvoidcomputing resource utilization
Core Design Contradiction:
Measurement precisionVSLoss of energy

Solution Approach 1:

The patent performs preliminary action by calculating and storing timestamp information for each annotation during the initial processing. This timestamp data is saved in a snapshot file, allowing the system to quickly determine which annotations have changed without reprocessing them, thus conserving computing resources.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements feedback by comparing current annotation timestamps with previously stored timestamps from snapshot files. This feedback mechanism identifies which annotations have actually changed and triggers annotation processor invocation only for those specific annotations, avoiding waste of computing resources on unchanged annotations.

Inventive Principle:
Principle #23Feedback

3Reliability

If the default APT behavior processes all source files, then no annotation changes are missed, but the compilation cycle is unnecessarily extended

Engineering Contradiction:
Improveannotation processing completenessVSAvoidcompilation cycle duration
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies partial action by processing only the necessary subset of source files and annotations that have changed, rather than processing all source files. The system uses timestamp comparison to identify changed annotations and invokes annotation processors only for those specific cases, reducing compilation cycle time while maintaining processing completeness.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS7966602B1Incremental modification detector, and methods, systems, and apparatus for implementing the same
Publication Date: 2011.06.21 ORACLE AMERICAN INC
  • US7966602B1 patent drawing
  • US7966602B1 patent drawing
  • US7966602B1 patent drawing

AI summary

A method for selecting an annotation processor associated with an annotation for reprocessing is provided. The annotation is included in a computer software source code. An annotation snapshot is captured and a hash value is generated for the annotation snapshot. The annotation snapshot hash value is compared with a hash value of a previous annotation snapshot. The annotation processor associated with the annotation is marked for reprocessing when the annotation snapshot hash value is different from the hash value of the previous annotation snapshot.