Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdi-dev] History of/rationale for type closure rules for producer method return types?

On Mon, Aug 5, 2024 at 9:01 AM Ladislav Thon via cdi-dev <cdi-dev@xxxxxxxxxxx> wrote:
I don't think there would be a problem in including Cloneable and Serializable. It just doesn't feel particularly useful.

Hm, this might be possible but I don't really see a use for it that wouldn't already be covered by having Object as type (mostly just a catch-all type to monitor/tweak bean attributes).
The only case I am not sure about is proxyability; array types are not proxible but if you can treat that same bean as Serializable, that should be proxyable.
 
When it comes to arrays of superclasses, remember that arrays are both mutable and covariant. Meaning that if someone produced Integer[] and someone else consumed it as Number[], they could set some element of the array to a Double, violating the original expectation that only Integers are present. I wasn't doing CDI at that time, but this feels like a good enough reason to exclude arrays of superclasses.

I do not know the original decision either but your justification makes a lot of sense.
 

LT

On Sat, 3 Aug 2024 at 20:31, Ondro Mihályi via cdi-dev <cdi-dev@xxxxxxxxxxx> wrote:
OK, you both proved me wrong, thanks :)

Now I really don’t know why the spec has this restriction on arrays.

Ondro

On Sat, 3 Aug 2024 at 18:36, Laird Nelson via cdi-dev <cdi-dev@xxxxxxxxxxx> wrote:
On Sat, Aug 3, 2024 at 12:35 AM Ondro Mihályi <mihalyi@xxxxxxxxxxx> wrote:
It's probably because at that time, when this rule was added into CDI 1.0, Java 6 was the latest version.


L
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdi-dev
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdi-dev
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdi-dev

Back to the top