Fixed
Details
Assignee
Yoann RodièreYoann RodièreReporter
Yoann RodièreYoann RodièreComponents
Sprint
NoneFix versions
Priority
Major
Details
Details
Assignee
Yoann Rodière
Yoann RodièreReporter
Yoann Rodière
Yoann RodièreComponents
Sprint
None
Fix versions
Priority
Created July 20, 2018 at 11:34 AM
Updated October 8, 2020 at 12:30 PM
Resolved September 16, 2020 at 8:08 AM
See
org.hibernate.search.v6poc.entity.pojo.mapping.building.impl.PojoIndexModelBinderImpl#addValueBridge
in particular: we just compare raw types, which might not be enough when a bridge is defined as something likeValueBridge<List<? extends Integer>, Integer>
for example.*Another problem*: when a bridge is defined as something like
MyBridge<T> implements ValueBridge<T, Integer>
, we will accept properties that have a type that matchT
, which means anything that extends Object, which means everything. But the bridge itself might not accept everything: it might rely on some internal component that only accepts the runtime value ofT
, which can be more precise thanObject
. There really isn't much we can do in that case, so we should detect value bridges where the first argument toValueBridge<T, F>
is a type variable, and throw an exception.A safer approach would be to:
1. Check that the type argument is not a type variable and does not contain any type variable (might be done in step 2), and fail if it does.
2. use the
TypePatternMatcherFactory
to create a pattern from the type argument, and ask that pattern to check that the value we're passing to the bridge has a supported type.We wouldn't support everything, that's for sure, but at least we would get safety by default: we would fail when an unsupported type pattern is encountered. And we could improve in the future, adding new supported patterns.