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

Bug 318255

Summary: [rename] RenameMethodProcessor.checkNewElementName(..) should allow _ at beginning
Product: [Eclipse Project] JDT Reporter: Mike Schrag <mschrag>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: trivial    
Priority: P3 CC: markus.kell.r, Olivier_Thomann
Version: 3.7   
Target Milestone: 3.7 M1   
Hardware: All   
OS: All   
Whiteboard:

Description Mike Schrag CLA 2010-06-28 17:40:08 EDT
Build Identifier: 3.6

At my company, it is a common naming practice to use underscores in front of methods that are "logically protected" -- that is, they have to be public to support cross-package calling, but should be considered protected or discouraged API. This is a convention brought over from Objective-C and WebObjects.

RenameMethodProcess.checkNewElementNames when you refactor a method to have a leading underscore because it has a hardcoded "only lowercase names should be used" check. It would actually be nice if this check was either a configuration option or possible leading-underscore could be a case that doesn't trip this check.

Reproducible: Always

Steps to Reproduce:
1. Create a method named "test"
2. Refactor=>rename the method to "_test"
3. Warning points out that this is discouraged naming in Java
Comment 1 Olivier Thomann CLA 2010-06-28 17:47:51 EDT
Moving to JDT/UI
Comment 2 Markus Keller CLA 2010-06-29 13:36:13 EDT
The other refactorings (e.g. Rename Field) also treat _ as lowercase. Rename Method should behave the same.

Fixed in HEAD of RenameMethodProcessor and Checks.