Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DomDecor: why is object allowed to be passed to ctor? #102

Open
atapin opened this issue Jan 10, 2018 · 1 comment
Open

DomDecor: why is object allowed to be passed to ctor? #102

atapin opened this issue Jan 10, 2018 · 1 comment

Comments

@atapin
Copy link

atapin commented Jan 10, 2018

Why checking with instanceof and then casting if we just can pass instance of type Node?

    @SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
    DomDecor(final Object doc) throws DecorException {
        if (doc != null && !(doc instanceof Node)) {
            throw new DecorException(
                String.format(
                    "Instance of org.w3c.dom.Node required, while %s provided",
                    doc.getClass().getName()
                )
            );
        }
        this.node = (Node) doc;
    }
@0crat
Copy link

0crat commented Jan 10, 2018

@yegor256 please, pay attention to this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants