All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.flex.rules.flex.S1463.html Maven / Gradle / Ivy

There is a newer version: 2.14.0.5032
Show newest version

Why is this an issue?

According to the Flex documentation :

In an ActionScript file, when you define component events or other aspects of a component that affect more than a single property, you add the metadata tag outside the class definition so that the metadata is bound to the entire class, as the following example shows:

// Add the [Event] metadata tag outside of the class file.
[Event(name="enableChange", type="flash.events.Event")]
public class ModalText extends TextArea {

    ...

    // Define class properties/methods
    private var _enableTA:Boolean;

    // Add the [Inspectable] metadata tag before the individual property.
    [Inspectable(defaultValue="false")]
    public function set enableTA(val:Boolean):void {
        _enableTA = val;
        this.enabled = val;

        // Define event object, initialize it, then dispatch it.
        var eventObj:Event = new Event("enableChange");
        dispatchEvent(eventObj);
    }
}

In this example, the "enableChange" event must be considered part of the API. Therefore, it should be strongly typed.

Noncompliant code example

[Event(name="enableChange")]
public class ModalText extends TextArea {...}

Compliant solution

[Event(name="enableChange", type="flash.events.Event")]
public class ModalText extends TextArea {...}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy