Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Refactoring
-
Labels:None
-
Number of attachments :
Description
To ease with IDE support, it is generally recommended to use explicit type information for field and method declarations, especially for API classes. Groovy-Eclipse should provide a refactoring that helps with this conversion.
It should be able to guess the return types of methods as well as the types of fields. Generics should be included where possible and appropriate. Types that are resolved to Object should remain as def.
eg-
class Explicit {
def fieldEasyInt = 9
def fieldAssignedSomewhere
def fieldAssignedToObject
def fieldDontKnow
def methodWithArgs(String arg1, arg2, Object arg3) {
fieldAssignedSomewhere = [ arg1 ]
fieldAssignedToObject = arg3
[ arg1 : fieldEasyInt ]
}
}
Should become:
class Explicit {
int fieldEasyInt = 9
List<String> fieldAssignedSomewhere
def fieldAssignedToObject
def fieldDontKnow
Map<String,Integer> methodWithArgs(String arg1, arg2, Object arg3) {
fieldAssignedSomewhere = [ arg1 ]
fieldAssignedToObject = arg3
[ arg1 : fieldEasyInt ]
}
}