mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8148131: compilation result depends on order of sources
Complete during imports phase should not trigger the hierarchy phase Reviewed-by: mcimadamore
This commit is contained in:
parent
850b281ff0
commit
d3eaa80bdd
5 changed files with 145 additions and 1 deletions
|
@ -241,7 +241,14 @@ public class TypeEnter implements Completer {
|
||||||
public final List<Env<AttrContext>> completeEnvs(List<Env<AttrContext>> envs) {
|
public final List<Env<AttrContext>> completeEnvs(List<Env<AttrContext>> envs) {
|
||||||
boolean firstToComplete = queue.isEmpty();
|
boolean firstToComplete = queue.isEmpty();
|
||||||
|
|
||||||
|
Phase prevTopLevelPhase = topLevelPhase;
|
||||||
|
|
||||||
|
try {
|
||||||
|
topLevelPhase = this;
|
||||||
doCompleteEnvs(envs);
|
doCompleteEnvs(envs);
|
||||||
|
} finally {
|
||||||
|
topLevelPhase = prevTopLevelPhase;
|
||||||
|
}
|
||||||
|
|
||||||
if (firstToComplete) {
|
if (firstToComplete) {
|
||||||
List<Env<AttrContext>> out = queue.toList();
|
List<Env<AttrContext>> out = queue.toList();
|
||||||
|
@ -278,6 +285,7 @@ public class TypeEnter implements Completer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ImportsPhase completeClass = new ImportsPhase();
|
private final ImportsPhase completeClass = new ImportsPhase();
|
||||||
|
private Phase topLevelPhase;
|
||||||
|
|
||||||
/**Analyze import clauses.
|
/**Analyze import clauses.
|
||||||
*/
|
*/
|
||||||
|
@ -773,6 +781,15 @@ public class TypeEnter implements Completer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void complete(Symbol sym) throws CompletionFailure {
|
public void complete(Symbol sym) throws CompletionFailure {
|
||||||
|
Assert.check((topLevelPhase instanceof ImportsPhase) ||
|
||||||
|
(topLevelPhase == this));
|
||||||
|
|
||||||
|
if (topLevelPhase != this) {
|
||||||
|
//only do the processing based on dependencies in the HierarchyPhase:
|
||||||
|
sym.completer = this;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
Env<AttrContext> env = typeEnvs.get((ClassSymbol) sym);
|
Env<AttrContext> env = typeEnvs.get((ClassSymbol) sym);
|
||||||
|
|
||||||
super.doCompleteEnvs(List.of(env));
|
super.doCompleteEnvs(List.of(env));
|
||||||
|
|
45
langtools/test/tools/javac/importscope/T8148131/A.java
Normal file
45
langtools/test/tools/javac/importscope/T8148131/A.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* @bug 8148131
|
||||||
|
* @summary Ensuring order of inputs does not affect compilability of the sources
|
||||||
|
* @compile A.java B.java C.java D.java
|
||||||
|
* @compile A.java B.java D.java C.java
|
||||||
|
* @compile A.java C.java B.java D.java
|
||||||
|
* @compile A.java C.java D.java B.java
|
||||||
|
* @compile A.java D.java B.java C.java
|
||||||
|
* @compile A.java D.java C.java B.java
|
||||||
|
* @compile D.java A.java B.java C.java
|
||||||
|
* @compile D.java A.java C.java B.java
|
||||||
|
* @compile D.java B.java A.java C.java
|
||||||
|
* @compile D.java B.java C.java A.java
|
||||||
|
* @compile D.java C.java B.java A.java
|
||||||
|
* @compile D.java C.java A.java B.java
|
||||||
|
*/
|
||||||
|
package pkg;
|
||||||
|
|
||||||
|
import pkg.B.BInner;
|
||||||
|
|
||||||
|
class A implements BInner {}
|
28
langtools/test/tools/javac/importscope/T8148131/B.java
Normal file
28
langtools/test/tools/javac/importscope/T8148131/B.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pkg;
|
||||||
|
|
||||||
|
class B implements C.DInner {
|
||||||
|
interface BInner {}
|
||||||
|
}
|
26
langtools/test/tools/javac/importscope/T8148131/C.java
Normal file
26
langtools/test/tools/javac/importscope/T8148131/C.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pkg;
|
||||||
|
|
||||||
|
class C extends D {}
|
28
langtools/test/tools/javac/importscope/T8148131/D.java
Normal file
28
langtools/test/tools/javac/importscope/T8148131/D.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pkg;
|
||||||
|
|
||||||
|
class D {
|
||||||
|
interface DInner {}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue