COMMUNITY

Field visibility in output code

According to the manual class fields are private by default. However when converting to target java, jvm or cs, the resulting fields are public. (BTW even if I declare them private, the resulting fields are public.)
How can I make them really private?

You can decorate the fields with metadata. See haxe --help-metas:

@:private              : Marks a class field as being private. (cs only)
@:protected            : Marks a class field as being protected. (for flash,java,cs)

As for the comments on which platforms do support it, it’s best to actually check :wink:

Checking haxe --help-metas I have found that there exists also the metadata @:internal for the targets java and cs. Unfortunatley @:private is only for cs.