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

Bug 316809

Summary: [plan] [refactoring] Pull Out Refactoring: handling of abstract methods
Product: [Tools] AJDT Reporter: Kris De Volder <kdevolder>
Component: UIAssignee: AJDT-inbox <AJDT-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrew.eisenberg
Version: unspecified   
Target Milestone: 2.1.1   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=277055
Whiteboard:
Bug Depends on:    
Bug Blocks: 277055    
Attachments:
Description Flags
Patch: implementing this feature + tests
none
Update: remove some dead/unused code from previous patch
andrew.eisenberg: iplog+
Fixes a broken test case andrew.eisenberg: iplog+

Description Kris De Volder CLA 2010-06-14 15:15:29 EDT
Build Identifier: 

The initial implementation of pull-out refactoring does not support pulling out of abstract / interface methods.

When such methods are being pulled out, they will cause compile errors in the resulting code.

A way to handle this case could be as follows:

 - provide an option in the wizard to enable/allow pulling abstract methods
 - if the option is not enabled report an error/warning when abstract methods are selected for pull-out.
 - if the option is enabled, do not report an error, but pull the method out, removing the abstract keyword and provide a stub implementation in the refactored code.

Reproducible: Always
Comment 1 Kris De Volder CLA 2010-07-23 16:58:20 EDT
Created attachment 175106 [details]
Patch: implementing this feature + tests

I'm attaching a patch that imlements pulling out support for abstract and interface methods.

Does the following:

 a) when we do not select the "generate abstract method stubs" option
   - produce warnings for any abstract or interface methods
   - if you refactor anyway
      - ads abstract+public keyword to interface methods that don't already 
        have it
      - create an "abstract" itd that will cause compile errors that user can then
        look at and address.

 b) when we *do* select generate abstract method stubs
   - removes abstract keyword
   - adds a method stub that throws an Error when called
Comment 2 Kris De Volder CLA 2010-07-23 17:04:48 EDT
Created attachment 175107 [details]
Update: remove some dead/unused code from previous patch
Comment 3 Andrew Eisenberg CLA 2010-07-23 18:39:43 EDT
Patch is applied and committed.

It looks like this bug should be closed. No?
Comment 4 Kris De Volder CLA 2010-07-24 12:16:20 EDT
Yes. Thanks for committing the patch
Comment 5 Kris De Volder CLA 2010-07-24 14:24:52 EDT
Reopening. It looks like my patch contained a broken test case.

Something must have gone wrong when I created the patch, it seems to contain an older, broken version of the testcase from my local history.

I'm attaching a patch that fixes the test case.
Comment 6 Kris De Volder CLA 2010-07-24 14:25:57 EDT
Created attachment 175162 [details]
Fixes a broken test case
Comment 7 Andrew Eisenberg CLA 2010-07-26 13:52:08 EDT
Patch is applied.
Comment 8 Andrew Eisenberg CLA 2010-07-26 13:53:41 EDT
committed.