AS3 typed annotations vs. 'clean imports'

Hi there,

the Randori Framework team (http://randoriframework.com/) is developing an IntelliJ plugin to support the framework.

Currently we are busy adding strongly typed annotations to our Actionscript 3 compiler. (This compiler is based on the Falcon compiler and is fitted with a custom backend that cross-compiles AS3 to JavaScript).

The compiler is currently capable of validating annotations such as this:

[JavaScript]
public class MyClass {
}

The mechanics behind this is much the same as C# or Java, the annotation has a class equivalent. So, in order for the compiler to recognize the [JavaScript] annotation a developer will need to import the following class:

com.randori.annotions.JavaScript

Now, this gives us a very subtle, but serious, problem, whenever someone presses ctrl+alt+o to clean up their imports, the annotation class will be removed as well. Since IntelliJ won't detect a reference to it in the code.

We will have create (or override ) some sort of extension to prevent the above from happening. Right now, we don't really have a clue though where to start :)

If someone here can point us in the right direction, i.e. point to the necessary extensions or extension points that we need to investigate then we'd be very grateful.

Thank you very much in advance!

Roland

4 comments

I spent some time looking for tricks and hacks available to plugin writers, but I'm afraid it is not possible to solve the problem at plugin side with current code base. And it's not easy to implement this functionality at our side. All I can suggest now is to insert some fake usage somewhere in the code.

0

Hi Alexander,

that is most unfortunate, but I do thank you for taking time to investigate our use-case. Perhaps in the future we'll be able to come up with a solution, for now we'll just use
the 'fake usage' way.

cheers,

Roland

0

Please open corresponding task in YouTrack (Flash_Flex subsystem).

0

I have just opened up a task:

http://youtrack.jetbrains.com/issue/IDEA-105404

Perhaps the proposed solution is something that you can consider? This may be an easy way of implementing for you,
since all we would need is that particular hook and all Randori specific logic could be handled completely in our plugin.

Thanks for your time and consideration again!

Cheers,

Roland

0

Please sign in to leave a comment.