Skip to content

TextFlowExt incompatible with JavaFX 25 #1282

@Col-E

Description

@Col-E

The methods defined here:

PathElement[] getUnderlineShape(int from, int to) {

Now override final methods that exist in the base JFX TextFlow class: openjdk/jfx@04c5e40


The exception:

Caused by: java.lang.IncompatibleClassChangeError: class org.fxmisc.richtext.TextFlowExt overrides final method javafx.scene.text.TextFlow.getUnderlineShape(II)[Ljavafx/scene/shape/PathElement;
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        ...
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
	at org.fxmisc.richtext.ParagraphBox.<init>(ParagraphBox.java:98)
        ...
	at org.fxmisc.richtext.GenericStyledArea.<init>(GenericStyledArea.java:811)
	at org.fxmisc.richtext.StyledTextArea.<init>(StyledTextArea.java:33)
	at org.fxmisc.richtext.StyledTextArea.<init>(StyledTextArea.java:45)
	at org.fxmisc.richtext.StyleClassedTextArea.<init>(StyleClassedTextArea.java:21)
	at org.fxmisc.richtext.StyleClassedTextArea.<init>(StyleClassedTextArea.java:34)
	at org.fxmisc.richtext.CodeArea.<init>(CodeArea.java:37)

You can observe the failure by using a CodeArea with JavaFX 26-ea

Possible fixes:

  • Rename the methods in TextFlowEx to maintain compatibility with older JavaFX releases and newer ones
    • The methods added by RichTextFX are package private anyways, so library consumers will see this as an invisible change that fixes JavaFX 25+ incompatibility
  • Bump the minimum target to JavaFX 25 and drop support for older releases
    • Library consumers will see this as a patch that requires bumping JavaFX in their own projects, and in turn possibly bumping up to Java 23+ (As JavaFX has a N-2 version target policy now)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions