langtools/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java
changeset 16968 19f0da2d3143
child 26100 bb7dd001d190
equal deleted inserted replaced
16967:79d444669f3f 16968:19f0da2d3143
       
     1 /*
       
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 /*
       
    27  * @test
       
    28  * @bug 8010659
       
    29  * @summary Javac Crashes while building OpenJFX
       
    30  * @library /tools/javac/lib
       
    31  * @build ToolBox
       
    32  * @run main CompilerCrashWhenMixingBinariesAndSourcesTest
       
    33  */
       
    34 
       
    35 public class CompilerCrashWhenMixingBinariesAndSourcesTest {
       
    36     private static final String ASource =
       
    37             "class A {\n" +
       
    38             "        void test() {new B(){};}\n" +
       
    39             "}";
       
    40     private static final String BSource =
       
    41             "class B extends C {}";
       
    42     private static final String CSource =
       
    43             "class C extends D {\n" +
       
    44             "        String m(int i) {return null;}\n" +
       
    45             "}";
       
    46     private static final String DSource =
       
    47             "class D {\n" +
       
    48             "        Object m(int i) {return null;}\n" +
       
    49             "}";
       
    50 
       
    51     public static void main (String[] args) throws Exception{
       
    52         ToolBox.JavaToolArgs javacParams = new ToolBox.JavaToolArgs()
       
    53                 .setSources(ASource, BSource, CSource, DSource);
       
    54         ToolBox.javac(javacParams);
       
    55 
       
    56         ToolBox.rm("A.class");
       
    57         ToolBox.rm("A$1.class");
       
    58         ToolBox.rm("C.class");
       
    59         ToolBox.rm("D.class");
       
    60 
       
    61         javacParams = new ToolBox.JavaToolArgs()
       
    62                 .setOptions("-cp", ".")
       
    63                 .setSources(ASource, CSource, DSource);
       
    64         ToolBox.javac(javacParams);
       
    65     }
       
    66 }