Skip to content
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

Shell Table does not work in Native Compilation #1154

Open
denberr95 opened this issue Dec 27, 2024 · 0 comments
Open

Shell Table does not work in Native Compilation #1154

denberr95 opened this issue Dec 27, 2024 · 0 comments
Labels
status/need-triage Team needs to triage and take a first look

Comments

@denberr95
Copy link

Software:

  • Spring Boot: 3.4.0
  • Spring Shell: 3.4.0
  • GraalVM: graalvm-jdk-23.0.1+11.1
  • Java: 21

What I’m doing:

Creating a Spring Shell application and compiling it in native mode.
The commands must print a Shell Table with a DTO.

package com.reproducer.shell.model;

import java.util.Objects;

public class SampleDTO {

    private String name;

    private String surname;

    /**
     * @return the name
     */
    public String getName() {
        return this.name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the surname
     */
    public String getSurname() {
        return this.surname;
    }

    /**
     * @param surname the surname to set
     */
    public void setSurname(String surname) {
        this.surname = surname;
    }

    /**
     * @param name
     * @param surname
     */
    public SampleDTO(String name, String surname) {
        this.name = name;
        this.surname = surname;
    }

    /**
     * 
     */
    public SampleDTO() {}

    @Override
    public int hashCode() {
        return Objects.hash(this.name, this.surname);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!(obj instanceof SampleDTO other))
            return false;
        return Objects.equals(this.name, other.name) && Objects.equals(this.surname, other.surname);
    }

    @Override
    public String toString() {
        return "SampleDTO [name=" + this.name + ", surname=" + this.surname + "]";
    }
}

Behavior:

  • JVM Scenario:

When compiling the Java application into a jar and running it, the framework correctly prints the table.

image

  • Native Scenario:

When compiling the Java application into an executable (I’m using macOS Sonoma Version 14.7.1), running the command to print the Shell Table causes the application to throw an exception.

image

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-triage Team needs to triage and take a first look
Projects
None yet
Development

No branches or pull requests

1 participant