Question

I'm using Flash Builder 4.7 and I've come across a bizarre issue, without any changes to the class this is occurring in I get:

VerifyError: Error #1053: Illegal override of HUDScreen in mobile_ui.screens.HUDScreen.

This class extends Sprite, and implements an interface. As far as I know, all methods in the interface have the proper prototypes. There are no overridden properties or functions in this class. We are using robotlegs for dependency injection as well, if that is relevant.

Class Definition

public class HUDScreen extends Sprite implements IHUDScreen
{
}

Constructor

public function HUDScreen()
{

}

Interface Definition

public interface IHUDScreen extends IEventDispatcher
{

}

I've tried cleaning the project, I've deleted and re-imported the project, I've changed the package from ui.screens.HUDScreen to mobile_ui.screens.HUDScreen. Nothing changed the error.

Any other suggestions would be greatly appreciated at this point!

Thank you for your time.

Edit: I've added the class definition, interface definition, and constructor.

UPDATE: I've been able to move past this problem, I've outlined what I did in my answer below. I'm still interested in anyone's thoughts or ideas on how this could have happened, or perhaps a more concrete solution.

Thanks again to everyone who took the time to view this question!

Was it helpful?

Solution

It seems this is caused by an incorrect implementation of an interface that the compiler doesn't detect. The following code snipped causes the error:

public class Foo implements IFoo
{
    public function bar():String { return ""; }
}

public interface IFoo
{
    function get bar():String;
}

The problem is caused by the fact that IFoo.bar is a getter, but Foo.bar() is a normal method. This is a kind of error that could be easily missed when looking through your code, and that would be fixed if you delete and rewrite everything.

OTHER TIPS

I still have no idea why this happened or how. However, I was able to get it working again.

My idea was to remove all the methods from the class, and add stubs for all the methods in the interface. Then, add the actual methods back one-by-one until I could see possibly where the issue was occurring.

Bizarrely, after restoring the methods one at a time, and testing each time, it now works.

The class is (essentially, code is probably laid out slightly differently) the same, and now it works.

I'm still boggled, but at the very least I can move on for now.

Hopefully, this can help somebody somewhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top