What is wrong with my implemented Interface?

Working on Vision, Chart component in configureChart Extension Function.

I’m trying to rewrite and/or hide some pens name that is appearing in the legend. I’m trying to use the method setSources() that needs LegendItemSource interface.

I’m implementing this with

class MyLegendItemSource(LegendItemSource):
	def getLegendItems(self):
		return legendItemsOverride

when I call the method’s class I’m getting:

print MyLegendItemSource().getLegendItems()
output: org.jfree.chart.LegendItemCollection@56a7d44b

However, when I attempt to set the source with legend.setSources(MyLegendItemSource()). Where legend = chart.getLegend()

I’m getting this:

[AWT-EventQueue-0] ERROR Vision.ClassicChart - Error invoking extension method.
org.python.core.PyException: Traceback (most recent call last):
  File "<extension-method configureChart>", line 68, in configureChart
TypeError: setSources(): 1st arg can't be coerced to org.jfree.chart.LegendItemSource[]

	at org.python.core.Py.TypeError(Py.java:235)
	at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:209)
	at org.python.core.PyReflectedFunction.throwBadArgError(PyReflectedFunction.java:312)
	at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:321)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:167)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
	at org.python.core.PyObject.__call__(PyObject.java:404)
	at org.python.core.PyObject.__call__(PyObject.java:408)
	at org.python.core.PyMethod.__call__(PyMethod.java:124)
	at org.python.pycode._pyx1702.configureChart$1(<extension-method configureChart>:68)
	at org.python.pycode._pyx1702.call_function(<extension-method configureChart>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
	at org.python.core.PyFunction.function___call__(PyFunction.java:376)
	at org.python.core.PyFunction.__call__(PyFunction.java:371)
	at org.python.core.PyFunction.__call__(PyFunction.java:361)
	at org.python.core.PyFunction.__call__(PyFunction.java:356)
	at com.inductiveautomation.vision.api.client.components.model.ExtensionFunction.invoke(ExtensionFunction.java:152)
	at com.inductiveautomation.factorypmi.application.components.PMIChart.createChartImpl(PMIChart.java:489)
	at com.inductiveautomation.factorypmi.application.components.chart.PMILineChartPanel.createChart(PMILineChartPanel.java:136)
	at com.inductiveautomation.factorypmi.application.components.PMIChart.setExtensionFunctions(PMIChart.java:474)
	at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor.applyChanges(ComponentScriptEditor.java:599)
	at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor.access$600(ComponentScriptEditor.java:85)
	at com.inductiveautomation.factorypmi.designer.eventhandling.ComponentScriptEditor$4.actionPerformed(ComponentScriptEditor.java:330)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue.access$500(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

What I missing since is not the first time I’m implemeting an interface.

Looks like it’s expecting an array of LegendItemSource.

Yep, my bad. I didn’t notice []. Thanks @Kevin.Herron