Skip to content

Upgrade of JDK11 to >11.0.9.1 breaks android desugarer #12880

@comius

Description

@comius

Description of the problem / feature request:

Upgrade of JDK11 to version 11.0.9.1, 11.0.10 breaks Android desugarer. (Versions up to 11.0.9 work)
Problem is in Desugar.java#L108,
which attempts to set system property jdk.internal.lambda.dumpProxyClasses in static initializer before it is read by java.lang.invoke.InnerClassLambdaMetafactory static initializer. The latter initializer is invoked first.

Target //src/test/java/com/google/devtools/build/android/desugar:desugar_testdata fails to build, with exception:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.devtools.build.android.desugar.Desugar (file:/usr/local/google/home/ilist/.cache/bazel/_bazel_ilist/e9eba874c4fa4205502c6d2768696dfb/execroot/io_bazel/bazel-out/host/bin/src/tools/android/java/com/google/devtools/build/android/desugar/libdesugar.jar) to field java.lang.invoke.InnerClassLambdaMetafactory.dumper
WARNING: Please consider reporting this to the maintainers of com.google.devtools.build.android.desugar.Desugar
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
Exception in thread "main" java.lang.NullPointerException: Failed to register lambda dump directory '/tmp/lambdas17634769287980916750'

While tests

  • //src/test/java/com/google/devtools/build/android/desugar:DesugarMainClassTestLambdaDirectoryCorrectlySet, and
  • //src/test/java/com/google/devtools/build/android/desugar:DesugarMainClassTestLambdaDirectoryIncorrectlySet

continue to work (because property is set using jvm_opts).

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Checkout https://github.com/comius/bazel/tree/bazel_issue_12880
and run bazel test //src/test/java/com/google/devtools/build/android/desugar:desugar_testdata

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

Bazel@a181dd4

Related issue #12512

Metadata

Metadata

Labels

P2We'll consider working on this in future. (Assignee optional)team-AndroidIssues for Android teamtype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions