3

I recently thought about the naming conventions of Java exceptions, regarding exceptions starting with "Invalid" and such starting with "Illegal". When looking through the Exception classes, at a first glance it looks like the "Illegal..." exceptions are all subclasses of RuntimeException, i.e. unchecked exceptions. However, there are for example classes like InvalidParameterException and InvalidPathException, which start with "Invalid" but are subclasses of IllegalArgumentException, which is a subclass of RuntimeException. There are also examples the other way around, for example IllegalAccessException or IllegalClassFormatException, which are checked exceptions.

So my assumption with checked/unchecked exceptions seems to be invalid. Does anyone know the naming convention behind this? Does a naming convention for this exist at all?

I found a similar question here, which however focuses more on how to name an own subclass of IllegalArgumentException.

Community
  • 1
  • 1
user7291698
  • 1,972
  • 2
  • 15
  • 30

0 Answers0