Compiler Error J0222

@com attribute cannot be placed on method 'identifier'-- it must be declared 'native' or be in an interface

The compiler detected that a method was specified with an @com.method or @com.parameters attribute, but the method was not declared with the native modifier or declared in an interface definition. For methods to be exposed through a COM interface they must either be declared in an interface declaration or declared native from within a class declaration.

The following example illustrates this error:

public class Simple{
   
   /** @com.method(dispid=306); */
   public void method1(){}
   /*error: method must be declared 'native' or
            declared in an interface */
}