And it also works like this

AttributeBinding<Object> binding = null;

I initially thought this might be an issue of erasure when using raw types,
because the erasure of A in <A> would be java.lang.Object,  but still
doesn't make sense to me because the return type of getMethod() in not a
parameterised type.


On Tue, Jul 1, 2008 at 7:52 PM, David Blevins <[EMAIL PROTECTED]>
wrote:

>
> On Jul 1, 2008, at 3:58 PM, David Blevins wrote:
>
>  But this seems to somehow change the List<Method> to plain List and
>> generates a compile error:
>>
>> public class Test {
>>
>>   public interface AttributeBinding<A> {
>>
>>       public A getAttribute();
>>
>>       public List<Method> getMethod();
>>
>>   }
>>
>>   public static void main(String[] args) throws Exception {
>>       AttributeBinding binding = null;
>>       for (Method method : binding.getMethod()) {
>>
>>       }
>>   }
>> }
>>
>
> Eventually got it to work like this, note the added "<?>":
>
>
>
> public class Test {
>
>   public interface AttributeBinding<A> {
>
>       public A getAttribute();
>
>       public List<Method> getMethod();
>
>   }
>
>   public static void main(String[] args) throws Exception {
>       AttributeBinding<?> binding = null;
>       for (Method method : binding.getMethod()) {
>
>       }
>   }
> }
>
>
>
>


-- 
Karan Singh Malhi

Reply via email to