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

Bug 351747

Summary: Duplicate delegate methods generated
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-07-11 15:18:52 EDT
If a developer wishes to override a delegated method in an extending model element, we might see code structure like the following:

@GenerateImpl

public interface ICreateProjectOp extends IExecutableModelElement
{
    ...

    // *** Method : execute ***
    
    @DelegateImplementation( CreateProjectOpMethods.class )
    
    Status execute( ProgressMonitor monitor );
}

@GenerateImpl

public interface ICreateWebProjectOp extends ICreateProjectOp
{
    ...
    
    // *** Method : execute ***
    
    @DelegateImplementation( CreateWebProjectOpMethods.class )
    
    Status execute( ProgressMonitor monitor );
}

Due to the bug in the impl class generator, the generated CreateWebProjectOp class will have the following two methods:

public Status execute( final ProgressMonitor monitor )
{
    synchronized( root() )
    {
        return CreateProjectOpMethods.execute( this, monitor );
    }
}
    
public Status execute( final ProgressMonitor monitor )
{
    synchronized( root() )
    {
        return CreateWebProjectOpMethods.execute( this, monitor );
    }
}

This doesn't compile. The expected behavior would be to generate just the second method.
Comment 1 Konstantin Komissarchik CLA 2011-07-11 16:40:24 EDT
Fixed. Test case Misc0005 covers this now.
Comment 2 Ling Hao CLA 2011-09-27 19:14:16 EDT
Verify via unit test.