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

setKeysMissingFromDeserialization() is never called #178

Open
mgmax opened this issue Dec 9, 2021 · 2 comments
Open

setKeysMissingFromDeserialization() is never called #178

mgmax opened this issue Dec 9, 2021 · 2 comments

Comments

@mgmax
Copy link
Collaborator

mgmax commented Dec 9, 2021

Okey I give up looking. I spend about 90 minutes going through the code and finally I see this section in GenericGcodeDriver.java:1271 after reading all visicut.managers.

  /**
   * Adjust defaults after deserializing driver from an old version of XML file
   */
  @Override
  protected void setKeysMissingFromDeserialization()
  {
    System.out.println("Testing whether we ever reach setKeysMissingFromDeserialization:");
    System.out.println("this.spindleMax: " + this.spindleMax);
    System.out.println("this.gCodeDigits: " + this.gCodeDigits);
    System.out.println("this.sCodeDigits: " + this.sCodeDigits);
    // added field spindleMax, needs to be set to 1.0 by default
    // but xstream initializes it to 0.0 when it is missing from XML
    if (this.spindleMax <= 0.0) this.spindleMax = 1.0;
    if (this.gCodeDigits <= 0) this.gCodeDigits = 6;
    if (this.sCodeDigits <= 0) this.sCodeDigits = 0;
  }

But according to the debugger this code is never reached and "not part of a class", my printouts don't show up and the values are not being used. Where is this usually handled if not there? I tried debugging this as well as running this as normal and it won't show up with gCodeDigits set to 6. What am I missing?

Originally posted by @McNugget6750 in #175 (comment)

@t-oster
Copy link
Owner

t-oster commented Dec 10, 2021

It is documented here

Maybe the method has to be declared in the implementing class also to work? Not sure, I will test it when I have time.

@t-oster
Copy link
Owner

t-oster commented Dec 10, 2021

Seems to be introduced by @madleech six years ago. Not sure if it is used anywhere but the generic gcode driver. However one can also use a nullable type and check for null in the getter to achieve the same result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants