F0rce/ace

ArrayStoreException: de.f0rce.ace.AceEditor (Vaadin 14.6.1)

Aklakan opened this issue · 3 comments

Describe the bug
For some reason with Vaadin 14.6.1 and v1.2.1 of this plugin I am getting a strange ArrayStoreException: de.f0rce.ace.AceEditor
when doing either

AceEditor textArea = new AceEditor();
add(textArea); // 'add()' takes a vararg of Components which is internally an array

or

Component c[] = new Component[] {null};
c[0] = textArea; // ArrayStoreException: de.f0rce.ace.AceEditor - WHAT THE HECK???

In my IDE AceEditor is shown as an indirect subclass of Component - so something strange is going on.
Not sure if its a Java8 / 11 byte code incompatibility or whether something is wrong with my setup (I used it successfully with other third party vaadin components).

I am also getting the exception when I install the F0rce/ace plugin from source with mvn clean install.

Maybe anyone has seen a similar issue before?

To Reproduce
I created a minimal setup here together with comments on how to run it and the stacktraces it produces: https://github.com/Aklakan/vaadin-ace-editor-issue

Expected behavior
Adding the AceEditor to a layout or assigning it as an element to an array of type Component should work successfully.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04 - open-jdk-11

Investigating the issue further, it seems that the spring-boot-devtools (which were added automatically by some version of the Vaadin project generator) cause some conflict between the plugin and class loaders. I don't know the exact rules, but devtools put most classes in a distinct 'restart' class loader which can cause problems when other classes (especially when they are part of an hierarchy) were loaded with the default class loader.

My minimal setup seems to work if I remove the following dependency - but then I lose the auto refresh/restart feature.
I am not yet sure whether all configurations which would allow me to use devtools with the ace editor have to go in my client project or whether there are some devtools-related options that could go into the ace plugin.

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<version>${spring-boot.version}</version>
			<optional>true</optional>
			<scope>runtime</scope>
		</dependency>
F0rce commented

Hello @Aklakan,

This seems super weird, maybe try contacting the Vaadin support team, because I get it running perfectly (under jetty...).

I'll leave this issue open and I would appreciate it if you would update me on that topic.

Have a great day,
David

The weird thing is that IMO spring-boot-devtools should only use a different class loader for classes in the 'local' project - i.e. for which *.java files exist because these can be reloaded - conversely, it should not use the refresh (or restart or whatever the name) class loader for third party dependencies.
I didn't get around it to look into this in more detail but I surely intend to do so.