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

MetadataArgumentsDescriptionPlatforms
@:abiFunction ABI/calling convention.cpp
@:abstractSets the underlying class implementation as abstract.java, cs
@:access<Target path>Forces private access to package, type or field. See lf-access-control.all
@:allow<Target path>Allows private access from package, type or field. See lf-access-control.all
@:analyzerUsed to configure the static analyzer.all
@:annotationAnnotation (@interface) definitions on --java-lib imports will be annotated with this metadata. Has no effect on types compiled by Haxe.java
@:arrayAccessAllows array access on an abstract. See types-abstract-array-access.all
@:astSourceFilled by the compiler with the parsed expression of the field.all
@:autoBuild<Build macro call>Extends @:build metadata to all extending and implementing classes. See macro-auto-build.all
@:bindOverride SWF class declaration.flash
@:bitmap<Bitmap file path>Embeds given bitmap data into the class (must extend flash.display.BitmapData). See target-flash-resources.flash
@:bridgePropertiesCreates native property bridges for all Haxe properties in this class.cs
@:build<Build macro call>Builds a class or enum from a macro. See macro-type-building.all
@:buildXmlSpecify XML data to be injected into Build.xml.cpp
@:bypassAccessorDo not call property accessor method and access the field directly. See class-field-property.all
@:callableAbstract forwards call to its underlying type.all
@:classCodeUsed to inject platform-native code into a class.java, cs
@:commutativeDeclares an abstract operator as commutative. See types-abstract-operator-overloading.all
@:compilerGeneratedMarks a field as generated by the compiler. Should not be used by the end user.java, cs
@:constAllows a type parameter to accept expression values.all
@:coreApiIdentifies this class as a core API class (forces API check).all
@:coreTypeIdentifies an abstract as core type so that it requires no implementation. See types-abstract-core-type.all
@:cppFileCodeCode to be injected into generated cpp file.cpp
@:cppIncludeFile to be included in generated cpp file.cpp
@:cppNamespaceCodecpp
@:dceForces dead code elimination even when --dce full is not specified. See cr-dce.all
@:debugForces debug information to be generated into the SWF even without --debug.flash
@:declcpp
@:delegateAutomatically added by --net-lib on delegates.cs
@:dependcpp
@:deprecatedMark a type or field as deprecated.all
@:eagerForces typedefs to be followed early.all
@:enumDefines finite value sets to abstract definitions. See types-abstract-enum.all
@:eventAutomatically added by --net-lib on events. Has no effect on types compiled by Haxe.cs
@:expose<name>Includes the class or field in Haxe exports (default name is the classpath). See target-javascript-expose.js, lua
@:externMarks the field as extern so it is not generated.all
@:file<File path>Includes a given binary file into the target SWF and associates it with the class (must extend flash.utils.ByteArray). See target-flash-resources.flash
@:fileXmlInclude a given XML attribute snippet in the Build.xml entry for the file.cpp
@:finalPrevents a class or interface from being extended or a method from being overridden. Deprecated by the keyword final. See class-field-final.all
@:fixedDeclares an anonymous object to have fixed fields.all
@:flash.propertyflash
@:font<TTF path>, <Range String>Embeds the given TrueType font into the class (must extend flash.text.Font). See target-flash-resources.all
@:forward<List of field names>Forwards field access to underlying type. See types-abstract-forward.all
@:forwardStatics<List of field names>Forwards static field access to underlying type. See types-abstract-forward.all
@:fromSpecifies that the field of the abstract is a cast operation from the type identified in the function. See types-abstract-implicit-casts.all
@:functionCodeUsed to inject platform-native code into a function.cpp, java, cs
@:functionTailCodecpp
@:genericMarks a class or class field as generic so each type parameter combination generates its own type/field. See type-system-generic.all
@:genericBuildBuilds instances of a type using the specified macro.all
@:getter<Class field name>Generates a native getter function on the given field.flash
@:hackAllows extending classes marked as @:final. Not guaranteed to work on all targets.all
@:headerClassCodeCode to be injected into the generated class, in the header.cpp
@:headerCodeCode to be injected into the generated header file.cpp
@:headerIncludeFile to be included in generated header file.cpp
@:headerNamespaceCodecpp
@:hlNativeSpecifies hdll name and function prefix for native functions.hl
@:hxGenAnnotates that an extern class was generated by Haxe.java, cs
@:ifFeature<Feature name>Causes a field to be kept by DCE if the given feature is part of the compilation. See cr-dce.all
@:pythonImportGenerates python import statement for extern classes.python
@:includecpp
@:inlineInserted by the parser in case of inline expr and inline function.all
@:internalGenerates the annotated field/class with 'internal' access.java, cs
@:isVarForces a physical field to be generated for properties that otherwise would not require one. See class-field-property-rules.all
@:javaCanonical<Output type package>, <Output type name>Used by the Java target to annotate the canonical path of the type.java
@:jsRequireGenerate JavaScript module require expression for given extern. See target-javascript-require.js
@:luaRequireGenerate Lua module require expression for given extern.lua
@:luaDotMethodIndicates that the given extern type instance should have dot-style invocation for methods instead of colon.lua
@:keepCauses a field or type to be kept by DCE. See cr-dce.all
@:keepInitCauses a class to be kept by DCE even if all its field are removed. See cr-dce.all
@:keepSubExtends @:keep metadata to all implementing and extending classes. See cr-dce.all
@:markupUsed as a result of inline XML parsing. See lf-markup.all
@:macro(deprecated)all
@:mergeBlockMerge the annotated block into the current scope.all
@:multiReturnAnnotates an extern class as the result of multi-return function. See target-lua-multireturns.lua
@:multiType<Relevant type parameters>Specifies that an abstract chooses its this-type from its @:to functions.all
@:native<Output type path>Rewrites the path of a class or enum during generation. See lf-externs.all
@:nativeChildrenAnnotates that all children from a type should be treated as if it were an extern definition - platform native.java, cs
@:nativeGenAnnotates that a type should be treated as if it were an extern definition - platform native.java, cs, python
@:nativePropertyUse native properties which will execute even with dynamic usage.cpp
@:nativeStaticExtensionConverts static function syntax into member call.cpp
@:noCompletionPrevents the compiler from suggesting completion on this field or type. See cr-completion.all
@:noDebugDoes not generate debug information even if --debug is set.flash, cpp
@:noDocPrevents a type from being included in documentation generation.all
@:noImportGlobalPrevents a static field from being imported with import Class.*.all
@:nonVirtualDeclares function to be non-virtual in cpp.cpp
@:noPrivateAccessDisallow private access to anything for the annotated expression.all
@:noStackcpp
@:notNullDeclares an abstract type as not accepting null values. See types-nullability.all
@:noUsingPrevents a field from being used with static extension. See lf-static-extension.all
@:nullSafety<Off | Loose | Strict>Enables null safety for classes or fields. Disables null safety for classes, fields or expressions if provided with Off as an argument. See cr-null-safety.all
@:objcDeclares a class or interface that is used to interoperate with Objective-C code.cpp
@:objcProtocolAssociates an interface with, or describes a function in, a native Objective-C protocol.cpp
@:op<The operation>Declares an abstract field as being an operator overload. See types-abstract-operator-overloading.all
@:optionalMarks the field of a structure as optional. See types-nullability-optional-arguments.all
@:overload<Function specification (no expression)>Allows the field to be called with different argument types. See target-javascript-external-libraries.all
@:persistentKeeps the value of static variables in macro context across compilations.eval
@:phpGlobalIndicates that static fields of an extern class actually are located in the global PHP namespace.php
@:phpClassConstIndicates that a static var of an extern class is a PHP class constant.php
@:phpMagicTreat annotated field as special PHP magic field - this meta makes compiler avoid renaming such fields on generating PHP code.php
@:phpNoConstructorSpecial meta for extern classes which do not have native constructor in PHP, but need a constructor in Haxe extern.php
@:pos<Position>Sets the position of a reified expression. See macro-reification.all
@:publicFieldsForces all class fields of inheriting classes to be public.all
@:privateMarks a class field as being private.cs
@:privateAccessAllow private access to anything for the annotated expression.all
@:protectedMarks a class field as being protected.cs, java, flash
@:propertyMarks a property field to be compiled as a native C# property.cs
@:pureMarks a class field, class or expression as pure (side-effect free).all
@:readOnlyGenerates a field with the readonly native keyword.cs
@:removeCauses 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. See lf-condition-compilation.all
@:resolveAbstract fields marked with this metadata can be used to resolve unknown fields.all
@:rttiAdds runtime type information. See cr-rtti.all
@:runtimeValueMarks an abstract as being a runtime value.all
@:scalarUsed by hxcpp to mark a custom coreType abstract.cpp
@:selfCallTranslates method calls into calling object directly. See target-javascript-external-libraries.js, lua
@:semantics<value | reference | variable>The native semantics of the type.all
@: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). See target-flash-resources.flash
@:sourceFileSource code filename for external class.cpp
@:stackOnlyInstances of this type can only appear on the stack.cpp
@:strictUsed to declare a native C# attribute or a native Java metadata; is type checked.java, cs
@:structMarks a class definition as a struct.cs, hl
@:structAccessMarks an extern class as using struct access (.) not pointer (->).cpp
@:structInitAllows one to initialize the class with a structure that matches constructor parameters.all
@:suppressWarningsAdds a SuppressWarnings annotation for the generated Java class.java
@:templatedCallIndicates that the first parameter of static call should be treated as a template argument.cpp
@:throws<Type as String>Adds a throws declaration to the generated function.java
@:toSpecifies that the field of the abstract is a cast operation to the type identified in the function. See types-abstract-implicit-casts.all
@:transientAdds the transient flag to the class field.java
@:volatilejava, cs
@:unifyMinDynamicAllows a collection of types to unify to Dynamic.all
@:unreflectivecpp
@:unsafeDeclares a class, or a method with the C#'s unsafe flag.cs
@:usingAutomatically uses the argument types as static extensions for the annotated type. See lf-static-extension-metadata.all
@:valueUsed to store default values for fields and function arguments.all
@:voidUse Cpp native void return type.cpp