Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353533

Summary: Annotation processor generates unnecessary imports when using inner classes
Product: z_Archived Reporter: Konstantin Komissarchik <konstantin>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ling.hao
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Konstantin Komissarchik CLA 2011-08-01 20:15:38 EDT
When an inner class is used in a model element definition (perhaps to define the type of the value property), the annotation processor generates an unnecessary import statement.

For instance, given the following element definition:

public interface ResourceRef extends IModelElement
{
    ModelElementType TYPE = new ModelElementType( ResourceRef.class );
    
     // *** AuthenticationMethod ***
    
    enum AuthenticationMethod
    {
        APPLICATION,
        CONTAINER
    }
    
    @Type( base = AuthenticationMethod.class )

    ValueProperty PROP_AUTHENTICATION_METHOD = new ValueProperty( TYPE, "AuthenticationMethod" );
    
    Value<AuthenticationMethod> getAuthenticationMethod();
    void setAuthenticationMethod( String value );
    void setAuthenticationMethod( AuthenticationMethod value );
}

The annotation processor will include the following import statement when generating the implementation class:

import org.eclipse.sapphire.samples.jee.environment.ResourceRef.AuthenticationMethod;

This import is unnecessary and generates import is never used warning.
Comment 1 Konstantin Komissarchik CLA 2011-08-02 13:04:29 EDT
Fixed.
Comment 2 Konstantin Komissarchik CLA 2011-09-02 13:00:24 EDT
I am backporting fix for Bug 353620 to 0.3.1 release, so this issue becomes relevant there. However, Bug 356539 documents a regression caused by the current fix, so a new approach in both branches is necessary.

I am opting for the simpler solution of applying @IgnoreWarnings( "all" ) to generated classes.
Comment 3 Konstantin Komissarchik CLA 2011-09-02 14:10:30 EDT
Done.
Comment 4 Ling Hao CLA 2011-09-28 18:27:17 EDT
Verify @SuppressWarnings( "all" ) is present in the generated class and thus no warnings.