I cleared some code and happened after com.example.StringHelperthat contained 6 or 7 public staticmethods (for example concatStrings(String...), but there were no member fields). There were several classes, subclass this class, so that they can cause concatStrings(str1, str2)no prefix it with the following class: StringHelper.concatStrings(str1, str2).
I didnβt want them to subclass the class for this very reason, so I broke the bunch. I inserted the following static import at the beginning of any file, subclassing it after deletion extends StringHelper:
import static com.example.StringHelper.*;
Eclipse has simplified this in specific imports for the methods used only.
Question : Is there an easy way to get Eclipse to "embed" this static import? Can I make it remove the actual static import and prefix for each call using StringHelper.instead?
Note
This is a simplified, far-fetched example, so please do not complain about why we need StringHelper.
source
share