[Checkers] Question about Polymorphism

Mahmood Ali mahmood at MIT.EDU
Mon Apr 28 23:07:58 EDT 2008


Hi,

::==This may affect the ISSTA paper==::

I was wondering how you are envisioning polymorphism with annotations.

1. Namely, how can one specifies when annotation I using the  
polymorphism?  Consider the following:

<T> @Poly T[] toArray(@Poly Collection<T> col) {
     if (col == null) return null;
     else return (@Poly T[]) col.toArray();
}

How can I specify that the return value has the same nullness but not  
necessary the same interning or mutability as 'col'?

2. Or is it that polymorphism functionality would be in the framework,  
but the annotation itself need to be specified by type system  
(@NullPoly, @InternedPoly, @ReadOnly, etc)?

3. Should poly simply get an argument, like @Poly({NonNull.class})?  I  
think that this is an ugly syntax.

- Mahmood



More information about the checkers mailing list