Annotations

Monkey C allows associating symbols with class or module methods and variables. These symbols are currently written into the debug.xml file generated by the compiler, but may be used in the future to add new features without changing the Monkey C grammar:

(:debug) class TestMethods
{
    (:test) static function testThisClass( x )
}

The following annotations have special meanings to the Monkey C compiler:

:background

Denotes code blocks available to the Background process.

:debug

Code blocks decorated with this annotation will not be included in release builds at compile time.

:glance

Denotes code blocks available to when running in Glance Mode.

:release

Code blocks decorated with this annotation will not be included in debug builds at compile time.

:test

Denotes test cases that are used as Run No Evil unit tests and are excluded from the application at compile time.

:typecheck

Code blocks decorated with this annotation can direct the type checker to perform / avoid certain checks.

:initialized

Member variables decorated with this annotation directs the type checker that it is safe to assume the variable will be initialized before it is referenced.

:extendedCode (API Level 5.1.0)

Code in extended code space is paged in during runtime on demand. For supported devices, this provides 16 megabytes of code space beyond what is loaded into the heap. When building for supported products, the compiler will move those functions into extended code space. Code in extended code space is paged in memory using a “most recently used” strategy, but there can be a performance penalty if code must be paged in. Code that is performance-dependent should be kept out of extended code space to avoid the additional performance hit.

:optimizer(do_not_remove)

Constants decorated with this annotation directs the optimizer to disable constant substitution on references to the constant. Instead, the constant will be looked up at runtime.