vendredi 10 juin 2016

Argument type mismatch when invoking method with paramater

Legend legend = ApplicationContext.getLegend();
TreePath[] treePath = getTreePath();
Method method = legend.getClass().getDeclaredMethod("getItems", TreePath[].class);
method.setAccessible(true);
method.invoke(legend, treePath);

In Legend.class:

private List<LegendItem> getItems(TreePath[] treePath) {...}

Why do I get an "Java.lang.IllegalArgumentException: argument type mismatch" when I execute? I defined the parameter to be TreePath[] and the parameter I pass is of that type?!





Aucun commentaire:

Enregistrer un commentaire