test/langtools/tools/javac/lambda/8210495/T8210495.java
author mcimadamore
Fri, 07 Sep 2018 15:56:21 +0100
changeset 51670 2dddc9394b49
child 52377 907fdbbdf584
permissions -rw-r--r--
8210495: compiler crashes because of illegal signature in otherwise legal code Summary: Disable strict verification of compiler signatures when they do not affect generated bytecode Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51670
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     1
/*
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     4
 *
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    10
 *
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    15
 * accompanied this code).
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    16
 *
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    20
 *
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    23
 * questions.
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    24
 */
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    25
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    26
/*
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    27
 * @test
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    28
 * @bug 8210495
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    29
 * @summary compiler crashes because of illegal signature in otherwise legal code
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    30
 * @compile T8210495.java
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    31
 */
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    32
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    33
import java.awt.*;
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    34
import java.awt.event.ActionListener;
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    35
import java.util.List;
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    36
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    37
class T8210495 {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    38
    interface IFilter {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    39
        Component getComponent();
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    40
    }
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    41
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    42
    static class Filter implements IFilter {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    43
        @Override
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    44
        public Component getComponent() {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    45
            return null;
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    46
        }
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    47
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    48
    }
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    49
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    50
    public Component buildFilter(List<? extends Filter> l, Dialog dialog) {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    51
        Panel c = new Panel();
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    52
        l.stream()
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    53
                .map(f -> {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    54
                    Button btn = (Button)f.getComponent();
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    55
                    btn.addActionListener((java.io.Serializable & ActionListener)evt -> {
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    56
                        applyFilter(f);
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    57
                        dialog.setVisible(false);
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    58
                    });
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    59
                    return btn;
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    60
                })
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    61
                .forEach(c::add);
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    62
        return c;
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    63
    }
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    64
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    65
    private void applyFilter(IFilter f) { }
2dddc9394b49 8210495: compiler crashes because of illegal signature in otherwise legal code
mcimadamore
parents:
diff changeset
    66
}