Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351747 - Duplicate delegate methods generated
Summary: Duplicate delegate methods generated
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-07-11 15:18 EDT by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:22 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-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.