Skip to content

default compilation bootclasspath is missing undocumented/internal APIs #6179

Closed

Description

@cushon

The compilation bootclasspath in the default Java toolchain is generated using this code:

* Output a jar file containing all classes on the platform classpath of the given JDK release.

It relies on the infrastructure added in JEP 247 to implement --release, which packages information about previous API versions into the JDK. The advantage of this approach is that it allows to correctly cross-compile to a specific target version without knowing what the target --javabase is.

However that API information only provides access to the public documented API: JDK-8206937. This excludes, for example, sun.misc.* APIs.

This limitation prevents code that depends on those APIs from using the default toolchain.

Related issues: #6154, #5733 (comment)

Example:

class A {
  sun.misc.Cleaner u;
}
java_library(
    name = "a",
    srcs = ["A.java"],
)
$ bazel version
Build label: 0.17.1
$ bazel build ...
ERROR: /tmp/tmp.i5tdIvBbOS/BUILD:1:1: Building liba.jar (1 source file) failed (Exit 1)
A.java:2: error: cannot find symbol
  sun.misc.Cleaner u;
          ^
  symbol:   class Cleaner
  location: package sun.misc
Target //:a failed to build

Activity

  1. added
    P1
    team-Rules-Java
    on Sep 18, 2018
  2. added a commit that references this issue on Sep 21, 2018
  3. cushon commented on Sep 26, 2018

    @cushon
    ContributorAuthor

    This was resolved by 999354b and 8e4ddb6.

  4. self-assigned this
    on Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1team-Rules-Java

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions