Mercurial > hg > graal-compiler
changeset 15787:a5abeb0a3fb0
simplify getInterfaces jtt test
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 20 May 2014 15:16:04 +0200 |
parents | d54cca247d0b |
children | e84bdd23d22c |
files | graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java |
diffstat | 1 files changed, 8 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java Tue May 20 15:35:35 2014 +0200 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java Tue May 20 15:16:04 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,36 +30,8 @@ */ public final class Class_getInterfaces01 extends JTTTest { - public static String test(int i) { - switch (i) { - case 0: - return toString(I1.class); - case 1: - return toString(I2.class); - case 2: - return toString(C1.class); - case 3: - return toString(C2.class); - case 4: - return toString(C12.class); - default: - return null; - } - } - - private static String toString(Class<?> klass) { - final Class<?>[] classes = klass.getInterfaces(); - final StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Class<?> c : classes) { - if (!first) { - sb.append(' '); - } else { - first = false; - } - sb.append(c.getName()); - } - return sb.toString(); + public static Class<?>[] test(Class<?> clazz) { + return clazz.getInterfaces(); } interface I1 { @@ -84,27 +56,26 @@ @Test public void run0() throws Throwable { - runTest("test", 0); + runTest("test", I1.class); } @Test public void run1() throws Throwable { - runTest("test", 1); + runTest("test", I2.class); } @Test public void run2() throws Throwable { - runTest("test", 2); + runTest("test", C1.class); } @Test public void run3() throws Throwable { - runTest("test", 3); + runTest("test", C2.class); } @Test public void run4() throws Throwable { - runTest("test", 4); + runTest("test", C12.class); } - }