Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353533 - Annotation processor generates unnecessary imports when using inner classes
Summary: Annotation processor generates unnecessary imports when using inner classes
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-01 20:15 EDT by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.