< prev index next >

test/langtools/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java

Print this page
rev 50604 : imported patch jep181-rev1

*** 1,7 **** /* ! * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 28,45 **** * @library /tools/lib /tools/javac/lib ../lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.classfile * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase ! * @run main SyntheticClassTest */ public class SyntheticClassTest extends SourceFileTestBase { public static void main(String[] args) throws Exception { new Inner(); new SyntheticClassTest().test("SyntheticClassTest$1", "SyntheticClassTest.java"); } static class Inner { private Inner() { } --- 28,61 ---- * @library /tools/lib /tools/javac/lib ../lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.classfile * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase ! * @compile -source 10 -target 10 SyntheticClassTest.java ! * @run main SyntheticClassTest true ! * @clean SyntheticClassTest$1 ! * @compile SyntheticClassTest.java ! * @run main SyntheticClassTest false */ + import java.nio.file.NoSuchFileException; + public class SyntheticClassTest extends SourceFileTestBase { public static void main(String[] args) throws Exception { + boolean expectSynthetic = Boolean.parseBoolean(args[0]); new Inner(); + try { new SyntheticClassTest().test("SyntheticClassTest$1", "SyntheticClassTest.java"); + if (!expectSynthetic) { + throw new AssertionError("Synthetic class should not have been emitted!"); + } + } catch (NoSuchFileException ex) { + if (expectSynthetic) { + throw new AssertionError("Synthetic class should have been emitted!"); + } + } } static class Inner { private Inner() { }
< prev index next >