Skip to content

Strangely formatted Java file stalls prettier-java #742

@leonardehrenfried

Description

@leonardehrenfried

Someone on our team reported a strange issue where the prettier-java maven plugin would hang indefinitely.

We traced it down to a malformed Java file. After fixing up the invalid Java, prettier worked as expected.

Reproduction case

It's actually quite simple to reproduce this. All you need to do is to create a Java file with the follwoing content

public {

}

This is of course very much invalid, but prettier should complain rather than hang forever.

If this doesn't give you enough to work with I can also provide a full reproduction repo.

Tested with prettier-java 1.6.8 and 1.7.1.

@testower @miklcct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions