walkmod / walkmod-pmd-plugin

Walkmod plugin to fix the code according the PMD rules
2 stars 2 forks source link

NPE in PMDRuleVisitor.visit(ArrayCreationExpr) #13

Closed cal101 closed 7 years ago

cal101 commented 7 years ago

It is possible that "n.getDimensions() != null" is false but initializer is not set via constructor

    public ArrayCreationExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type,
            List<Expression> dimensions, int arrayCount) {

~~I tried 1,5h to produce a test case. Giving up. Seems to be related to~~

           final String[] x = new String[]{
                    "y",
                    "z." + s,
                    ""};

Reproducable test case: https://github.com/cal101/walkmod-misc/tree/pmd-plugin-tests

rpau commented 7 years ago

Fixed and deployed.