vaadin / vaadin/framework

HasFilterableDataProvider#setDataProvider(DataProvider) is broken for ComboBox

Open
#11,469 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

ComboBox implements the interface HasFilterableDataProvider and does not override the methode setDataProvider(DataProvider). (in fact ComboBox is the only implementation in core framework).

In "normal" code that has correct generic types, this method could not be used because of the incompatible type setup. But in more generic code (for example you do not know that it is a comboBox but a HasFilterableDataProvider) you could simply call the method.

When the method is used to setup the data provider, the filter is broken. When you enter something in the combo box a ClassCastException occures.

It is quite hard to notice that something is broken. Even our UI Tests would actually not test wether the filter of a combobox works. So I think it is necessary to throw a RuntimeException (for example IllegalArgumentException) when this method is called. Even better: make it deprecated because there seems to to be no useful way to use it in core framework.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading HasFilterableDataProvider and ComboBox, focusing on the setDataProvider(DataProvider) entry point and the filter path it reaches. Check the existing ComboBox UI tests, including whether generic-provider usage is covered. Done means the incompatible call has an intentional, documented outcome and entering a filter no longer produces the reported ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.