HyUI icon indicating copy to clipboard operation
HyUI copied to clipboard

non-null object for public static final java.util.Comparator java.lang.String.CASE_INSENSITIVE_ORDER

Open Bluecoaster455 opened this issue 10 months ago • 2 comments

I tried using a {{#each}} on a list of strings as such:

{{#each tags}}
    <p class="Tag">{{$item}}</p>
{{/each}}

The error I'm getting for doing so:

java.lang.IllegalArgumentException: non-null object for public static final java.util.Comparator java.lang.String.CASE_INSENSITIVE_ORDER
	at java.base/java.lang.reflect.AccessibleObject.canAccess(AccessibleObject.java:454)
	at au.ellie.hyui.html.TemplateProcessor.extractModelVariables(TemplateProcessor.java:815)
	at au.ellie.hyui.html.TemplateProcessor.processEachBlocks(TemplateProcessor.java:265)
	at au.ellie.hyui.html.TemplateProcessor.processTemplate(TemplateProcessor.java:187)
	at au.ellie.hyui.html.TemplateProcessor.processEachBlocks(TemplateProcessor.java:267)
	at au.ellie.hyui.html.TemplateProcessor.processTemplate(TemplateProcessor.java:194)
	at au.ellie.hyui.html.TemplateProcessor.process(TemplateProcessor.java:151)
	at au.ellie.hyui.html.HtmlParser.parse(HtmlParser.java:95)
	at au.ellie.hyui.html.HtmlParser.parseToInterface(HtmlParser.java:79)
	at au.ellie.hyui.builders.InterfaceBuilder.fromTemplate(InterfaceBuilder.java:77)

This affects any models where a static field exists as such:

public static class StringItem {
    public static final StringItem EMPTY = new StringItem(""); // This is the problematic line
    private String value;
    public StringItem(String value) {
        this.value = value;
    }
    public String getValue() {
        return value;
    }
}

Same for the String type and virtually any models with the CODEC static field are affected.

Right now the workaround for me is to make a class with a string field inside and avoid using static fields altogether to bypass the underlying issue.

Looking for a fix soon! Great mod btw 💯

Bluecoaster455 avatar Jan 29 '26 03:01 Bluecoaster455

The idea is to make classes for your models that contain things that the UI should use, not just throw internal hytale classes at it 👍

Buuuut, I'll try only access fields that are possible to access and not completely crash when it happens.

Elliesaur avatar Jan 29 '26 05:01 Elliesaur

Added in 0.5.10 (shortly released)

Elliesaur avatar Jan 30 '26 01:01 Elliesaur