Skip to content

INFINITE-TECHNOLOGY/CARBURETOR

Repository files navigation

Infinite Technology ∞ Carburetor 🌀

Parameterized Groovy AST method Transformer

Carburetor is a device that mixes air and fuel for internal combustion engines in the proper air–fuel ratio for combustion.
@Carburetor-based annotations are mixing the auto-generated "infrastructural" code with the user code - thus its name.

References:

Attribute\Release type Latest Stable
Version 4.0.0-SNAPSHOT 3.0.x
Branch master CARBURETOR_3_0_X
CI Build status Build Status Build Status
Test coverage codecov codecov
Library (Maven) oss.jfrog.org snapshot Download

Purpose

Carburetor is not an end-user solution. It is a basis for other end-user solutions (such as Blackbox) providing compile-time code transformation implementation and a runtime API.

Carburetor provides a foundation for other libraries to automatically generate Groovy Semantic handling code based on Carburetor configuration and inject it into User code during the Compilation stage resulting in a possibility to intercept and interact with application run-time events including their corresponding compile-time metadata (class name, method name, line start, line end, column start, column end, ASTNode class name):

  • Method/constructor Start
  • Method Result return
  • Method/constructor End
  • Method/constructor Exception
  • Statement Start
  • Statement Start
  • Statement End
  • Control Statements (return, break, continue, throw)
  • Expression evaluation Start
  • Expression evaluation Result
  • Expression evaluation Exception
  • Expression evaluation End

In short

Carburetor-based annotations inject a lot of implementation-specific infrastructure code (such as logging, profiling, security, etc) without affecting the user program logic.

Granularity of injected code can be defined by the user (programmer) up to:

  • Method Exceptions handling (exception and causing method arguments are handled)
  • Method invocation handling (method arguments and result are handled)
  • Statement-level handling
  • Expression-level handling