8.1 Built-in Compiler Metadata
Starting from Haxe 3.0, you can get the list of defined compiler metadata by running haxe --help-metas
Global metadata
| Metadata | Description | Platform |
|---|---|---|
| @:abi | Function ABI/calling convention | cpp |
| @:abstract | Sets the underlying class implementation as abstract type | cs java |
| @:access (Target path) | Forces private access to package type or field, see Access Control | all |
| @:allow (Target path) | Allows private access from package type or field, see Access Control | all |
| @:analyzer | Used to configure the static analyzer | all |
| @:annotation | Annotation (<code>@interface</code>) definitions on -java-lib imports will be annotated with this metadata. Has no effect on types compiled by Haxe |
java |
| @:arrayAccess | Allows Array access on an abstract | all |
| @:autoBuild (Build macro call) | Extends <code>@:build</code> metadata to all extending and implementing classes. See Macro autobuild | all |
| @:bind | Override Swf class declaration | flash |
| @:bitmap (Bitmap file path) | _Embeds given bitmap data into the class (must extend flash.display.BitmapData) |
flash |
| @:bridgeProperties | Creates native property bridges for all Haxe properties in this class | cs |
| @:build (Build macro call) | Builds a class or enum from a macro. See Type Building | all |
| @:buildXml | Specify xml data to be injected into Build.xml | cpp |
| @:callable | Abstract forwards call to its underlying type | all |
| @:classCode | Used to inject platform-native code into a class | cs java |
| @:commutative | Declares an abstract operator as commutative | all |
| @:compilerGenerated | Marks a field as generated by the compiler. Shouldn't be used by the end user | cs java |
| @:coreApi | Identifies this class as a core api class (forces Api check) | all |
| @:coreType | Identifies an abstract as core type so that it requires no implementation | all |
| @:cppFileCode | Code to be injected into generated cpp file | cpp |
| @:cppInclude | File to be included in generated cpp file | cpp |
| @:cppNamespaceCode | cpp | |
| @:dce | Forces Dead Code Elimination even when not -dce full is specified |
all |
| @:debug | Forces debug information to be generated into the Swf even without -debug |
flash |
| @:decl | cpp | |
| @:defParam | all | |
| @:delegate | Automatically added by -net-lib on delegates |
cs |
| @:depend | cpp | |
| @:deprecated | Automatically added by -java-lib on class fields annotated with <code>@Deprecated</code> annotation. Has no effect on types compiled by Haxe |
java |
| @:event | Automatically added by -net-lib on events. Has no effect on types compiled by Haxe |
cs |
| @:enum | Defines finite value sets to abstract definitions. See enum abstracts | all |
| @:expose (?Name=Class path) | Makes the class available on the window object or exports for node.js. See exposing Haxe classes for JavaScript |
js |
| @:extern | Marks the field as extern so it is not generated | all |
| @:fakeEnum (Type name) | Treat enum as collection of values of the specified type | all |
| @:file(File path) | Includes a given binary file into the target Swf and associates it with the class (must extend flash.utils.ByteArray) |
flash |
| @:final | Prevents a class from being extended | all |
| @:font (TTF path Range String) | Embeds the given TrueType font into the class (must extend flash.text.Font) |
flash |
| @:forward (List of field names) | Forwards field access to underlying type | all |
| @:from | Specifies that the field of the abstract is a cast operation from the type identified in the function. See Implicit Casts | all |
| @:functionCode | cpp | |
| @:functionTailCode | cpp | |
| @:generic | Marks a class or class field as generic so each type parameter combination generates its own type/field | all |
| @:genericBuild | Builds instances of a type using the specified macro | all |
| @:getter (Class field name) | Generates a native getter function on the given field | flash |
| @:hack | Allows extending classes marked as <code>@:final</code> | all |
| @:headerClassCode | Code to be injected into the generated class, in the header | cpp |
| @:headerCode | Code to be injected into the generated header file | cpp |
| @:headerNamespaceCode | cpp | |
| @:hxGen | Annotates that an extern class was generated by Haxe | cs java |
| @:ifFeature (Feature name) | Causes a field to be kept by DCE if the given feature is part of the compilation | all |
| @:include | cpp | |
| @:initPackage | all | |
| @:internal | Generates the annotated field/class with internal access |
cs java |
| @:isVar | Forces a physical field to be generated for properties that otherwise would not require one | all |
| @:javaCanonical (Output type package,Output type name) | Used by the Java target to annotate the canonical path of the type | java |
| @:jsRequire | Generate javascript module require expression for given extern | js |
| @:keep | Causes a field or type to be kept by DCE | all |
| @:keepInit | Causes a class to be kept by DCE even if all its field are removed | all |
| @:keepSub | Extends <code>@:keep</code> metadata to all implementing and extending classes | all |
| @:macro | (deprecated) | all |
| @:mergeBlock | Merge the annotated block into the current scope | all |
| @:meta | Internally used to mark a class field as being the metadata field | all |
| @:multiType (Relevant type parameters) | Specifies that an abstract chooses its this-type from its <code>@:to</code> functions | all |
| @:native (Output type path) | Rewrites the path of a class or enum during generation | all |
| @:nativeChildren | Annotates that all children from a type should be treated as if it were an extern definition - platform native | cs java |
| @:nativeGen | Annotates that a type should be treated as if it were an extern definition - platform native | cs java |
| @:nativeProperty | Use native properties which will execute even with dynamic usage | cpp |
| @:noCompletion | Prevents the compiler from suggesting completion on this field | all |
| @:noDebug | Does not generate debug information into the Swf even if -debug is set |
flash |
| @:noDoc | Prevents a type from being included in documentation generation | all |
| @:noImportGlobal | Prevents a static field from being imported with import Class.* |
all |
| @:noPrivateAccess | Disallow private access to anything for the annotated expression | all |
| @:noStack | cpp | |
| @:noUsing | Prevents a field from being used with using |
all |
| @:nonVirtual | Declares function to be non-virtual | cpp |
| @:notNull | Declares an abstract type as not accepting null values |
all |
| @:ns | Internally used by the Swf generator to handle namespaces | flash |
| @:op (The operation) | Declares an abstract field as being an operator overload | all |
| @:optional | Marks the field of a structure as optional. See Optional Arguments | all |
| @:overload (Function specification) | Allows the field to be called with different argument types. Function specification cannot be an expression | all |
| @:privateAccess | Allow private access to anything for the annotated expression | all |
| @:property | Marks a property field to be compiled as a native C# property | cs |
| @:protected | Marks a class field as being protected | all |
| @:public | Marks a class field as being public | all |
| @:publicFields | Forces all class fields of inheriting classes to be public | all |
| @:pythonImport | Generates python import statement for extern classes | python |
| @:readOnly | Generates a field with the readonly native keyword |
cs |
| @:remove | Causes an interface to be removed from all implementing classes before generation | all |
| @:require (Compiler flag to check) | Allows access to a field only if the specified compiler flag is set | all |
| @:rtti | Adds runtime type informations. See RTTI | all |
| @:runtime | all | |
| @:runtimeValue | Marks an abstract as being a runtime value | all |
| @:selfCall | Translates method calls into calling object directly | js |
| @:setter (Class field name) | Generates a native setter function on the given field | flash |
| @:sound (File path) | Includes a given .wav or .mp3 file into the target Swf and associates it with the class (must extend flash.media.Sound) |
flash |
| @:sourceFile | Source code filename for external class | cpp |
| @:strict | Used to declare a native C# attribute or a native Java metadata. Is type checked | cs java |
| @:struct | Marks a class definition as a struct | cs |
| @:structAccess | Marks an extern class as using struct access('.') not pointer('->') | cpp |
| @:suppressWarnings | Adds a SuppressWarnings annotation for the generated Java class | java |
| @:throws (Type as String) | Adds a throws declaration to the generated function |
java |
| @:to | Specifies that the field of the abstract is a cast operation to the type identified in the function. See Implicit Casts | all |
| @:transient | Adds the transient flag to the class field |
java |
| @:unbound | Compiler internal to denote unbounded global variable | all |
| @:unifyMinDynamic | Allows a collection of types to unify to Dynamic | all |
| @:unreflective | cpp | |
| @:unsafe | Declares a class or a method with the C#'s unsafe flag |
cs |
| @:usage | all | |
| @:value | Used to store default values for fields and function arguments | all |
| @:void | Use Cpp native 'void' return type | cpp |
| @:volatile | cs java |