/************************************************************************** * Copyright (c) 2003 by Acunia N.V. All rights reserved. * * * * This software is copyrighted by and is the sole property of Acunia N.V. * * and its licensors, if any. All rights, title, ownership, or other * * interests in the software remain the property of Acunia N.V. and its * * licensors, if any. * * * * This software may only be used in accordance with the corresponding * * license agreement. Any unauthorized use, duplication, transmission, * * distribution or disclosure of this software is expressly forbidden. * * * * This Copyright notice may not be removed or modified without prior * * written consent of Acunia N.V. * * * * Acunia N.V. reserves the right to modify this software without notice. * * * * Acunia N.V. * * Philips site 5, box 3 info@acunia.com * * 3001 Leuven http://www.acunia.com * * Belgium - EUROPE * **************************************************************************/ /* ** $Id: MAInheritanceTest.java,v 1.1 2004/12/06 13:29:20 cvs Exp $ ** ** The Wonka kernel is software copyright by Acunia. ** Please see the file Copyright for information on it's legal use. ABSTRACT: Tests contributed by Mark Anderson to check the correct functioning of bytecode generated by later Java compilers (e.g. javac of JDK 1.4 in normal mode). These compilers do not generate so-called 'Miranda' methods when a class inherits abstract classes from an abstract superclass or an interface. ** // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. */ package gnu.testlet.wonka.vm; import gnu.testlet.Testlet; import gnu.testlet.TestHarness; public class MAInheritanceTest extends AbstractTestAbstract implements Testlet { protected static TestHarness harness; private static String fish; private void testStatic() { harness.checkPoint("Inherit static members from abstract classes"); try { fish = "eel pout"; fish = StaticTestChild.getFish(); harness.check(fish.equals("coelacanth"), "No exception should be thrown."); } catch (Throwable t) { harness.fail("Call to to StaticTestChild.getFish() threw "+t); } } private void testAbstract() { harness.checkPoint("Inherit abstract method from abstract superclass"); AbstractTestAbstract a = new MAInheritanceTest(); try { String s = a.getBush(); harness.check(s.equals("rhododendron"), "Should call implementation in subclass"); } catch (Throwable t) { harness.fail("Call to getBush() threw "+t); } } private void testInterface() { harness.checkPoint("Inherit abstract method from superinterface"); AbstractTestSubInterface a = (AbstractTestSubInterface) new AbstractTestConcrete(); try { String s = a.getTree(); harness.check(s.equals("baobab"), "Should call implementation in subclass"); } catch (Throwable t) { harness.fail("Call to getBush() threw "+t); } } public MAInheritanceTest() { } public String getBush() { return "rhododendron"; } public void test (TestHarness newharness) { harness = newharness; harness.setclass("wonka.vm"); testStatic(); testAbstract(); testInterface(); } }