J
jlukar
eg.
abstract MySuperCalss {
Logger log someLogger;
public void mymethod() { }
}
MySubClass extends MySuperClass {
publlic void someMethod{
someLogger.info("Hello");
}
if I don't take care to instanticate someLogger, it will throw
NullPointerException in MySubClass.someMethod();
I can't define someLogger as abstract neither.
note that I can have many subclasses, so making a just a mental note to
set it in every subclass is not good enough. I'd like the compiler
to catch it.
thanks
j.
abstract MySuperCalss {
Logger log someLogger;
public void mymethod() { }
}
MySubClass extends MySuperClass {
publlic void someMethod{
someLogger.info("Hello");
}
if I don't take care to instanticate someLogger, it will throw
NullPointerException in MySubClass.someMethod();
I can't define someLogger as abstract neither.
note that I can have many subclasses, so making a just a mental note to
set it in every subclass is not good enough. I'd like the compiler
to catch it.
thanks
j.