Skip to content

jmh rules uses jmh hook that doesn't support Java 8 bytecode #295

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

Open
gkossakowski opened this issue Oct 5, 2017 · 0 comments
Open

jmh rules uses jmh hook that doesn't support Java 8 bytecode #295

gkossakowski opened this issue Oct 5, 2017 · 0 comments

Comments

@gkossakowski
Copy link

While upgrading the rules to Scala 2.12, we've run into mysterious:

ERROR: /Users/gkk/stripe/rules_scala/test/jmh/BUILD:23:1: Couldn't build file test/jmh/test_benchmark_codegen.srcjar: Generating benchmark code for //test/jmh:test_benchmark_codegen failed (Exit 1).
Exception in thread "main" java.lang.RuntimeException
	at org.objectweb.asm.MethodVisitor.visitParameter(Unknown Source)
	at org.objectweb.asm.ClassReader.b(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.openjdk.jmh.generators.asm.ASMGeneratorSource.processClass(ASMGeneratorSource.java:60)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.$anonfun$generateJmhBenchmark$3(BenchmarkGenerator.scala:140)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.$anonfun$generateJmhBenchmark$3$adapted(BenchmarkGenerator.scala:139)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.$anonfun$generateJmhBenchmark$2(BenchmarkGenerator.scala:139)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.withClassLoader(BenchmarkGenerator.scala:97)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.$anonfun$generateJmhBenchmark$1(BenchmarkGenerator.scala:134)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.$anonfun$generateJmhBenchmark$1$adapted(BenchmarkGenerator.scala:127)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.withTempDirectory(BenchmarkGenerator.scala:107)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.generateJmhBenchmark(BenchmarkGenerator.scala:127)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator$.main(BenchmarkGenerator.scala:43)
	at io.bazel.rules_scala.jmh_support.BenchmarkGenerator.main(BenchmarkGenerator.scala)

I traced this problem and it's unrelated to Scala 2.12 but related to Java 8 bytecode support. The culpirt is this place: http://hg.openjdk.java.net/code-tools/jmh/file/1ddf31f810a3/jmh-generator-asm/src/main/java/org/openjdk/jmh/generators/asm/ASMClassInfo.java#l65
(called indirectly from BenchmarkGenerator)

asm-based generator in jmh has ASM4 level of bytecode support hardcoded in it which means it supports bytecode up to Java 7. It doesn't look like there's a way to pass a newer version as a parameter so I suspect this code is not widely used.

For comparison, sbt-jmh is calling a different generator in asm: https://github.com/ktoso/sbt-jmh/blob/master/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala#L125

gkossakowski pushed a commit to gkossakowski/rules_scala that referenced this issue Oct 11, 2017
See bazel-contrib#295 for why it's
failing.
johnynek pushed a commit that referenced this issue Oct 14, 2017
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

* Set -source 1.8 and -target 1.8 javac options

This makes the code to compile again on my laptop.

* Remove dropped args when calling java_common.create_provider

The 031e73c restructured
java_commmon rule and dropped both `transitive_compile_time_jars`
and `transitive_runtime_jars` from that rule. Let's sync scala.bzl
with that change.

* Upgrade to Scala 2.12.3

* Switch to Scala nightly build with classpath caching fix

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See #251 (comment)
for the details of the bug.

* Crash jmh with an explanation why it doesn't work

Link to an issue explaining the jmh failure is related to Java 8 and not
directly caused by the Scala 2.12.

* Upgrade the hash of the nightly build

For mysterious reasons, the hash has changed for a build that should be
unique. A sign that relying on nightly builds is risky. Yolo for now,
though.

* Revert "Switch to Scala nightly build with classpath caching fix"

This reverts commit 55fd807.

Switch back to 2.12.3 until 2.12.4 is released. This will make the testing
easier for projects that rely on compiler plugins.

* Disable jmh test

See #295 for why it's
failing.

* Switch back to bazel maven mirror

Not sure why I switched to the main one in the first place.

* Revert "Switch back to bazel maven mirror"

This reverts commit 4e266fc.

It turns out, the bazel mirror is not great for us because
it misses some artifacts:

ERROR: /Users/gkk/stripe/rules_scala/twitter_scrooge/twitter_scrooge.bzl:46:3: no such package '@util_core//jar': Failed to fetch Maven dependency: Could not transfer artifact com.twitter:util-core_2.12:jar:6.45.0 from/to util_core (http://mirror.bazel.build/repo1.maven.org/maven2/): Forbidden (403) and referenced by '//external:io_bazel_rules_scala/dependency/thrift/util_core'.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to #305

* Disable the jmh test in test_run.sh

The target is already commented out in BUILD file, but test_run.sh still
tries to run it.
nmurthy pushed a commit to zenreach/rules_scala that referenced this issue Dec 18, 2017
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

* Set -source 1.8 and -target 1.8 javac options

This makes the code to compile again on my laptop.

* Remove dropped args when calling java_common.create_provider

The 031e73c restructured
java_commmon rule and dropped both `transitive_compile_time_jars`
and `transitive_runtime_jars` from that rule. Let's sync scala.bzl
with that change.

* Upgrade to Scala 2.12.3

* Switch to Scala nightly build with classpath caching fix

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.

* Crash jmh with an explanation why it doesn't work

Link to an issue explaining the jmh failure is related to Java 8 and not
directly caused by the Scala 2.12.

* Upgrade the hash of the nightly build

For mysterious reasons, the hash has changed for a build that should be
unique. A sign that relying on nightly builds is risky. Yolo for now,
though.

* Revert "Switch to Scala nightly build with classpath caching fix"

This reverts commit 55fd807.

Switch back to 2.12.3 until 2.12.4 is released. This will make the testing
easier for projects that rely on compiler plugins.

* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Switch back to bazel maven mirror

Not sure why I switched to the main one in the first place.

* Revert "Switch back to bazel maven mirror"

This reverts commit 4e266fc.

It turns out, the bazel mirror is not great for us because
it misses some artifacts:

ERROR: /Users/gkk/stripe/rules_scala/twitter_scrooge/twitter_scrooge.bzl:46:3: no such package '@util_core//jar': Failed to fetch Maven dependency: Could not transfer artifact com.twitter:util-core_2.12:jar:6.45.0 from/to util_core (http://mirror.bazel.build/repo1.maven.org/maven2/): Forbidden (403) and referenced by '//external:io_bazel_rules_scala/dependency/thrift/util_core'.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305

* Disable the jmh test in test_run.sh

The target is already commented out in BUILD file, but test_run.sh still
tries to run it.
hmemcpy pushed a commit to wix-incubator/rules_scala that referenced this issue Jan 28, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

* Set -source 1.8 and -target 1.8 javac options

This makes the code to compile again on my laptop.

* Remove dropped args when calling java_common.create_provider

The 031e73c restructured
java_commmon rule and dropped both `transitive_compile_time_jars`
and `transitive_runtime_jars` from that rule. Let's sync scala.bzl
with that change.

* Upgrade to Scala 2.12.3

* Switch to Scala nightly build with classpath caching fix

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.

* Crash jmh with an explanation why it doesn't work

Link to an issue explaining the jmh failure is related to Java 8 and not
directly caused by the Scala 2.12.

* Upgrade the hash of the nightly build

For mysterious reasons, the hash has changed for a build that should be
unique. A sign that relying on nightly builds is risky. Yolo for now,
though.

* Revert "Switch to Scala nightly build with classpath caching fix"

This reverts commit 55fd807.

Switch back to 2.12.3 until 2.12.4 is released. This will make the testing
easier for projects that rely on compiler plugins.

* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Switch back to bazel maven mirror

Not sure why I switched to the main one in the first place.

* Revert "Switch back to bazel maven mirror"

This reverts commit 4e266fc.

It turns out, the bazel mirror is not great for us because
it misses some artifacts:

ERROR: /Users/gkk/stripe/rules_scala/twitter_scrooge/twitter_scrooge.bzl:46:3: no such package '@util_core//jar': Failed to fetch Maven dependency: Could not transfer artifact com.twitter:util-core_2.12:jar:6.45.0 from/to util_core (http://mirror.bazel.build/repo1.maven.org/maven2/): Forbidden (403) and referenced by '//external:io_bazel_rules_scala/dependency/thrift/util_core'.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305

* Disable the jmh test in test_run.sh

The target is already commented out in BUILD file, but test_run.sh still
tries to run it.
hmemcpy pushed a commit to wix-incubator/rules_scala that referenced this issue Jan 28, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

* Set -source 1.8 and -target 1.8 javac options

This makes the code to compile again on my laptop.

* Remove dropped args when calling java_common.create_provider

The 031e73c restructured
java_commmon rule and dropped both `transitive_compile_time_jars`
and `transitive_runtime_jars` from that rule. Let's sync scala.bzl
with that change.

* Upgrade to Scala 2.12.3

* Switch to Scala nightly build with classpath caching fix

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.

* Crash jmh with an explanation why it doesn't work

Link to an issue explaining the jmh failure is related to Java 8 and not
directly caused by the Scala 2.12.

* Upgrade the hash of the nightly build

For mysterious reasons, the hash has changed for a build that should be
unique. A sign that relying on nightly builds is risky. Yolo for now,
though.

* Revert "Switch to Scala nightly build with classpath caching fix"

This reverts commit 55fd807.

Switch back to 2.12.3 until 2.12.4 is released. This will make the testing
easier for projects that rely on compiler plugins.

* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Switch back to bazel maven mirror

Not sure why I switched to the main one in the first place.

* Revert "Switch back to bazel maven mirror"

This reverts commit 4e266fc.

It turns out, the bazel mirror is not great for us because
it misses some artifacts:

ERROR: /Users/gkk/stripe/rules_scala/twitter_scrooge/twitter_scrooge.bzl:46:3: no such package '@util_core//jar': Failed to fetch Maven dependency: Could not transfer artifact com.twitter:util-core_2.12:jar:6.45.0 from/to util_core (http://mirror.bazel.build/repo1.maven.org/maven2/): Forbidden (403) and referenced by '//external:io_bazel_rules_scala/dependency/thrift/util_core'.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305

* Disable the jmh test in test_run.sh

The target is already commented out in BUILD file, but test_run.sh still
tries to run it.
johnynek pushed a commit that referenced this issue Apr 1, 2018
* Upgrade versions of JMH 1.17.4 -> 1.20, asm 5.0.4 -> 6.1.1

* Add reflection-based generator for JMH (make it default)
johnynek pushed a commit that referenced this issue Apr 1, 2018
* Upgrade versions of JMH 1.17.4 -> 1.20, asm 5.0.4 -> 6.1.1

* Add reflection-based generator for JMH (make it default)
gkk-stripe added a commit to gkk-stripe/rules_scala that referenced this issue Apr 3, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.
* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305
gkk-stripe added a commit to gkk-stripe/rules_scala that referenced this issue Apr 3, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.
* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305
natansil pushed a commit to wix-incubator/rules_scala that referenced this issue Apr 15, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.
* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305
gkk-stripe added a commit to gkk-stripe/rules_scala that referenced this issue Apr 18, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.
* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305
natansil pushed a commit to wix-incubator/rules_scala that referenced this issue May 8, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.
* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305
ittaiz pushed a commit to wix-incubator/rules_scala that referenced this issue May 20, 2018
* Scala 2.12 updates

Bump dependencies to versions that support Scala 2.12.

* Fix incompatible scrooge api change.

They swapped the logger interface and now there's a different went to
silence the logging.

* Add scalactic as a transitive dep of scalatest

Newer versions of scalatest have scalactic as a dependency. Let bazel
know about it and add its a transitive dep.

* Add a missing dependency on util_core from scrooge rule

Add a missing dependency on Twitter's util_core from scrooge rule

Switch to a recent nightly build that has a fix for the flat classpath
caching bug that is breaking bazel's incremental compilation when worker
is enabled.

See bazel-contrib#251 (comment)
for the details of the bug.
* Disable jmh test

See bazel-contrib#295 for why it's
failing.

* Append YdisableFlatCpCaching to scalacopts by default

Append the `YdisableFlatCpCaching` compiler option by default as a
workaround to bazel-contrib#305
ianoc-stripe pushed a commit to ianoc-stripe/rules_scala that referenced this issue Jun 12, 2018
* Upgrade versions of JMH 1.17.4 -> 1.20, asm 5.0.4 -> 6.1.1

* Add reflection-based generator for JMH (make it default)
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