I do not really understand why do you need to use Annotations for such a task? You will end up with some weird methods that your framework would not be able to parse, or will parse it the wrong way - bringing you to making up a set of rules how to properly write that methods so your framework could understand them.
I think it is much better solution to use interfaces instead. Create your own interface called StudentList or something, with methods like getIterator, getIndex, etc. and make students implement this interface. Then you will be able to load any of that classes and use it based on the interface they implement.
Also, you could just reuse avialable interfaces like List or Collection, however, this could make students write a lot of unused code to implement that interfaces. So I would rather go with writing my own interface.
Example of such interface would be:
interface StudentList<T> {
public Iterator<T> getIterator();
public T get(int index);
public void add(T element);
public void remove(T element);
}
Students would implement it like this (this example just wraps around ArrayList):
class MyList<T> implements StudentList<T> {
private ArrayList<T> realList;
public MyList() {
realList = new ArrayList<T>();
}
public void add(T element) {
realList.add(element);
}
.......
}
And you would test it like this:
void testList(StudentList<String> list) {
list.add(5);
list.add(10);
list.get(20);
}
testList(new MyList<String>());
Everything is clear both for students and for you this way.