MixTest.java revision 2942:08092deced3f
1218887Sdim/* 2218887Sdim * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 3353358Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4353358Sdim * 5353358Sdim * This code is free software; you can redistribute it and/or modify it 6218887Sdim * under the terms of the GNU General Public License version 2 only, as 7218887Sdim * published by the Free Software Foundation. 8218887Sdim * 9309124Sdim * This code is distributed in the hope that it will be useful, but WITHOUT 10218887Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11218887Sdim * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12218887Sdim * version 2 for more details (a copy is included in the LICENSE file that 13218887Sdim * accompanied this code). 14280031Sdim * 15280031Sdim * You should have received a copy of the GNU General Public License version 16218887Sdim * 2 along with this work; if not, write to the Free Software Foundation, 17249423Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18218887Sdim * 19218887Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20218887Sdim * or visit www.oracle.com if you need additional information or have any 21218887Sdim * questions. 22218887Sdim */ 23218887Sdim 24218887Sdim/* 25218887Sdim * @test 26218887Sdim * @summary sourcefile attribute test for complex structure of nested classes and other types. 27218887Sdim * @bug 8040129 28218887Sdim * @library /tools/lib /tools/javac/lib ../lib 29218887Sdim * @modules jdk.jdeps/com.sun.tools.classfile 30218887Sdim * jdk.compiler/com.sun.tools.javac.api 31218887Sdim * jdk.compiler/com.sun.tools.javac.file 32218887Sdim * jdk.compiler/com.sun.tools.javac.main 33218887Sdim * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager 34218887Sdim * @run main MixTest 35218887Sdim */ 36218887Sdim 37218887Sdimpublic class MixTest extends SourceFileTestBase { 38218887Sdim public static void main(String[] args) throws Exception { 39341825Sdim new InnerClass(); 40218887Sdim Runnable r = new Runnable() { 41314564Sdim @Override 42360784Sdim public void run() { 43261991Sdim Runnable run = () -> { 44218887Sdim class Local { 45360784Sdim } 46218887Sdim }; 47360784Sdim } 48360784Sdim 49218887Sdim class innerInAnonymous { 50218887Sdim } 51360784Sdim }; 52218887Sdim 53218887Sdim new MixTest().run(); 54218887Sdim } 55218887Sdim 56218887Sdim public void run() throws Exception { 57218887Sdim String fileName = getClass().getName() + ".java"; 58218887Sdim test("MixTest", fileName); 59218887Sdim test("MixTest$1", fileName); 60218887Sdim test("MixTest$InnerClass", fileName); 61218887Sdim test("MixTest$1$innerInAnonymous", fileName); 62218887Sdim test("MixTest$1$1Local", fileName); 63218887Sdim test("MixTest$InnerClass$innerEnum", fileName); 64261991Sdim test("MixTest$InnerClass$innerInterface", fileName); 65218887Sdim test("MixTest$InnerClass$innerEnum$innerClassInnerEnum", fileName); 66218887Sdim test("MixTest$InnerClass$innerEnum$innerClassInnerEnum$1InnerLocal", fileName); 67218887Sdim } 68218887Sdim 69218887Sdim static class InnerClass { 70261991Sdim private InnerClass() { 71261991Sdim } 72218887Sdim 73218887Sdim enum innerEnum { 74218887Sdim E; 75218887Sdim 76218887Sdim class innerClassInnerEnum { 77218887Sdim void method() { 78218887Sdim class InnerLocal { 79218887Sdim } 80261991Sdim } 81341825Sdim } 82218887Sdim } 83341825Sdim 84224145Sdim @interface innerInterface { 85224145Sdim } 86224145Sdim } 87224145Sdim} 88224145Sdim