
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Creating a new variable with the type "Object" means that it may be used to store any kind of object. This feature may be required in some specific contexts, but it leaves the compiler unable to do any kind of type checking, and is therefore a hazardous practice.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,flex]
|
|
----
|
|
var obj:Object = new String(); // Noncompliant; Object used explicitly
|
|
var foo = new Object(); // Noncompliant; Object used explicitly
|
|
var bar = {name:String, age:int}; // Noncompliant; Object implicitly created
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,flex]
|
|
----
|
|
var obj:String = new String();
|
|
var foo:IPortfolio = new Portfolio();
|
|
class Person {
|
|
public var name:String;
|
|
public var age:int;
|
|
}
|
|
var bar:Person = new Person();
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Clearly define the type of the 'xxxx' variable
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 22 Oct 2013, 14:04:06 Freddy Mallet wrote:
|
|
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3192
|
|
|
|
endif::env-github,rspecator-view[]
|