<div dir="ltr">I found a need to look at section 2.2.1 of the specification (<a href="https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#legal_bean_types">https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#legal_bean_types</a>).<div><br></div><div>It says (in part, and I quote):</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"></blockquote><ul><li><span style="font-size:0.875rem">A bean type may be an array type. Two array types are considered identical only if the element type is identical.</span></li><li><span style="font-size:0.875rem">A bean type may be a primitive type. Primitive types are considered to be identical to their corresponding wrapper types in <font face="monospace">java.lang</font>.</span></li></ul><div><span style="font-size:0.875rem">I want to ask a question about the word &quot;identical&quot; in the bullet points above.  I&#39;ll refer to the bullet points above as #1 and #2 respectively.</span><br></div><div><br></div><div>Obviously (for example) <font face="monospace">Object.class</font> is identical to <font face="monospace">Object.class</font>.  This cannot be in doubt.</div><div><br></div><div>Next, let&#39;s look at #2.  #2 effectively says that for the purposes of CDI, <font face="monospace">int.class</font> is &quot;identical to&quot; <font face="monospace">Integer.class</font>.  This is true in CDI even though <font face="monospace">int.class != Integer.class</font><font face="arial, sans-serif"> and </font><font face="monospace">int.class.equals(Integer.class)</font><font face="arial, sans-serif">.  </font>I understand this fully; this is effectively boxing and unboxing conversions as defined by the JLS (<a href="https://docs.oracle.com/javase/specs/jls/se13/html/jls-5.html#jls-5.1.7" style="font-size:0.875rem">https://docs.oracle.com/javase/specs/jls/se13/html/jls-5.html#jls-5.1.7</a>).</div><div><br></div><div>Now consider <font face="monospace">int[].class</font> and <font face="monospace">Integer[].class</font>.</div><div><br></div><div>In Java, this doesn&#39;t compile (obviously):</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">final Integer[] integers = new int[0];</font></div></blockquote><div><br></div><div>And this doesn&#39;t compile either (equally obviously):</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">final int[] ints = new Integer[0];</font></div></blockquote><div><br></div><div>But in #1, the second sentence (together with section 5.2.1 where typesafe resolution is discussed) seems to indicate that <i>for the purposes of CDI</i> a target type of <font face="monospace">Integer[].class</font> should be able to conceptually accept a bean type of <font face="monospace">int[].class</font> (and vice versa).</div><div><br></div><div>This would seem to be the case because <span style="font-size:0.875rem"><font face="monospace">Integer[].class.getComponentType()</font> is <font face="monospace">Integer.class</font>, and <font face="monospace">int[].class.getComponentType()</font> is <font face="monospace">int.class</font>, and (according to #2) <font face="monospace">Integer.class</font> is &quot;identical to&quot; <font face="monospace">int.class</font>.</span></div><div><br></div><div>Was this the intention?  Was it intended that, for example, a producer method that returns <font face="monospace">int[]</font> should be able to have its return value converted by the container so that it &quot;fits in&quot; an injection point of type <font face="monospace">Integer[].class</font>?  Or was this imprecise use of language, where &quot;identical&quot; in #2 doesn&#39;t apply to #1?</div><div><br></div><div>Thanks,</div><div>Best,</div><div>Laird</div></div>