~ubuntu-branches/ubuntu/natty/aspectj/natty

« back to all changes in this revision

Viewing changes to org.aspectj/modules/tests/java5/generics/itds/StaticGenericMethodITD.aj

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-10-04 16:37:23 UTC
  • mfrom: (1.1.3 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091004163723-ck4y7j7fhjxskkie
Tags: 1.6.6+dfsg-1
* New upstream release.
  - Update 02_use_gjdoc.diff patch
* Update my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Static ITD of a generic method 
3
 
 */
4
 
import java.util.*;
5
 
 
6
 
class MathUtils { 
7
 
}
8
 
 
9
 
public class StaticGenericMethodITD {
10
 
  public static void main(String[] argv) {
11
 
    List<Integer> ints = new ArrayList<Integer>();
12
 
    ints.add(10); ints.add(20); ints.add(30);
13
 
    System.err.println("First="+MathUtils.first(ints));
14
 
    if (!MathUtils.first(ints).equals(10))
15
 
      throw new RuntimeException("First val!=10, it was "+
16
 
                                 MathUtils.first(ints));
17
 
  }
18
 
}
19
 
 
20
 
 
21
 
aspect X {
22
 
  static <E> E MathUtils.first(List<E> elements) { return elements.get(0); }
23
 
}