OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [ArrayStore.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
public class ArrayStore
2
{
3
  public static void main(String[] args)
4
  {
5
    ArrayStore s = new ArrayStore();
6
 
7
    /* Check that bounds check takes precedence over array store check. */
8
    try
9
    {
10
      s.a(new String[1]);
11
    }
12
    catch (Exception x)
13
    {
14
      System.out.println (x.getClass().getName());
15
    }
16
 
17
    try
18
    {
19
      s.a(new String[2]);
20
    }
21
    catch (Exception x)
22
    {
23
      System.out.println (x.getClass().getName());
24
    }
25
 
26
    /* Check that += operator on String[] element works and throws bounds
27
       exception. */
28
    try
29
    {
30
      s.b(new String[1]);
31
    }
32
    catch (Exception x)
33
    {
34
      System.out.println (x.getClass().getName());
35
    }
36
 
37
    String[] sb = new String[2];
38
    sb[1] = "foo";
39
    s.b(sb);
40
    System.out.println (sb[1]);
41
  }
42
 
43
  void a(Object[] oa)
44
  {
45
    oa[1] = new Integer(2);
46
  }
47
 
48
  void b(String[] sa)
49
  {
50
    sa[1] += "bar";
51
  }
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.