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

crash on white space in import statements #1124

Open
mlau-anet opened this issue Sep 5, 2024 · 0 comments
Open

crash on white space in import statements #1124

mlau-anet opened this issue Sep 5, 2024 · 0 comments

Comments

@mlau-anet
Copy link

mlau-anet commented Sep 5, 2024

What happened?

case a

import java. util.*;

results in

com.palantir.javaformat.java.FormatterException: error: Could not parse imported name, at:  
    at com.palantir.javaformat.java.ImportOrderer.scanImported (ImportOrderer.java:417)

case b

import java .util.*;

results in

com.palantir.javaformat.java.FormatterException: error: Expected ; after import
    at com.palantir.javaformat.java.ImportOrderer.scanImports (ImportOrderer.java:321)

What did you want to happen?

Should not crash and instead should remove the extra white space, resulting in:

import java.util.*;

env details

            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.43.0</version>
                <configuration>
                    <java>
                        <importOrder />
                        <removeUnusedImports />
                        <trimTrailingWhitespace />
                        <endWithNewline />
                        <indent>
                            <spaces>true</spaces>
                            <spacesPerTab>4</spacesPerTab>
                        </indent>
                        <palantirJavaFormat />
                    </java>
                </configuration>
            </plugin>
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

1 participant