Path: blob/master/test/langtools/tools/sjavac/IncCompileFullyQualifiedRef.java
41144 views
/*1* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @summary Verify that "alfa.omega.A a" does create a proper dependency26* @bug 805468927* @author Fredrik O28* @author sogoel (rewrite)29* @library /tools/lib30* @modules jdk.compiler/com.sun.tools.javac.api31* jdk.compiler/com.sun.tools.javac.main32* jdk.compiler/com.sun.tools.sjavac33* @ignore Requires dependency code to deal with in-method dependencies.34* @build Wrapper toolbox.ToolBox35* @run main Wrapper IncCompileFullyQualifiedRef36*/3738import java.util.Map;3940import toolbox.ToolBox;4142public class IncCompileFullyQualifiedRef extends SJavacTester {43public static void main(String... args) throws Exception {44IncCompileFullyQualifiedRef fr = new IncCompileFullyQualifiedRef();45fr.test();46}4748void test() throws Exception {49clean(TEST_ROOT);50tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),51"package alfa.omega; public class A { "+52" public final static int DEFINITION = 18; "+53" public void hello() { }"+54"}");55tb.writeFile(GENSRC.resolve("beta/B.java"),56"package beta; public class B { "+57" public void world() { alfa.omega.A a; }"+58"}");5960compile(GENSRC.toString(),61"-d", BIN.toString(),62"--state-dir=" + BIN,63"-j", "1",64"--log=debug");65Map<String,Long> previous_bin_state = collectState(BIN);6667// Change pubapi of A, this should trigger a recompile of B.68tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),69"package alfa.omega; public class A { "+70" public final static int DEFINITION = 19; "+71" public void hello() { }"+72"}");7374compile(GENSRC.toString(),75"-d", BIN.toString(),76"--state-dir=" + BIN,77"-j", "1",78"--log=debug");79Map<String,Long> new_bin_state = collectState(BIN);8081verifyNewerFiles(previous_bin_state, new_bin_state,82BIN + "/alfa/omega/A.class",83BIN + "/beta/B.class",84BIN + "/javac_state");85clean(GENSRC,BIN);86}87}888990