Bug 338374 - Generate ToString should omit the fields prefix/suffix
Summary: Generate ToString should omit the fields prefix/suffix
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-28 04:04 EST by Heiko Böttger CLA
Modified: 2011-02-28 04:04 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Böttger CLA 2011-02-28 04:04:43 EST
Build Identifier:  I20110127-2034

When generating the ToString-Method the prefix and suffix of each field is included in the output string. The prefix and suffix are defined in CodeStyle-PreferencePage, these are known character sequences that can be omit. Since ToString only uses non-static fields there is no benefit in seeing the prefix and suffix. 

May be this could be build in as a predefined template.

Reproducible: Always

Steps to Reproduce:
1. Create a Class with some fields using the definied prefix (here 'f'):

class Data {
  private final SignalType             fSignalType;
  private final long                   fTime;
  private final int                    fPosition;
}

2. Call the Source -> Generate ToString

Output using default template will be:

  @Override
  public String toString() {
    return "Data [fSignalType=" + fSignalType + ", fTime=" + fTime
        + ", fPosition=" + fPosition + "]";
  }


Wished output using would be:

  @Override
  public String toString() {
    return "Data [signalType=" + fSignalType + ", time=" + fTime
        + ", position=" + fPosition + "]";
  }