Community
Participate
Working Groups
Inside ConstraintExpressionFormula.inferPolyInvocationType() we have a tweak commented thusly: // continuing at true is not spec'd but needed for javac-compatibility, // see org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_8.testBug428198() After implementing the tweak I received this answer from Dan Smith: My Question: > > Is javac right to accept this program? > >(I couldn't find an existing bug for this) > > > >import java.util.*; > >interface A {} > >interface B extends A {} > >public class Z { > > static Collection<A> test(B[] array) { > > Collection<A> collection = > > Collections.unmodifiableCollection( > > array == null ? Collections.EMPTY_LIST : Arrays.asList((A[]) array)); > > return collection; > > } > >} > > > >While reducing the constraint regarding EMPTY_LIST: > > List → Collection<? extends T#0> > >we need to apply unchecked conversion, which is remembered for later. > > > >Then during 18.5.2. we apply bullet 3.1: > > "If unchecked conversion was necessary for the method to be applicable in 18.5.1 ..." > >creating this constraint: > > ⟨Collection → Collection<A>⟩ > >As all subsequent bullets at that level are skipped > >(due to the "Otherwise, ..." disjunction) > >the parameter A in the target type has no effect on inference. > > > >Hence parameterization of that method is inferred as: > > Collection<Object> unmodifiableCollection(Collection<? extends Object>) Dan's answer: > Here's where you depart from the spec. See the last step from 18.5.2. > > "Then apply θ' to the type of m. If unchecked conversion was not necessary for the method to be applicable in 18.5.1, then this is the invocation type of m; if unchecked conversion was necessary, then this substitution provides the parameter types of the invocation type, while the return type and thrown types are given by the erasure of m's type (without applying θ')." > > (This is a fairly recent tweak, as of 0.9.0 (December).) I should try to avoid the un-spec'd tweak and replace it with the spec change from 0.9.0.
bulk move out of 4.8
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.