quarkusio/gizmo

Try to detect when missing a call to `returnValue`

Opened this issue · 3 comments

This is a source of errors, in particular when creating constructors, as one needs to remember to call returnValue(null).

I have start to implement it but it is more complexe than it looks like

Missing part:

  • functionnal creator

  • if method contain branch with if false/ true and each part returnValue.
    So maybe best is to implement a visitor of methods to check return instead of a global simple check.
    same things for while, for... indeed any statement

  • thinking to warning instead of exception but the closest for that seems to be ErrorReporter but it seems not implemented.

Ok, I have try to implement my own MethodVisitor to detect

class MethodCheckerVisitor extends MethodVisitor

but the issue is that bytecodeImpl will close the classCreator... so it trigger other visitors.
hope it is fine.

it is #69