eo icon indicating copy to clipboard operation
eo copied to clipboard

Can't dataize integer or float

Open ivan-egorov42 opened this issue 1 year ago • 4 comments

I think it's necessary to notify users of EO that we can't dataize integer or float like this:

[] > app
  5 > @

Here is output after eoc dataize app:

Exception in thread "main" java.lang.ClassCastException: Cannot cast java.lang.Long to java.lang.Boolean
	at java.base/java.lang.Class.cast(Class.java:3605)
	at org.eolang.Dataized.take(Dataized.java:127)
	at org.eolang.Main.run(Main.java:190)
	at org.eolang.Main.main(Main.java:98)

Or maybe I do smth wrong?

ivan-egorov42 avatar Aug 30 '22 14:08 ivan-egorov42

@yegor256 please, have a look.

ivan-egorov42 avatar Aug 30 '22 14:08 ivan-egorov42

@mximp currently, in org.eolang.Main we have this code:

        if (!new Dataized(app).take(Boolean.class)) {
            throw new IllegalStateException(
                "Runtime dataization failure"
            );
        }

In other words, we expect the object being dataized to become a Boolean. In the example above, it becomes a Long, that's why the exception. Let's change Main so that it doesn't fail, but instead print the result of dataization.

yegor256 avatar Aug 30 '22 14:08 yegor256

@Nypiaka please have a look

mximp avatar Sep 05 '22 14:09 mximp

@yasamprom please assist

mximp avatar Sep 23 '22 08:09 mximp

@yasamprom What's up with this issue?

Graur avatar Nov 14 '22 09:11 Graur

@Graur there is PR open which is still in code review. I believe someone needs to take this over.

mximp avatar Nov 14 '22 09:11 mximp

@mximp @Graur there was a problem with possible runtime error but I think it is fixed now. Check please

yasamprom avatar Nov 14 '22 09:11 yasamprom

@mximp still a bug?

yegor256 avatar Mar 05 '23 05:03 yegor256

@yegor256 Still open bug. Needed to be fixed.

mximp avatar Mar 06 '23 07:03 mximp