Index: src/test/regression/H3225/PerfTest.java =================================================================== --- src/test/regression/H3225/PerfTest.java (revision 532334) +++ src/test/regression/H3225/PerfTest.java (working copy) @@ -27,7 +27,7 @@ public class PerfTest extends TestCase { try { PerfTest test = new PerfTest(); test.readProperty(BOOT_CLASS_PATH_PROPERTY); -// test.readProperty(CLASS_PATH_PROPERTY); + // test.readProperty(CLASS_PATH_PROPERTY); test.load(); System.out.println("SUCCESS"); } catch (Throwable e) { @@ -49,19 +49,19 @@ public class PerfTest extends TestCase { private static final boolean LOG_CLASSES = true; /** - * Class name storage. - */ + * Class name storage. + */ private Set classNames = new TreeSet(); /** - * Reads all class names from the specified Jar. - */ + * Reads all class names from the specified Jar. + */ private int readJar(String fileName) throws IOException { JarFile jarFile = new JarFile(fileName); int num = 0; System.out.print("Reading " + fileName + ": "); - for (Enumeration e = jarFile.entries(); e.hasMoreElements(); ) { + for (Enumeration e = jarFile.entries(); e.hasMoreElements();) { JarEntry jarEntry = (JarEntry) e.nextElement(); if (jarEntry.isDirectory()) { @@ -72,8 +72,8 @@ public class PerfTest extends TestCase { if (!entryName.endsWith(CLASS_SUFFIX)) { continue; } - String className = entryName.substring(0, entryName.length() - - CLASS_SUFFIX_LENGTH).replace('/', '.'); + String className = entryName.substring(0, + entryName.length() - CLASS_SUFFIX_LENGTH).replace('/', '.'); Loader loader = new Loader(); Throwable result = loader.verifyClass(className); @@ -86,7 +86,7 @@ public class PerfTest extends TestCase { } else { if (LOG_CLASSES) { System.out.println("Skipped " + className + " due to " - + result); + + result); } } } @@ -95,8 +95,8 @@ public class PerfTest extends TestCase { } /** - * Reads all class names from all jars listed in the specified property. - */ + * Reads all class names from all jars listed in the specified property. + */ private void readProperty(String propertyName) throws IOException { System.out.println("Reading from property: " + propertyName); @@ -106,8 +106,8 @@ public class PerfTest extends TestCase { throw new IOException("Property not found: " + propertyName); } - StringTokenizer tokenizer = new StringTokenizer( - propertyValue, File.pathSeparator); + StringTokenizer tokenizer = new StringTokenizer(propertyValue, + File.pathSeparator); int num = 0; while (tokenizer.hasMoreTokens()) { @@ -125,25 +125,25 @@ public class PerfTest extends TestCase { } num += readJar(token); } - System.out.println("Got " + num + " classes from " - + propertyName); + System.out.println("Got " + num + " classes from " + propertyName); } - /** - * Tries to load all known classes. - */ + * Tries to load all known classes. + */ private void load() throws IOException { System.out.println("Loading classes"); long total = System.currentTimeMillis(); - for (Iterator i = classNames.iterator(); i.hasNext(); ) { + for (Iterator i = classNames.iterator(); i.hasNext();) { String className = i.next(); Loader loader = new Loader(); - assertNull("Failed to verify " + className, loader.verifyClass(className)); + assertNull("Failed to verify " + className, loader + .verifyClass(className)); } - System.out.println("Total time: " + (System.currentTimeMillis() - total)); + System.out.println("Total time: " + + (System.currentTimeMillis() - total)); } final static int LENGTH = 1024; @@ -153,26 +153,26 @@ public class PerfTest extends TestCase { static byte[] buffer = new byte[LENGTH]; /** - * Tries to load a class. - */ + * Tries to load a class. + */ class Loader extends ClassLoader { public Throwable verifyClass(String name) { - try { - final String path = name.replace('.', '/') + ".class"; - java.io.InputStream is = ClassLoader.getSystemResourceAsStream(path); - if (is == null) { - return new IOException("Cannot find " + path); - } - int offset = 0, bytes_read = 0; - while ((bytes_read = is.read(buffer, offset, LENGTH - offset)) > 0) - { + try { + final String path = name.replace('.', '/') + ".class"; + java.io.InputStream is = ClassLoader + .getSystemResourceAsStream(path); + if (is == null) { + return new IOException("Cannot find " + path); + } + int offset = 0, bytes_read = 0; + while ((bytes_read = is.read(buffer, offset, LENGTH - offset)) > 0) { offset += bytes_read; } - if (bytes_read != -1) { - return new IOException("Class " + name - + " is too big, please increase LENGTH = " + LENGTH); - } + if (bytes_read != -1) { + return new IOException("Class " + name + + " is too big, please increase LENGTH = " + LENGTH); + } defineClass(name, buffer, 0, offset).getConstructors(); return null; @@ -182,4 +182,3 @@ public class PerfTest extends TestCase { } } } - Index: src/test/regression/H3720/AbstractMethodTest.java =================================================================== --- src/test/regression/H3720/AbstractMethodTest.java (revision 0) +++ src/test/regression/H3720/AbstractMethodTest.java (revision 0) @@ -0,0 +1,67 @@ +package org.apache.harmony.drlvm.tests.regression.h3720; + +import junit.framework.TestCase; + +/** + * Call an abstract interface method. + */ +public class AbstractMethodTest extends TestCase { + + public static void main(String args[]) { + junit.textui.TestRunner.run(AbstractMethodTest.class); + } + + public void testAbstractMethod() { + try { + Object o = new AbstractImpl(); + ((Intf) o).m(); + } catch (AbstractMethodError aoe) { + return; + } + fail("Calling m() of EmptyImpl should cause AbstractMethodError"); + } + + public void testArrayElement() { + Intf o[] = { new Impl() }; + ((Abstract) o[0]).m(); + } + + public void testSecondLevel() { + Abstract o = new SecondLevelImpl(); + ((Intf) o).m(); + } + + public void testEmpty() { + Empty o = new EmptyImpl(); + o.m(); + } +} + +interface Intf { + public void m(); +} + +abstract class Abstract implements Intf { + abstract public void m(); +} + +class Impl extends Abstract { + public void m() { + } +} + +abstract class AbstractChild extends Abstract { +} + +class SecondLevelImpl extends AbstractChild { + public void m() { + } +} + +abstract class Empty implements Intf { +} + +class EmptyImpl extends Empty { + public void m() { + } +} Index: src/test/regression/H3720/EmptyImpl.j =================================================================== --- src/test/regression/H3720/EmptyImpl.j (revision 0) +++ src/test/regression/H3720/EmptyImpl.j (revision 0) @@ -0,0 +1,9 @@ +.class public org/apache/harmony/drlvm/tests/regression/h3720/EmptyImpl +.super org/apache/harmony/drlvm/tests/regression/h3720/Abstract +.method public ()V + aload_0 + invokespecial org/apache/harmony/drlvm/tests/regression/h3720/Abstract/()V + return +.end method + +