| Summary: | removePrefixAndSuffixForFieldName transforms more than the suffix | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Arno Schuring <aelschuring> |
| Component: | Core | Assignee: | David Audel <david_audel> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.1.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | stalebug | ||
|
Description
Arno Schuring
(In addition to comment #0) The javadoc says the following: "If field name prefix is pre and field name suffix is suf then for a field named preFieldsuf the result of this method is field. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preFieldsuf." The latter assertion does not seem to be the case either, e.g. for a variable static final int VAR = 2; and prefixes and suffixes for static fields empty, the result is still vAR The spec covers the first case in the sentence. "If field name prefix is pre and field name suffix is suf then for a field named preFieldsuf the result of this method is field.". This means that after removing the prefix and the suffix, the remaining part "Field" is converted to "field". So this implies an uppercase to lowercase conversion for the first character. I would say that the conversion to lowercase should only be done if the field is not static. For a static field, the uppercase should be preserved. Unfortunately this is not covered by the specs. So we need to find out if such change would be an API breakage. The second case however looks like a bug, because the spec clearly states that when no prefix or suffix are defined, the name is unchanged. (In reply to comment #2) I agree that the first issue is a matter of interpretation, and might be fixed by a documentation change (read: clarification). However, following the Java naming conventions, lowercase characters should be disallowed for constants (i.e. static final fields). I also recognize the possibility that these prefixes/suffixes might be intended for variables only, i.e. should not be applied to static finals. Can one of the JDT developers clarify whether static final fields are considered prefixable via "static variable" prefixes? This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |