-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(demo): fix Vaadin 24 runtime error in demo
Close #139
- Loading branch information
1 parent
817ec46
commit c5a5260
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/test/java/com/flowingcode/vaadin/addons/twincolgrid/CompatibilityExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.flowingcode.vaadin.addons.twincolgrid; | ||
|
||
import com.vaadin.flow.component.select.Select; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
/** Binary compatibility utils for Vaadin 14-24 */ | ||
public class CompatibilityExtension { | ||
|
||
private static final Method setItems = lookupSetItems(); | ||
|
||
private static Method lookupSetItems() { | ||
try { | ||
return Select.class.getMethod("setItems", Object[].class); | ||
} catch (NoSuchMethodException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public static <T> void setItems(Select<T> select, T[] items) { | ||
try { | ||
setItems.invoke(select, (Object) items); | ||
} catch (IllegalAccessException | InvocationTargetException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters