I have discovered there are 2 NotImplementedException:
- sun.reflect.generics.reflectiveObjects.NotImplementedException
- org.apache.commons.lang3.NotImplementedException
Since there is not an available documentation for the first one, I'm not able to understand the difference between them. What is this difference? Is one of them better than the other one?
I found more examples than that. It depends on how hard you look ... and where.
That is because
sun.reflect.generics.reflectiveObjects.NotImplementedExceptionis an internal class. The source code says:They both mean the same thing, more or less. Some piece of functionality has not been implemented.
I assume that you are really asking whether you can and should reuse either of these exceptions in your code.
Since the
sun.reflect...exception is an internal class (see @GhostCat's answer), it is inadvisable to use it in your code. There is a chance that the class will "go away" in a future release of Java1. That will present problems for your codebase.It is reasonable to reuse the
org.apache.commons...exception. Indeed, my reading of the javadoc, it is designed to be generally reusable. However:org.apache.commons.langandorg.apache.commons.lang3. (See bullet #1!)The other alternatives are to declare your own custom exception, or simply use the existing
java.lang.UnsupportedOperationException... which is standard, doesn't add a new dependency, and won't be removed in a future Java release.1. I'm not sure of this, but I think that access to
sun.reflect.generics.reflectiveObjectsis blocked in Java 9.