ColoredListCellRenderer

In my plugin I have a ColoredListCellrenderer. To set the text, I use the method append(String). The plugin compiles and works on IDEA 12.1.6. However, it compiles on IDEA 13.0.1 (even with the IDEA-UI 133.331 SDK), but when deployed, I get the following stacktrace:

org.dubik.tasks.ui.forms.TaskForm$PriorityComboBoxRenderer.append(Ljava/lang/String;)V: org.dubik.tasks.ui.forms.TaskForm$PriorityComboBoxRenderer.append(Ljava/lang/String;)V
java.lang.NoSuchMethodError: org.dubik.tasks.ui.forms.TaskForm$PriorityComboBoxRenderer.append(Ljava/lang/String;)V
    at org.dubik.tasks.ui.forms.TaskForm$PriorityComboBoxRenderer.customizeCellRenderer(TaskForm.java:200)
    at com.intellij.ui.ColoredListCellRenderer.getListCellRendererComponent(ColoredListCellRenderer.java:64)
    at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1361)
    at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1311)
    at javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(BasicListUI.java:2623)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:164)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:211)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:405)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:415)
    at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:459)
    at javax.swing.JList.setSelectedIndex(JList.java:2212)
    at javax.swing.plaf.basic.BasicComboPopup.setListSelection(BasicComboPopup.java:1144)
    at javax.swing.plaf.basic.BasicComboPopup.access$300(BasicComboPopup.java:63)
    at javax.swing.plaf.basic.BasicComboPopup$Handler.itemStateChanged(BasicComboPopup.java:982)
    at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1225)
    at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1282)
    at javax.swing.JComboBox.contentsChanged(JComboBox.java:1329)
    at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:118)
    at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:93)
    at javax.swing.DefaultComboBoxModel.addElement(DefaultComboBoxModel.java:131)
    at javax.swing.JComboBox.addItem(JComboBox.java:718)
    at org.dubik.tasks.ui.forms.TaskForm.<init>(TaskForm.java:65)
    at org.dubik.tasks.ui.actions.AddNewTaskAction.actionPerformed(AddNewTaskAction.java:41)
    at org.dubik.tasks.ui.actions.AddNewTaskAction.actionPerformed(AddNewTaskAction.java:35)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:162)
    at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:170)
    at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:133)
    at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:311)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:692)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:708)
    at java.awt.EventQueue$4.run(EventQueue.java:706)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:696)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:520)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)


There is nothing special about the renderer:

class PriorityComboBoxRenderer extends ColoredListCellRenderer {
        public PriorityComboBoxRenderer() {
            setOpaque(true);
        }

        @Override
        protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
            TaskPriority priority = (TaskPriority) value;
            setIcon(UIUtil.findIcon(priority));
            append(priority.toString());
        }
}

Does anybody know what causes this? I would think when I compile this on IDEA 13 without errors, I wouldn't be getting NoSuchMethod errors.

1 comment
Comment actions Permalink

The return type of the method has changed: it previously returned void and now returns SimpleColoredComponent. This change is source-compatible but not binary-compatible.

As a workaround, you can use the overload of append() that takes SimpleTextAttributes, which wasn't changed.

0

Please sign in to leave a comment.