Skip to content

Regression in 2.13.0-M4 on Java 10: spurious "macro implementation not found" errors #10948

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

Closed
holograph opened this issue Jun 18, 2018 · 8 comments

Comments

@holograph
Copy link

holograph commented Jun 18, 2018

This happens with Scala 2.13.0-M4 on Java 10 (works with 2.12.6 on Java 10), and can be reproduced by:

  1. git clone git@github.com:scalamacros/resetallattrs.git
  2. git checkout scala-2.13.0-M4
  3. sbt ++2.13.0-M4 test

Expected result: correct compilation and execution of tests.

Actual result (edited for brevity):

druuge:resetallattrs tomer.gabel$ sbt ++2.13.0-M4 test
[info] Loading settings from plugins.sbt ...
[info] Loading global plugins from /Users/tomer.gabel/.sbt/1.0/plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/tomer.gabel/dev/resetallattrs/project
[info] Loading settings from build.sbt ...
[info] Setting Scala version to 2.13.0-M4 on 3 projects.
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/tomer.gabel/dev/resetallattrs/)
...
[info] Compiling 1 Scala source to /Users/tomer.gabel/dev/resetallattrs/tests/target/scala-2.13.0-M4/test-classes ...
[error] /Users/tomer.gabel/dev/resetallattrs/tests/src/test/scala/SignatureSuite.scala:7:39: macro implementation not found: resetAllAttrs
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error]       val x1: c.Tree = c.resetAllAttrs(x)
[error]                                       ^
[error] /Users/tomer.gabel/dev/resetallattrs/tests/src/test/scala/SignatureSuite.scala:5:47: could not find implicit value for parameter pos: org.scalactic.source.Position
[error]   test("path-dependent types work just fine") {
[error]                                               ^
[error] two errors found
[error] (tests / Test / compileIncremental) Compilation failed
[error] Total time: 6 s, completed 18 Jun 2018, 17:00:39

The same code compiles fine on 2.11.x, 2.12.x and 2.13.0-M3, and the macro invocation is in a completely different project from its definition. The second error seems to indicate that a Scalactic macro fails to run as well. Is this a regression or am I missing something? (cross-referencing scalamacros/resetallattrs#12)

@SethTisue
Copy link
Member

I followed the given reproduction steps and there was no error. transcript: https://gist.github.com/SethTisue/5e2cd519592c2bbc197a3e06e94e5ccc

@mcanlas
Copy link

mcanlas commented Jun 19, 2018

One thing that's missing from the instructions is cd resetallattrs/ in case anyone else tries to robotically copy paste it all, haha.

@lrytz
Copy link
Member

lrytz commented Jun 20, 2018

Cannot reproduce it either, so I'm closing this. @holograph could you try again on your side, maybe with a git clean -dffx? Please re-open if you still see the issue.

@lrytz lrytz closed this as completed Jun 20, 2018
@holograph
Copy link
Author

I'm trying to reproduce this properly, will follow up

@holograph
Copy link
Author

@lrytz @SethTisue This appears to be a regression with later JDKs. Specifically, the error occurs with JDK 10.0.1 but NOT with JDK 1.8.0_171:

druuge:resetallattrs tomer.gabel$ git clean -dffx
Removing project/project/
Removing project/target/
Removing resetallattrs/target/
Removing root/
Removing target/
Removing tests/target/
druuge:resetallattrs tomer.gabel$ sbt ++2.13.0-M4 test
[info] Loading settings from plugins.sbt ...
[info] Loading global plugins from /Users/tomer.gabel/.sbt/1.0/plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/tomer.gabel/dev/resetallattrs/project
[info] Updating ProjectRef(uri("file:/Users/tomer.gabel/dev/resetallattrs/project/"), "resetallattrs-build")...
[info] Done updating.
[info] Loading settings from build.sbt ...
[info] Set current project to default-b77b53 (in build file:/Users/tomer.gabel/dev/resetallattrs/)
[info] Set current project to root (in build file:/Users/tomer.gabel/dev/resetallattrs/)
[info] Setting Scala version to 2.13.0-M4 on 3 projects.
[info] Excluded 1 projects, run ++ 2.13.0-M4 -v for more details.
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/tomer.gabel/dev/resetallattrs/)
[info] Updating resetallattrs...
[info] Done updating.
[info] Updating tests...
[info] Done updating.
[info] Compiling 2 Scala sources to /Users/tomer.gabel/dev/resetallattrs/resetallattrs/target/scala-2.13.0-M4/classes ...
[info] Done compiling.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/Users/tomer.gabel/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/protobuf-java-3.3.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] Compiling 1 Scala source to /Users/tomer.gabel/dev/resetallattrs/tests/target/scala-2.13.0-M4/test-classes ...
[error] /Users/tomer.gabel/dev/resetallattrs/tests/src/test/scala/SignatureSuite.scala:7:39: macro implementation not found: resetAllAttrs
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error]       val x1: c.Tree = c.resetAllAttrs(x)
[error]                                       ^
[error] /Users/tomer.gabel/dev/resetallattrs/tests/src/test/scala/SignatureSuite.scala:5:47: could not find implicit value for parameter pos: org.scalactic.source.Position
[error]   test("path-dependent types work just fine") {
[error]                                               ^
[error] two errors found
[error] (tests / Test / compileIncremental) Compilation failed
[error] Total time: 6 s, completed 20 Jun 2018, 12:36:27

Followed by:

druuge:resetallattrs tomer.gabel$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    10.0.1, x86_64:	"Java SE 10.0.1"	/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
    1.8.0_171, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
druuge:resetallattrs tomer.gabel$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
druuge:resetallattrs tomer.gabel$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
druuge:resetallattrs tomer.gabel$ git clean -dffx
Removing project/project/
Removing project/target/
Removing resetallattrs/target/
Removing root/
Removing tests/target/
druuge:resetallattrs tomer.gabel$
druuge:resetallattrs tomer.gabel$ sbt ++2.13.0-M4 test
[info] Loading settings from plugins.sbt ...
[info] Loading global plugins from /Users/tomer.gabel/.sbt/1.0/plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/tomer.gabel/dev/resetallattrs/project
[info] Updating ProjectRef(uri("file:/Users/tomer.gabel/dev/resetallattrs/project/"), "resetallattrs-build")...
[info] Done updating.
[info] Loading settings from build.sbt ...
[info] Set current project to default-b77b53 (in build file:/Users/tomer.gabel/dev/resetallattrs/)
[info] Set current project to root (in build file:/Users/tomer.gabel/dev/resetallattrs/)
[info] Setting Scala version to 2.13.0-M4 on 3 projects.
[info] Excluded 1 projects, run ++ 2.13.0-M4 -v for more details.
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/tomer.gabel/dev/resetallattrs/)
[info] Updating resetallattrs...
[info] Done updating.
[info] Updating tests...
[info] Compiling 2 Scala sources to /Users/tomer.gabel/dev/resetallattrs/resetallattrs/target/scala-2.13.0-M4/classes ...
[info] Done updating.
[info] Non-compiled module 'compiler-bridge_2.13.0-M2' for Scala 2.13.0-M4. Compiling...
[info]   Compilation completed in 8.852s.
[info] Done compiling.
[info] Compiling 1 Scala source to /Users/tomer.gabel/dev/resetallattrs/tests/target/scala-2.13.0-M4/test-classes ...
[info] Done compiling.
[info] SignatureSuite:
[info] - path-dependent types work just fine
[info] ScalaTest
[info] Run completed in 377 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
[success] Total time: 13 s, completed Jun 20, 2018 12:38:34 PM

@lrytz
Copy link
Member

lrytz commented Jun 20, 2018

Thanks! I can reproduce the crash on Java 10 with 2.13.0-M4. Java 10 and 2.12.6 works.

@lrytz lrytz reopened this Jun 20, 2018
@lrytz lrytz changed the title Regression in 2.13.0-M4: spurious "macro implementation not found" errors Regression in 2.13.0-M4 on Java 10: spurious "macro implementation not found" errors Jun 20, 2018
@SethTisue
Copy link
Member

curious if Java 9 is affected too.

this is a nice reminder that we need a Java 10 community build

@SethTisue SethTisue added this to the 2.13.0-M5 milestone Jun 20, 2018
@hrhino
Copy link

hrhino commented Jun 26, 2018

This is fixed by scala/scala#6695 (re-merging fix for scala/scala-dev#480 after it was accidentally dropped during a forward merge.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants