Skip to content

Cloner fails on enums and wrapped primitives #879

@stephengold

Description

@stephengold

It would be convenient if com.jme3.util.clone.Cloner worked on enums and wrapped primitives (such as Float and Boolean).

Currently, the test code (below) fails with an IllegalArgumentException because f is a Float, which is not an array, nor Cloneable, nor JmeCloneable.

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.font.LineWrapMode;
import com.jme3.util.clone.Cloner;

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        Boolean bo = false;
        Byte by = 0;
        Double d = 0.0;
        LineWrapMode e = LineWrapMode.Clip;
        Float f = 0f;
        Integer i = 0;
        Long l = 0L;

        Object clone;
        clone = Cloner.deepClone(f);
        clone = Cloner.deepClone(bo);
        clone = Cloner.deepClone(by);
        clone = Cloner.deepClone(d);
        clone = Cloner.deepClone(e);
        clone = Cloner.deepClone(i);
        clone = Cloner.deepClone(l);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions