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

Strange exception when creating own shorthand descriptors #71

Closed
nhubbard opened this issue Nov 21, 2021 · 2 comments
Closed

Strange exception when creating own shorthand descriptors #71

nhubbard opened this issue Nov 21, 2021 · 2 comments

Comments

@nhubbard
Copy link

nhubbard commented Nov 21, 2021

Hello again!

I've been trying to make a shorthand descriptor for the flex property, but no matter how I order the properties, I can't get CSSPropertyWithDefaultValue to stop throwing an exception about not using a CSSPropertyFree expect for the last element.

My shorthand descriptor looks like this (again, I apologize, it is written in Kotlin instead of Java). I attempted to order the properties per the MDN entry on the flex property.

class FlexShorthand : CSSShortHandDescriptor(
    ECSSProperty.FLEX,
    CSSPropertyWithDefaultValue(
        CCSSProperties.FLEX_GROW,
        "0"
    ),
    CSSPropertyWithDefaultValue(
        CCSSProperties.FLEX_BASIS,
        CCSSValue.PERC100
    ),
    CSSPropertyWithDefaultValue(
        CCSSProperties.FLEX_SHRINK,
        "0"
    )
)

Is there a specific way I should order it to make it work as expected? Or is this kind of shorthand descriptor impossible?

The exception text looks like this:

The SubProperty [CSSPropertyWithDefaultValue@0x603e25c5: property=[CSSPropertyFree@0x60fce0ca: prop=FLEX_GROW]; defaultValue=0] may not use an unspecified CSSPropertyFree except for the last element!
java.lang.IllegalArgumentException: The SubProperty [CSSPropertyWithDefaultValue@0x603e25c5: property=[CSSPropertyFree@0x60fce0ca: prop=FLEX_GROW]; defaultValue=0] may not use an unspecified CSSPropertyFree except for the last element!
	at com.helger.css.decl.shorthand.CSSShortHandDescriptor.<init>(CSSShortHandDescriptor.java:64)
	at com.github.nhubbard.autoclave.shorthands.FlexShorthand.<init>(FlexShorthand.kt:9)
	at com.github.nhubbard.autoclave.shorthands.FlexShorthandTest.flexShorthandTest(FlexShorthandTest.kt:50)
@phax
Copy link
Owner

phax commented Nov 22, 2021

@nhubbard there is nothing you can do at the moment - the key issue here is, that the properties are itself not properly typed.
So effectively flex-grow, flex-shrink and flex-basis are "free text" properties....
I am fixing this for 6.4.0 release

phax added a commit that referenced this issue Nov 22, 2021
@phax
Copy link
Owner

phax commented Nov 22, 2021

Fixed in 6.4.0

@phax phax closed this as completed Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants