Skip to content

Class.forName fails to load an inner class if the outer class has not been loaded #238

@warownia1

Description

@warownia1

Class.forName fails to load an inner classes by their name if their outer classes have not been loaded already.

Given the following class structure

package org.example;
public class Outer {
  public static class Inner {}
}

getting the inner class directly fails:

Class.forName("org.example.Outer$Inner");
// swingjs/j2s/org/example/Outer$Inner.js could not be loaded

however, loading the outer class first with any means makes accessing the inner class successful:

var _ignored = Outer.class;
Class.forName("org.example.Outer$Inner");
// success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions