Skip to content

[VarWithPrimitive] java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.tree.JCTree.getStartPosition()" because "tree" is null #5857

@anthonyvdotbe

Description

@anthonyvdotbe

error-prone version: 2.50.0
BugPattern: VarWithPrimitive
Stack Trace:
java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.tree.JCTree.getStartPosition()" because "tree" is null

import module java.base;

class Test {

    void foo() {
        byte[] bar = new byte[6];
Map<Byte, List<Byte>> indicesMap = IntStream.range(0, 6)
                .mapToObj(n -> n)
                .collect(Collectors.groupingBy(n -> bar[n], Collectors.mapping(n -> (byte) n.intValue(), Collectors.toList())));
    }
}

Cf. #5122

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions