Skip to content

replace() with pattern in walker causes NPE #1

@anyahelene

Description

@anyahelene

....because it doesn't supply a build context to the pattern:

    public void replace(Pattern<Value, Type> pattern) throws NotBuildableException {
        TreeCursor<Value, Type> build = pattern.build(null, (Environment<TreeCursor<Value, Type>>) getLocalEnv());
        current = current.copyAndReplaceSubtree(build);
    }

Workaround: build the pattern yourself before passing it to the walker:

walker.replace(pat.build(context, env));

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions