views:

133

answers:

2

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?

A: 

i don't see any problem ... sigs are completely compatible ... compiles fine on my machine, with gumbo for WinXP ... except it should be public function ImportX ... and ExportX is unknown ... what happens, if he tries to compile that manually? not that i would think that errors come from cygwin or the makefile, but who nows ... you might wanna use ANT though, since this is cross platform ... read more here (page 4 is where it get's interesting in fact) ...

i think the problem is elsewhere ... or maybe post his compile output here ...

edit: ok, then you should most definitely post his compiler output, because i don't understand how that can't compile ...

one note though: i read your note now, on what you are intending to do ... i think it won't work, in fact ... you will get the same problem, because you want to share an interface across 2 swfs ... implementing an interface actually does not simply mean you implement the methods, but it means, that the traits object knows it implements its interface ... so you will get the same errors ...

back2dos
I rewrote the pertinent parts of the code here, but did not give the original or whole code. It is "public function" in the original (good catch), the Import class is defined, and "X" is replaced with something else.
Michael Aaron Safyan
After evaluating the Flex ant tasks, I found them to be poorly documented, difficult to use, and not suitable to our needs. We were able to adapt the Sonatype Flex Mojos plugin for Maven2 for building Flex and found that far superior to the Flex Ant tasks; however, the Flex Mojos plugin only goes up to Flex 3.3.
Michael Aaron Safyan
In the first comment, I meant the Export class, not the Import class.
Michael Aaron Safyan
"i read your note now, on what you are intending to do ... i think it won't work"Actually, I have tested it and it does work.
Michael Aaron Safyan
A: 

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.

Michael Aaron Safyan
Yep. That was what was wrong.
Michael Aaron Safyan