langtools/test/tools/javac/defaultMethods/Assertions.java
author vasya
Mon, 14 Dec 2015 20:18:19 +0100
changeset 34752 9c262a013456
parent 26392 2bda2002e2f2
permissions -rw-r--r--
8145342: Some copyright notices are inconsistently and ill formatted Summary: Adjusted formatting of copyright notices. Reviewed-by: darcy, alundblad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21005
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     1
/*
26272
4af552c8ad5c 8056283: @ignore tools/javac/defaultMethods/Assertions.java until JDK-8047675 is fixed
darcy
parents: 21005
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
21005
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     4
 *
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     8
 *
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    13
 * accompanied this code).
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    14
 *
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    18
 *
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    21
 * questions.
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    22
 */
34752
9c262a013456 8145342: Some copyright notices are inconsistently and ill formatted
vasya
parents: 26392
diff changeset
    23
21005
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    24
package test;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    25
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    26
import java.util.Arrays;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    27
import java.util.HashSet;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    28
import java.util.Set;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    29
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    30
public class Assertions {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    31
    interface Inner {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    32
        default void testInner() {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    33
            assert false;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    34
        }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    35
    }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    36
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    37
    static class InnerImpl implements Inner {}
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    38
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    39
    static class OuterImpl implements Outer {}
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    40
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    41
    static class AnotherInnerImpl implements Another.Inner {}
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    42
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    43
    public static void main(String... args) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    44
        Set<String> shouldThrowAssert = new HashSet<String>(Arrays.asList(args));
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    45
        try {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    46
            new InnerImpl().testInner();
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    47
            if (shouldThrowAssert.contains("Inner")) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    48
                throw new IllegalStateException("AssertionError expected, but not thrown.");
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    49
            }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    50
        } catch (AssertionError e) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    51
            if (!shouldThrowAssert.contains("Inner")) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    52
                throw new IllegalStateException("AssertionError not expected, but thrown.");
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    53
            }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    54
        }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    55
        try {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    56
            new OuterImpl().testOuter();
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    57
            if (shouldThrowAssert.contains("Outer")) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    58
                throw new IllegalStateException("AssertionError expected, but not thrown.");
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    59
            }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    60
        } catch (AssertionError e) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    61
            if (!shouldThrowAssert.contains("Outer")) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    62
                throw new IllegalStateException("AssertionError not expected, but thrown.");
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    63
            }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    64
        }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    65
        try {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    66
            new AnotherInnerImpl().testAnotherInner();
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    67
            if (shouldThrowAssert.contains("Another.Inner")) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    68
                throw new IllegalStateException("AssertionError expected, but not thrown.");
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    69
            }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    70
        } catch (AssertionError e) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    71
            if (!shouldThrowAssert.contains("Another.Inner")) {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    72
                throw new IllegalStateException("AssertionError not expected, but thrown.");
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    73
            }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    74
        }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    75
    }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    76
}
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    77
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    78
interface Outer {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    79
    default void testOuter() {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    80
        assert false;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    81
    }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    82
}
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    83
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    84
@interface Another {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    85
    interface Inner {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    86
        default void testAnotherInner() {
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    87
            assert false;
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    88
        }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    89
    }
4db633bd7696 8025141: java.lang.ClassFormatError: Illegal field modifiers in class (...)
jlahoda
parents:
diff changeset
    90
}