RFEs for Refactor-J 2.0, Weaken Type

1) Currently, you just can change the type of a variable, for example, from "ArrayList" to "List", but you can't change it back to "ArrayList". Please also allow to make the type be more specific which helps, e.g., to split class hierarchies. The Type Refactoring plug-in provided such a functionality.

2) Allow to change the type parameter(s) of generic types, e.g., to change a variable of type "ArrayList" to "List extends Object>]]>" or other constellations which do not change the behaviour.

3) I did not figured out how to change the type of a method return value. Is it possible?

--
Cheers,
Tom

2 comments
Comment actions Permalink

1) I'm not sure I understand the use case of this, but it shouldn't be too difficult to add (possibly as a separate "Strengthen type" refactoring).

2) Good one. Will add to next version.

3) Just select the name of the method. Note that you'll only be able to weaken a method's return type if all usages of the method fit that type.

Sixth and Red River Software
"Code with Grace and Verve"

0
Comment actions Permalink

Thanks for your response.

1) I'm not sure I understand the use case of this, but it shouldn't be
too difficult to add (possibly as a separate "Strengthen type"
refactoring).


Use case: you have a class VerySpecialFoo extends Foo. But instead of
extending Foo, it should have Object as super class because the
Foo-subclassing was abused (e.g. only very few common parts). Having the
possibility to "strengthen" the type, it becomes more obvious where
VerySpecialFoo is needed and where Foo, so separating both becomes easier.

3) Just select the name of the method. Note that you'll only be able to
weaken a method's return type if all usages of the method fit that type.


Thanks, I did not know that. I was selecting the return type.

Tom

0

Please sign in to leave a comment.