Skip to content

Show module name in stacktrace #4008

@Thihup

Description

@Thihup

Currently the stacktraces in native image doesn't show the module name, even when using a Java module.

One example is the following:

public class Main {

    public static void main(String[] args) {
        if (!Main.class.getModule().isNamed())
            throw new AssertionError("Must be in a named module");
        StackTraceElement stackTraceElement = new Exception().getStackTrace()[0];
        String moduleName = stackTraceElement.getModuleName();
        if (moduleName == null || "".equals(moduleName))
            throw new AssertionError("Must be in a named module");
        System.out.println("Hello from " + moduleName);
    }
}

When using the module-path, I guess it should return the module name.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions