R – Lots of “incompatible signature” errors on Windows but not on Mac OS X with Flex 4 Gumbo

actionscript-3apache-flexmethod-signature

I have a pure Action Script 3 project which I am compiling with the Flex 4 SDK. I have a standard Makefile which automatically invokes compc, mxmlc, and asdoc as appropriate. The project is compiling cleanly with no errors or warnings on my Mac OS X 10.4+ computer; however, when sharing it with a coworker developing on Windows XP (with Cygwin installed), he gets a very large list of "incompatible signature" errors. Why is he getting those errors? The signatures don't appear to be incompatible.

NOTE: The signatures in question are "original" and "export", used like this:

public interface AbstractX
{
    function original() : Object;
    function export() : Object
}
public class ImportX implements AbstractX
{
    public ImportX(obj : Object) {
        _loadedobj = obj;
        _exportobj = obj.export();
    }

    public static function wrap(obj : Object) : AbstractX {
        var result : AbstractX = null;
        if ( obj != null ){
            if ( obj is AbstractX ){
                result = obj as AbstractX;
            }else if ( obj.original() is AbstractX ){
                result = obj.original() as AbstractX;
            }else{
                result = new ImportX(obj);
            }
        }
        return result;
    }

    public function original() : Object {
        return _loadedobj;
    }

    public function export() : Object {
        return _exportobj;
    }

    private var _loadedobj : Object = null;
    private var _exportobj : Object = null;
}
public class X implements AbstractX
{
   public function X() : void {
      //...
   }

   public function original() : Object {
       return this;
   }

   public function export() : Object {
       if ( ! _export ){
           _export = new ExportX(this);
       }
       return _export;
   }

   private var _export : Object = null;
}

NOTE: The code above is part of my solution to How do I make an Action Script 3 class, used in two SWF files, resolve to the same class when one SWF dynamically loads the other?

Best Answer

Are you sure it also compiles on Mac OS X? If you recently changed your build scripts but you are using the "incremental" compiler option, it might be building successfully on your Mac simply because of the cached build. Try removing any *.cache files and rebuild on your Mac to see if you get the same errors.

One way that you can get strange "incompatible signature" errors is if you place your output directory in the library path; for example, if you are outputting a *.swc file into $(MAINFOLDER)/lib and you also have $(MAINFOLDER)/lib listed in your library path. I suspect the reason for this is that, initially, the interfaces in your code will be used, but halfway through the build, the (incompatible) compiled interfaces will be used.

Related Topic