-
Notifications
You must be signed in to change notification settings - Fork 21
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
Scaladoc: bad constant pool tag 19 #11635
Comments
It isn't obvious to me from the error message what the cause might be, so in order to make progress on this, we'd need a self-contained reproducer. |
I'm not familiar with GitLab, but could you show the exact pull request that changed the Scala version, and the accompanying failing logs on the CI environment? |
@eed3si9n Apologies for the late reply. The date you have is correct. I have now realized I am wrong. After that date I still had the CI/CD running the OK in 12 June 2019https://gitlab.com/cese/adw/pipelines/65873233 Failed 17 June 2019https://gitlab.com/cese/adw/pipelines/66598918 So the problem is not the change to 2.12.8. My apologies for this. However this allowed me to check the differences and (surprisingly for me) I have tracked the issue to the http://json4s.org/. More concretely: Changing the sbt build file to use:
Will investigate further. You can access CI here: |
@SethTisue Apologies for the late reply. I tried to change the offending Should I change the title of the issue or open a new one? If you or anyone else have any suggestion for diagnosing this please tell me. |
We can leave the ticket open while you investigate. You might check to see if the problem still exists in 2.13.0. (If it's already been fixed there, then perhaps the fix would be eligible for a backport to 2.12.x.) And also if the problem exists in the latest 2.12.x Scala nightly; a lot fixes have happened since 2.12.8. My minimization methodology is usually some form of: delete some code; And/or, if you can narrow it down to the particular json4s release that introduced the issue, or even the particular commit in the json4s repo, that might give us clues. So you might try bisecting on all the releases between 3.5.1 and 3.6.6. |
@SethTisue Thanks for the suggestions.
I have done this and stripped the project to 2 Scala files and a single comment. The branch can be found here: https://gitlab.com/cese/adw/tree/doctrouble The offending line is here: https://gitlab.com/cese/adw/blob/doctrouble/core/src/main/scala/pt/inescn/utils/NABUtils.scala#L7 Admittedly that comment is incorrect (cannot recall why I did that or when). However it only triggers the exception if a more recent Json4s library is include. Note that I am not importing or using any of the library classes or objects.
First and foremost only the https://gitlab.com/cese/adw/blob/doctrouble/build.sbt#L12
I tried the A final note: in the first attempt to diagnose the problem I could cause the exception to move to other parts of the |
We have same issue when trying presentation compiler on: import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.model.headers._
import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.{Directive0, Route}
trait CorsSupport {
private def addAccessControlHeaders: Directive0 = {
respondWithHeaders(
`Access-Control-Allow-Origin`.*,
`Access-Control-Allow-Credentials`(true),
`Access-Control-Allow-Headers`("Authorization", "Content-Type", "X-Requested-With")
)
}
private def preflightRequestHandler: Route = options {
complete(
HttpResponse(StatusCodes.OK)
.withHeaders(
`Access-Control-Allow-Methods`(OPTIONS, POST, GET)
)
)
}
def corsHandler(r: Route) = addAccessControlHeaders {
preflightRequestHandler ~ r
}
}
|
@hmf Could you update the title, reproductions steps, and the problem if needed please? |
https://gitlab.com/cese/adw/-/jobs/232862132 shows
but it is Debian package of OpenJDK so I'd take that with a grain of salt. |
I've updated the description of this issue with steps, problem, and expectations. |
Fixes scala/bug#11635 Occasionally the compiler tries to parse the class files from the classpath. This happens, for example, during scaladoc comment referencing a class name `java.time.Instant`. This would cause error in JDK11 because it includes an unknown constant pool tag 9 (CONSTANT_Module). This updates the parser to skip it over.
@hmf @tgodzik can you verify that your issue is fixed in the Scala nightly 2.12.9-bin-87d43d0? (see https://stackoverflow.com/questions/40622878/how-do-i-tell-sbt-to-use-a-nightly-build-of-scala-2-12-or-2-13 for info on using nightly builds of Scala) |
@eed3si9n Apologies for not responding earlier. Only saw your request now.
Thanks for the update. |
@SethTisue I have checked that the very simple project I set-up is working. However I cannot check on the full project because of unresolved dependencies. For example:
|
Confirmed on my end, also everything seems to work with Metals. |
Note that Scala 2.11 is affected as well. |
Chiefly, this fixes an issue where the doc task would fail with Lift 3.3.0 and Scala <2.12.9, because Lift 3.3.0 was compiled with JDK 9 and the doc compiler pre-2.12.9 had issues with certain constants from JDK 9 (see scala/bug#11635 and scala/scala#8289).
I'm hitting this with 2.11.12, caused by |
Fixes scala/bug#11635 Occasionally the compiler tries to parse the class files from the classpath. This happens, for example, during scaladoc comment referencing a class name `java.time.Instant`. This would cause error in JDK11 because it includes an unknown constant pool tag 9 (CONSTANT_Module). This updates the parser to skip it over.
forward-port of scala/scala#10675 and scala/scala#8595 references scala/bug#12396 and scala/bug#11635 fixes #19527 ("bad constant pool tag 17") also fixes unreported potential "bad constant pool tag 19" and "bad constant pool tag 20" errors
steps
build.sbt
Hello.scala
doc
from sbt shell.problem
expectation
Just a warning, exactly how
doc
would run under JDK 8.notes
The original report by @hmf posted here - https://gist.github.com/eed3si9n/5a09c7f6b523f99b105eee082c9aa7fb
Relevant code: https://github.com/scala/scala/blame/v2.12.8/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala#L197
Constant pool tag 19 also known as
CONSTANT_Module
is a constant type introduced in JDK 9.The text was updated successfully, but these errors were encountered: