@Messages({
        "# {0} - variable name",
        "ERR_NeitherReadOrWritten=Variable {0} is neither read or written to",
        "# {0} - variable name",
        "ERR_NotWritten=Variable {0} is never written to",
        "# {0} - variable name",
        "ERR_NotRead=Variable {0} is never read",
        "# {0} - element name",
        "ERR_NotUsed={0} is never used",
        "ERR_NotUsedConstructor=Constructor is never used",
    })
    private static ErrorDescription convertUnused(HintContext ctx, UnusedDescription ud) {
        //TODO: switch expression candidate!
        String name = ud.unusedElement.getSimpleName().toString();
        String message;
        switch (ud.reason) {
            case NOT_WRITTEN_READ: message = Bundle.ERR_NeitherReadOrWritten(name); break;
            case NOT_WRITTEN: message = Bundle.ERR_NotWritten(name); break;
            case NOT_READ: message = Bundle.ERR_NotRead(name); break;
            case NOT_USED:
                if (ud.unusedElement.getKind() == ElementKind.CONSTRUCTOR) {
                    message = Bundle.ERR_NotUsedConstructor();
                } else {
                    message = Bundle.ERR_NotUsed(name);
                }
                break;
            default:
                throw new IllegalStateException("Unknown unused type: " + ud.reason);
        }
        return ErrorDescriptionFactory.forName(ctx, ud.unusedElementPath, message);
    }
@Messages({
        "# {0} - variable name",
        "ERR_NeitherReadOrWritten=Variable {0} is neither read or written to",
        "# {0} - variable name",
        "ERR_NotWritten=Variable {0} is never written to",
        "# {0} - variable name",
        "ERR_NotRead=Variable {0} is never read",
        "# {0} - element name",
        "ERR_NotUsed={0} is never used",
        "ERR_NotUsedConstructor=Constructor is never used",
    })
    private static ErrorDescription convertUnused(HintContext ctx, UnusedDescription ud) {
       
        String name = ud.unusedElement.getSimpleName().toString();
        String message;
        switch (ud.reason) {
            case NOT_WRITTEN_READ: message = Bundle.ERR_NeitherReadOrWritten(name); break;
            case NOT_WRITTEN: message = Bundle.ERR_NotWritten(name); break;
            case NOT_READ: message = Bundle.ERR_NotRead(name); break;
            case NOT_USED:
                if (ud.unusedElement.getKind() == ElementKind.CONSTRUCTOR) {
                    message = Bundle.ERR_NotUsedConstructor();
                } else {
                    message = Bundle.ERR_NotUsed(name);
                }
                break;
            default:
                throw new IllegalStateException("Unknown unused type: " + ud.reason);
        }
        return ErrorDescriptionFactory.forName(ctx, ud.unusedElementPath, message);
    }
@messages({ "# {0} - variable name", "err_neitherreadorwritten=variable {0} is neither read or written to", "# {0} - variable name", "err_notwritten=variable {0} is never written to", "# {0} - variable name", "err_notread=variable {0} is never read", "# {0} - element name", "err_notused={0} is never used", "err_notusedconstructor=constructor is never used", }) private static errordescription convertunused(hintcontext ctx, unuseddescription ud) { string name = ud.unusedelement.getsimplename().tostring(); string message; switch (ud.reason) { case not_written_read: message = bundle.err_neitherreadorwritten(name); break; case not_written: message = bundle.err_notwritten(name); break; case not_read: message = bundle.err_notread(name); break; case not_used: if (ud.unusedelement.getkind() == elementkind.constructor) { message = bundle.err_notusedconstructor(); } else { message = bundle.err_notused(name); } break; default: throw new illegalstateexception("unknown unused type: " + ud.reason); } return errordescriptionfactory.forname(ctx, ud.unusedelementpath, message); }