2 ms·
I typed this into Eclipse, and it's super-awesome-excellent auto-code-writer decided that it should be: public int doubleFooBarBazQux(Foo foo) throws NullPo
by jrockway 17y ago
I typed this into Eclipse, and it's super-awesome-excellent auto-code-writer decided that it should be:
public int doubleFooBarBazQux(Foo foo) throws NullPointerException {
try {
return foo.bar().baz().qux() * 2;
}
catch(NullPointerException e){
throw new NullPointerException(e.getMessage());
}
}
If only there was a right-click option for "improve quality"...
- ewjordan 17y agoYeah, the generated code is asinine, but what would you prefer? "Improve quality" in this case would just leave out the try/catch altogether. Is there another behavior that would be better, given that we know nothing about foo, bar, baz, or qux?