Question

I try to create a base RuntimeException class:

BaseRuntimeException extends RuntimeException 

with some additional functionality such as i18n. From that base class I want to create one class per type of RuntimeException. For ex.,

public class SetterWithNullPointerException extends BaseRuntimeException

However, I am getting this compile error wherever I throw a SetterWithNullPointerException

Unhandled exception type SetterWithNullPointerException 

It is like by not having RuntimeException being the direct superclass of SetterWithNullPointerException, I lose the unchecked exception properties of RuntimeException. (Easily checked if I make SetterWithNullPointerException inherit directly from RuntimeExeption)

My question is... is there anyway around this? Do I have to make something special on BaseRuntimeExceptionto make its children inherit the unchecked exception properties?

Thanks a lot! Manu

Was it helpful?

Solution

I am sorry for all the noise. The comments under this answer are correct. There was nothing wrong on what I was doing. You can extend as many times as you want RuntimeException.

My IDE must have played a trick on me. Where there were compiler errors before, there are none now. Kids, before coming to SO, do a "Project Clean" when you think the errors you are seeing don't make any sense...

Apologies again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top