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

Issues parsing source with a local interface #821

Open
shrugalic opened this issue Jul 25, 2024 · 0 comments
Open

Issues parsing source with a local interface #821

shrugalic opened this issue Jul 25, 2024 · 0 comments

Comments

@shrugalic
Copy link

shrugalic commented Jul 25, 2024

We recently upgraded from Java 17 to Java 21. Apparently the JavaParser has a problem with switch over a sealed type.

  • spotless 6.25.0 or 7.0.0.BETA1
  • cleanthat 2.21

Error Message

There is no such thing as a local interface. Pay attention that this feature is supported starting from 'JAVA_16' language level. If you need that feature the language level must be configured in the configuration before parsing the source files.
Not able to parse path='Sample.java' with com.github.javaparser.JavaParser@200c1143

Code

public class Sample {
	void sample() {
		interface ISample {
			void iSample();
		}
	}
}

How we include cleanthat into our build

We do specify Java 21 where we include cleanthat:

cleanthat()
    .version("2.21")
    .sourceCompatibility("21")
    .addMutator("SafeButNotConsensual")
    .excludeMutator("UseUnderscoresInNumericLiterals")
    .excludeMutator("AvoidInlineConditionals")

I should probably also mention that cleanthat was updated to include JavaParser v3.26.1 following the issue #817

Maybe I should open a JavaParser issue instead?

Edit: Oh, there already is one: javaparser/javaparser#3990

Edit 2: That issue also mentions that the main developers of JavaParser are no longer active, and that there may be more up-to-date alternatives. This comment is marked as abuse though 🤔, so the link does not open the comment directly): It mentions this post which uses talks about https://github.com/congo-cc/congo-parser-generator

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