Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
IDE
Refactoring
C++Rename
C++Undo Support
Change Parameters
Create Variable
Declare Field
Declare Variable
Extract Interface
Extract Method
Extract Resourcestring
Extract Superclass
Find Class
Find References
Find Unit
Inline Variable
Introduce Field
Introduce Variable
Move Members
Pull Member Up
Push Members Down
Rename
Safe Delete
Undo Support
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/IDE/Refactoring/Extract Interface
[ Add a report in this area ]
Report #:
88817
Status:
Open
Extract Interface produces declarations in wrong order
Project:
Delphi
Build #:
15.0.3890.34076
Version:
15.0
Submitted By:
Bob Swart
Report Type:
Basic functionality failure
Date Reported:
10/10/2010 8:07:39 AM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
280783
Resolution:
None
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
Given class TBase with a derived class TDerived, if we extract an interface from TBase, then the result is code that will no longer compile.
The TBase class and IBase interface are declared after TDerived, and as a result TDerived no longer knows about the TBase base class (eventhough it's forward declared at the top, TBase is not complete, to TDerived cannot descent from it).
Steps to Reproduce:
Start with the following code unit in file uContact.pas
unit uContact;
interface
type
TContact = class abstract
strict private
procedure SetName(val : String);
strict private
function GetName : String;
public
property Name : String read GetName write SetName;
procedure Contact(Msg: TMessage);virtual;abstract;
end;
TEmailContact = class(TContact)
end;
TSkypeContact = class(TContact)
end;
implementation
function TContact.GetName: String;
begin
end;
procedure TContact.SetName(val : String);
begin
end;
end.
Then, for the TContact abstract class, we can extract an Contact interface for example, with the Contact method.
There are a number of problems with the resulting source code. First of all, the order of class definitions is no longer resulting in compilable code. The unit starts with a forward definition of TMessage and TContact, followed by a full definition of TMessage, TEmailContact (derived from the not-yet-complete TContact), TSkypeContact (also derived from the not-yet-complete TContact), followed by the IContact interface and finally the TContact class. In order to fix these issues, we need to move the TEmailContact and TSkypeContact class definitions after the full definition of TContact.
Workarounds
None
Attachment
None
Comments
None
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us