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

Update javafmt #593

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Update javafmt #593

wants to merge 2 commits into from

Conversation

mdedetrich
Copy link
Contributor

Updates and applies javafmt

mdedetrich and others added 2 commits August 28, 2023 11:02
 Co-authored-by: He-Pin <hepin1989@gmail.com>
@mdedetrich
Copy link
Contributor Author

@He-Pin There seems to be some regression in the new version of javafmt, if you look at https://github.com/apache/incubator-pekko/actions/runs/5997908862/job/16265219790?pr=593 its failing to compile some java sources

@He-Pin
Copy link
Member

He-Pin commented Aug 28, 2023

I tried it locally with sbt Test/compile:

[info] done compiling
[success] Total time: 591 s (09:51), completed 2023-8-28 17:48:46

@mdedetrich
Copy link
Contributor Author

I tried it locally with sbt Test/compile:

[info] done compiling
[success] Total time: 591 s (09:51), completed 2023-8-28 17:48:46

If you run validateCompile in sbt this is where you get the problem

@mdedetrich
Copy link
Contributor Author

So I looked at diff for one of the problematic sources, i.e. actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/AggregatorTest.java and all that javafmt did was re-sort the imports so I have no idea why this is failing to compile, it seems to be a multi-jvm thing?

@He-Pin
Copy link
Member

He-Pin commented Aug 28, 2023

I will take a try after work, wared.

@mdedetrich
Copy link
Contributor Author

So I did a little digging, the core issue appear to be that the Java sources are not fed properly into the compiler i.e.

[error] /Users/mdedetrich/github/incubator-pekko/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/AggregatorTest.java:136:1: cannot find symbol
[error]   symbol:   class AbstractBehavior
[error]   location: interface jdocs.org.apache.pekko.typed.AggregatorTest.IllustrateUsage
[error] AbstractBehavior

Now AbstractBehavior is defined as a Scala source in another project. Initially I thought that the problem might be with compile order so I tried to set MultiJvm / compileOrder := CompileOrder.Mixed/MultiJvm / compileOrder := CompileOrder.ScalaThenJava into MultiJvm settings but that didn't have any impact.

Now if I revert some of the changes that javafmt did on some of the source files, it does genuinely fix the issue. It appears that the import order is changing the semantics of the java source files.

@mdedetrich
Copy link
Contributor Author

https://stackoverflow.com/questions/50145575/why-does-rearranging-imports-cause-compilation-to-fail might be related, in which case we should change the formatting style or add these files into ignore

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

Successfully merging this pull request may close these issues.

None yet

2 participants