1 Reply Latest reply on Aug 23, 2010 11:34 AM by Shongrunden

    Fx compiler bug/issue: No warning when mxml id name shadowing occurs

    Ansury Level 3

      FB4 should give a warning (or at least show both the hidden and overriding property in code assist) when you name an mxml component the same as a component in a lower level class.

       

      Ex. create an mxml component based on Panel.  Name an mxml sub-component within that (a canvas etc) with id="status".  Attempting to access a property within "status" from another class gives you an error message because the compiler is looking at Panel's "status" property.  (Happened to be a String I believe but 'status' in my case was another custom component/container.)

       

      It's not too bad, by itself, if certain ids (like 'status') are essentially reserved by SDK classes, but we should at least get a warning or something alerting us that we've used an id that is already used within that component.  In Java (Eclipse) there's a warning feature (turned off by default for some bizarre reason) which you can find in Java Compiler settings under Name Shadowing and Conflicts called "Field declaration hides another field or variable".  FB4 needs a similar type of warning (enabled by default..) so we don't waste 15 minutes of time figuring this out.. I know it's happened to me before.

       

      Does anyone from Adobe know if this is currently within JIRA anywhere or should it be added?  It's a tough one to search for.