tornadofx icon indicating copy to clipboard operation
tornadofx copied to clipboard

java.lang.NoClassDefFoundError: Could not initialize class no.tornado.tornadofx.idea.annotator.ColorsKt

Open Hackeitos opened this issue 4 years ago • 6 comments

I've got IntelliJ IDEA v2020.2.3 Community Edition, Build #IC-202.7660.26, tornadofx plugin v1.7.20 and JDK v1.8.0_261. Now by just creating a new tonadofx project and using any value from javafx.scene.paint.Color in a stylesheet (Exmple below) tornadofx plugin crashes and syntax highlighting stops working for that file. App compiles and runs just fine, the only thing not working is syntax highlighting.

package com.example

import javafx.scene.paint.Color
import tornadofx.Stylesheet


class Styles : Stylesheet() {
    companion object {
        val colorTransparent = Color.TRANSPARENT
    }
}

Stacktraces:

stacktrace.txt induced.txt

What it looks like: Image As you see, the last line is not underlined in red even if it is wrong.

Hackeitos avatar Nov 25 '20 08:11 Hackeitos

this is clearly not related to tornadofx (you need to clarify, the API may have changed). I would write to youtrack

SchweinchenFuntik avatar Nov 25 '20 19:11 SchweinchenFuntik

same issue

liugangnhm avatar Feb 22 '21 05:02 liugangnhm

I have similar for 2020.3 - in any project

SchweinchenFuntik avatar Mar 03 '21 18:03 SchweinchenFuntik

For the record I have zero experience with intelliJ plugins.

I "fixed" this problem by explicitly including javafx16 as a dependency for the plugin and updating the plugin intellij version to 2020.3. I had to comment out some stuff that no-doubt breaks some part of the plugin but at least I finally get to look at pretty colors in the gutter of my stylesheets:

image

Changes here

To use my version, clone the repo, run the buildPlugin task which will error out during the buildSearchableOptions task but nevertheless it will build the plugin. Navigate to build > distributions and you'll find the zip file in there. In intelliJ go to settings > plugins > install from disk and select this zip file.

Your stylesheets should now work with colors, but who knows what else I've broken.

If you don't want to go through the hassle of building it yourself I uploaded the plugin to google drive here.

SKeeneCode avatar Mar 22 '21 20:03 SKeeneCode

this is clearly not related to tornadofx (you need to clarify, the API may have changed). I would write to youtrack

How is this not a problem with TornadoFX? Isn't the developer of TornadoFX the same as the developer of the plugin?

javafx.scene.paint.Color works on it's own in kotlin, TornadoFX works, and the only problem is when they are used together via the plugin. Wouldn't that make this an issue with the plugin so long as the user is using JavaFX 8 as TornadoFX specifies?

Therefore the issue is the plugin.

flatted-fifth avatar Jan 11 '23 16:01 flatted-fifth

I noticed that this only happens when javafx.scene.paint.Color is used in the same file as tornadofx, so I created a new object in its own file that accesses what I need from the Color class, and import that object where I need those functions so I access them indirectly. It's reinventing the wheel but it works so far. I'm sure there's a better way to do this.

Edited to add: Using javafx.scene.paint.Color indirectly through a custom class has been working great for me so far. I created a simple interface to make creating classes that allow this easier.

flatted-fifth avatar Jan 12 '23 16:01 flatted-fifth