On Thu, 10 Sep 2026 17:01:16 GMT, Michael Strauß <[email protected]> wrote:
>> You can't assign 1.1 to an integer property in CSS, that would be an invalid >> declaration. Now, I think that in JavaFX, since no one bothered to think >> about the CSS implementation, the assignment succeeds and the value is >> truncated. >> But it's out of spec according to JavaFX's own >> [specification](https://openjfx.io/javadoc/26/javafx.graphics/javafx/scene/doc-files/cssref.html#typenumber): >> >>> Some value types may have integer values (denoted by <integer\>) or real >>> number values (denoted by <number\>). Real numbers and integers are >>> specified in decimal notation only. **An <integer\> consists of one or more >>> digits "0" to "9". A <number\> can either be an <integer\>, or it can be >>> zero or more digits followed by a dot (.) followed by one or more digits.** >>> Both integers and real numbers may be preceded by a "-" or "+" to indicate >>> the sign. -0 is equivalent to 0 and is not a negative number. >> >> It clearly says that a CSS <integer\> can't have fractional digits. > > Although we probably never need to account for bytes or shorts, since we only > have four primitive number types in JavaFX anyway. Right, so FX implementation might be too lenient in that respect. We could probably discuss it in a separate thread - should we print a warning, fail the style, truncate as it is now. For the purposes of serialization - I don't think we care about anything else but double and integer, since we can't differentiate a byte 1, short 1, long 1, and we could not possibly care about integer values outside of the range supported by double (-9,007,199,254,740,992 ... 9,007,199,254,740,992) which brings me to the original question: why do we need to serialize all these types? or am I missing something? ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2303#discussion_r3981581393
