Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  Neg07.java   Sprache: JAVA

 
/*
 * @test  /nodynamiccopyright/
 * @bug 7039822
 * @summary Verify typing of lub of exception parameter w.r.t getClass
 * @author Joseph D. Darcy
 * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java
 */


public class Neg07 {
    private static void test(int i) {
        try {
            thrower(i);
        } catch (SonException | DaughterException e) {
            Class<? extends HasFoo> clazz2 = e.getClass(); // Rejected!
            HasFoo m = e;
            e.foo();
        }
    }

    private static interface HasFoo {
        void foo();
    }

    static void thrower(int i) throws SonException, DaughterException {
        if (i == 0)
            throw new SonException();
        else
            throw new DaughterException();
    }

    private static class ParentException extends RuntimeException {}

    private static class SonException
        extends ParentException
        implements HasFoo {

        public void foo() {
            System.out.println("SonException.foo");
        }
    }

    private static class DaughterException
        extends ParentException
        implements HasFoo {

        public void foo() {
            System.out.println("DaughterException.foo");
        }
    }
}

Messung V0.5
C=87 H=91 G=88

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge