IndexedContainerProperty.setValue(...)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 717
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
Originally by psc1952
The "setValue" method of IndexedContainerProperty, line 941 has the following:
} else if (getType().isAssignableFrom(newValue.getClass())) {
Since 'newValue' is an Object, the above code will fail if 'getType()' returns a boolean. See below:
/**
- Determines if the class or interface represented by this
- {@code Class} object is either the same as, or is a superclass or
- superinterface of, the class or interface represented by the specified
- {@code Class} parameter. It returns {@code true} if so;
- otherwise it returns {@code false}. If this {@code Class}
- object represents a primitive type, this method returns
- {@code true} if the specified {@code Class} parameter is
- exactly this {@code Class} object; otherwise it returns
- {@code false}.
-
- <p> Specifically, this method tests whether the type represented by the
- specified {@code Class} parameter can be converted to the type
- represented by this {@code Class} object via an identity conversion
- or via a widening reference conversion. See <em>The Java Language
- Specification</em>, sections 5.1.1 and 5.1.4 , for details.
-
- @param cls the {@code Class} object to be checked
- @return the {@code boolean} value indicating whether objects of the
- type {@code cls} can be assigned to objects of this class
- @exception NullPointerException if the specified Class parameter is
- null.
- @since JDK1.1
-/
public native boolean isAssignableFrom(Class<?> cls);
With 'getType()' returning a boolean, an error will occur every time. Extra code needs to be added to check for boxing.
Imported from https://dev.vaadin.com/ issue #19662
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with IndexedContainerProperty.setValue(...) around line 941 and inspect how its type check handles primitive boolean values. Add coverage for the reported boolean case and confirm that setting a boolean-typed property no longer fails because the runtime value is an object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100