| Summary: | [quick fix] Create method quick fix gives poor names for parameters with parameterized types | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | David Saff <david> |
| Component: | Core | Assignee: | David Audel <david_audel> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | david_audel, martinae |
| Version: | 3.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
Not critical for 3.1. We're using NamingConventions.suggestArgumentNames with 'ArrayList<Object>'. Reproduced with latest. 'name' is the default name when NamingConventions.suggestArgumentNames() is unable to suggest a name. The parameter qualifiedTypename of suggestArgumentNames() must be only a qualified type name (java.util.ArrayList or ArrayList) and must not be a parameterized type. JDT/UI should call suggestArgumentNames() with only ArrayList and not with ArrayList<Object>. If we want to take into account types arguments in naming suggestion, we would need new API methods. But i don't think that's interesting because won't be able to suggest useful name. e.g. what name for java.util.Map<String, String> ? Move to JDT/UI. Are you sure that 'qualifiedTypeName' is meant to be the fully qualified type name? There is also an argument 'packageName' first. So I believe you meant 'typeQualifiedName' as in IType.getTypeQualifiedName But anyways, we don't always have the fully qualified name and passing just a simple name should be fine for NamingConvention too, it can be treated like a type from the default package. For '<..>', We'd be happy if you could treat that as well, otherwise we have to build this on top. And it makes sense to add suggestions based on the parameters: List<String> -> listOfStrings. But of course ignoring the type parameters is ok too. Moving back to jdt.core. Let us know if you want update your code to also handle type parameters (with the existing API). 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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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. |
In RC2. Given code: private void foo() { a(new ArrayList()); b(new ArrayList<Object>()); } Use quick fix to create a and b: private void a(ArrayList list) { // TODO Auto-generated method stub } private void b(ArrayList<Object> name) { // TODO Auto-generated method stub } Note that b's parameter is always named "name", not something more likely to be useful, like "list".