Java boxing/ unboxing has a performance overhead, so I would like to inline the primitive types into generic classes, such that:
public class SomeGenericClass<T> {
public T someValue
}
will be transformed into
public class IntGenericClass {
public int someValue
}
I do came up with a trick that does this, which is:
Use the Refactor function in the IDE to rename the generic
<T>to<SomeUniqueName>, anything that won't appear in your codebaseUsing the Replace function to replace
"SomeUniqueName"with"int"or other primitives
However, this is relatively slow to do so, especially when you are dealing with a large codebase. This is also quite error-prone if the class used <T> as the type of other generic classes. For example, Set<T> will become Set<int>, which will lead to a compiler error.
Is there a tool or IDE plugins to do such a job in one (or maybe serval) clicks, and allows you to pick another implementation that works the same as a Set<int>?
Right now I am using IntelliJ IDEA Ultimate, so an IntelliJ IDEA plugin will be best for me. However, I won't mind launching other IDEs to generate the "primitive classes" for once and just switch back to IntelliJ IDEA.