2014-12-24 19:17:51 +00:00
|
|
|
/*
|
2016-01-24 10:32:38 +00:00
|
|
|
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
2014-12-24 19:17:51 +00:00
|
|
|
* 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
|
2015-08-26 07:02:02 +00:00
|
|
|
* published by the Free Software Foundation.
|
2014-12-24 19:17:51 +00:00
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @test
|
|
|
|
* @summary Verify that "alfa.omega.A a" does create a proper dependency
|
|
|
|
* @bug 8054689
|
|
|
|
* @author Fredrik O
|
|
|
|
* @author sogoel (rewrite)
|
|
|
|
* @library /tools/lib
|
2015-05-21 18:41:04 +00:00
|
|
|
* @modules jdk.compiler/com.sun.tools.javac.api
|
|
|
|
* jdk.compiler/com.sun.tools.javac.main
|
|
|
|
* jdk.compiler/com.sun.tools.sjavac
|
2016-03-31 22:20:50 +00:00
|
|
|
* @ignore Requires dependency code to deal with in-method dependencies.
|
|
|
|
* @build Wrapper toolbox.ToolBox
|
2014-12-24 19:17:51 +00:00
|
|
|
* @run main Wrapper IncCompileFullyQualifiedRef
|
|
|
|
*/
|
|
|
|
|
2015-06-09 13:57:45 +00:00
|
|
|
import java.util.Map;
|
2014-12-24 19:17:51 +00:00
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
import toolbox.ToolBox;
|
|
|
|
|
2014-12-24 19:17:51 +00:00
|
|
|
public class IncCompileFullyQualifiedRef extends SJavacTester {
|
|
|
|
public static void main(String... args) throws Exception {
|
|
|
|
IncCompileFullyQualifiedRef fr = new IncCompileFullyQualifiedRef();
|
|
|
|
fr.test();
|
|
|
|
}
|
|
|
|
|
|
|
|
void test() throws Exception {
|
2015-06-09 13:57:45 +00:00
|
|
|
clean(TEST_ROOT);
|
2014-12-24 19:17:51 +00:00
|
|
|
tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
|
2015-06-09 13:57:45 +00:00
|
|
|
"package alfa.omega; public class A { "+
|
|
|
|
" public final static int DEFINITION = 18; "+
|
|
|
|
" public void hello() { }"+
|
|
|
|
"}");
|
2014-12-24 19:17:51 +00:00
|
|
|
tb.writeFile(GENSRC.resolve("beta/B.java"),
|
2015-06-09 13:57:45 +00:00
|
|
|
"package beta; public class B { "+
|
|
|
|
" public void world() { alfa.omega.A a; }"+
|
|
|
|
"}");
|
2014-12-24 19:17:51 +00:00
|
|
|
|
2015-06-09 13:57:45 +00:00
|
|
|
compile(GENSRC.toString(),
|
|
|
|
"-d", BIN.toString(),
|
2015-09-21 09:19:10 +00:00
|
|
|
"--state-dir=" + BIN,
|
2015-06-09 13:57:45 +00:00
|
|
|
"-j", "1",
|
|
|
|
"--log=debug");
|
2014-12-24 19:17:51 +00:00
|
|
|
Map<String,Long> previous_bin_state = collectState(BIN);
|
|
|
|
|
|
|
|
// Change pubapi of A, this should trigger a recompile of B.
|
|
|
|
tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),
|
2015-06-09 13:57:45 +00:00
|
|
|
"package alfa.omega; public class A { "+
|
|
|
|
" public final static int DEFINITION = 19; "+
|
|
|
|
" public void hello() { }"+
|
|
|
|
"}");
|
2014-12-24 19:17:51 +00:00
|
|
|
|
2015-06-09 13:57:45 +00:00
|
|
|
compile(GENSRC.toString(),
|
|
|
|
"-d", BIN.toString(),
|
2015-09-21 09:19:10 +00:00
|
|
|
"--state-dir=" + BIN,
|
2015-06-09 13:57:45 +00:00
|
|
|
"-j", "1",
|
|
|
|
"--log=debug");
|
2014-12-24 19:17:51 +00:00
|
|
|
Map<String,Long> new_bin_state = collectState(BIN);
|
|
|
|
|
|
|
|
verifyNewerFiles(previous_bin_state, new_bin_state,
|
2015-06-09 13:57:45 +00:00
|
|
|
BIN + "/alfa/omega/A.class",
|
|
|
|
BIN + "/beta/B.class",
|
|
|
|
BIN + "/javac_state");
|
2014-12-24 19:17:51 +00:00
|
|
|
clean(GENSRC,BIN);
|
|
|
|
}
|
|
|
|
}
|