Fix compile on Java 23
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index a9c6e0f..d5e4265 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -17,7 +17,7 @@
     strategy:
       fail-fast: false
       matrix:
-        jdk: ['8', '11', '17', '21']
+        jdk: ['8', '11', '17', '21', '23']
         os: [ubuntu-latest, windows-latest]
 
     steps:
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java
index ce85b68..8f4a6d6 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java
@@ -134,20 +134,20 @@
     /**
      * @return the last element of this sequence.
      */
-    public ListElement getLast() {
+    public T getLast() {
         return (isEmpty()
                 ? null
-                : (ListElement) ListUtil.getLast(this));
+                : ListUtil.getLast(this));
     }
 
     /**
      * Remove the last element of this sequence.
      * @return the removed element.
      */
-    public ListElement removeLast() {
+    public T removeLast() {
         return (isEmpty()
                 ? null
-                : (ListElement) ListUtil.removeLast(this));
+                : ListUtil.removeLast(this));
     }
 
     /**