mill icon indicating copy to clipboard operation
mill copied to clipboard

BSPs aplenty

Open tballard opened this issue 2 years ago • 0 comments

Seeing improved shared code and mill-build meta support, I just switched to mill 0.11.4. Suddenly BSP instances in Intellij began to proliferate and I have to kill them continually. I wouldn't have necessarily guessed this was your problem, but I see you were recently fooling with BSP and the problem corresponded suspiciously with the mill update, so I thought you'd want to know.

Okay, more data: After fixing some code, I had one error left in the project, a class where a static method was trying to call a non-static one.

Compile options:

val JAVAC_OPS =
  if (DEVELOPING) Seq(
    "-g",
    "--release", "17",
    "-verbose",
    "-Xlint:unchecked",
    "-Xlint:deprecation"
  ) else Seq(
    "-g"
  )

val SCALAC_OPS =
  if (DEVELOPING) Seq(
    "-J-Xss1000M",
    "-encoding",
    "utf-8",
    "-deprecation",
    "-unchecked",
    "-feature"
  ) else Nil

First, I get output with a believable number of warnings with the error mixed in.

Then I get what seems like an error per class, something like

[error] [parsing started WrappedJavaFileObject[/Users/tballard/git/redspro3/reds/src/main/java/org/redangus/redspro/Main.java]]
[error] [parsing completed 0ms]
[error] [parsing started WrappedJavaFileObject[/Users/tballard/git/redspro3/reds/src/main/java/org/redangus/redspro/biz/AccountLoader.java]]
[error] [parsing completed 1ms]
[error] [parsing started WrappedJavaFileObject[/Users/tballard/git/redspro3/reds/src/main/java/org/redangus/redspro/biz/CRaGLoader.java]]
[error] [parsing completed 0ms]
...

After some thousands of those it says:

[error] Round 1:
[error] 	input files: {org.redangus.redspro.Main, org.redangus.redspro.biz.AccountLoader, ...

And lists a bunch of class names.

Then it says:

[error] 	annotations: [org.redangus.core.annotation.Null, org.redangus.core.annotation.NotNull, java.lang.Override, java.lang.Deprecated, java.lang.SuppressWarnings, java.io.Serial, ...
[error] 	last round: false
[error] [loading /Users/tballard/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/springframework/spring-context/5.3.21/spring-context-5.3.21.jar(/org/springframework/context/annotation/FilterType.class)]
[error] Round 2:
[error] 	input files: {}
[error] 	annotations: []
[error] 	last round: true
[error] [checking org.redangus.redspro.Main]
[error] [wrote /Users/tballard/git/redspro3/out/reds/compile.dest/classes/org/redangus/redspro/Main.class]
[error] [checking org.redangus.redspro.biz.AccountLoader]
...

Finally, after 5000 lines of messages (guessing) it says:

1 targets failed
reds.compile javac returned non-zero exit code

If I slip that "static" in where it belongs, suddenly it builds fine using straight mill.

Well, I find that importing the BSP project in Intellij seems to "hang", too, making all the hung BSP build tasks seem about right.

Here's what the Intellij log says, if it tells you anything. It does have some Bsp4j stuff:

org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.io.IOException: Stream closed
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:72)
	at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:114)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.notify(RemoteEndpoint.java:126)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.sendCancelNotification(RemoteEndpoint.java:180)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint$1.cancel(RemoteEndpoint.java:150)
	at org.jetbrains.bsp.protocol.session.CancellableFuture.cancel(CancellableFuture.java:31)
	at org.jetbrains.bsp.protocol.session.Bsp4jJob.cancelWithError(jobs.scala:120)
	at org.jetbrains.bsp.protocol.session.Bsp4jJob.cancel(jobs.scala:115)
	at org.jetbrains.bsp.project.importing.BspProjectResolver.waitForProjectCancelable(BspProjectResolver.scala:217)
	at org.jetbrains.bsp.project.importing.BspProjectResolver.runImport(BspProjectResolver.scala:140)
	at org.jetbrains.bsp.project.importing.BspProjectResolver.resolveProjectInfo(BspProjectResolver.scala:58)
	at org.jetbrains.bsp.project.importing.BspProjectResolver.resolveProjectInfo(BspProjectResolver.scala:33)

Sorry if this seems a bit disjointed, but we love feedback, right?

tballard avatar Oct 01 '23 14:10 tballard