In a Java source, I don't want use some package. For instance, I don't want any reference to swing, or io, or other.
Is there a system to check that, at compile time, or at test time?
For instance, with supposed annotation
@NoPackage("javax.swing")
class Foo
{
private JFrame fram; // NOT OK.
}
Why I need this? Because I have an application with swing, and I want refactor it with a part which uses swing, and other which doesn't, because I want to port it to other ui stuff (web, pda, etc).