I set Java's "Implemented Method Body" (Settings -> Editor -> File and Code Template -> Implemented Method Body) to throw new NotImplementedException();
.
But NotImplementedException
requires import sun.reflect.generics.reflectiveObjects.NotImplementedException;
.
So how can I add this import automatically?
You can use the fully qualified name of the exception class in the template; IntelliJ IDEA will automatically shorten it and add the necessary import.
Note that this NotImplementedException
is from an internal JDK package, so it's unlikely to be a good idea to use it in your code. You should find a more suitable class from the public JDK API, such as UnsupportedOperationException
.