-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently, Java-NoOp generates methods with default data type values.
On some case, it could be interesting to throw an exception to notify that it's a no-op object and it's not going to provide a valid behavior.
For example, here is an Employee interface:
@NoOp
public interface Employee {
String name();
void doCriticalStuff();
}Dealing with a NoOpEmployee, there's no problem to get a empty name.
But on my doCriticalStuff, it would be nice to throw a specific exception.
For example, this could be the Employee interface:
@NoOp
public interface Employee {
String name();
@NoOpThrows(class=NoOpException.class, message="It's a no-op object, critical stuff can't be done properly")
void doCriticalStuff();
}generating:
public class NoOpEmployee implements Employee {
// ...
@Override
public void doCriticalStuff() {
throw new NoOpException("It's a no-op object, critical stuff can't be done properly");
}
}imlk0
Metadata
Metadata
Assignees
Labels
No labels