8024609: sjavac assertion fails during call to BuildState.collectArtifacts
Reviewed-by: jjg
This commit is contained in:
parent
1c9e7a8edc
commit
5db62ec900
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2013, 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
|
||||
@ -81,12 +81,13 @@ public class BuildState {
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect all packages, sources and artifacts for all modules
|
||||
* into the build state.
|
||||
* Store references to all packages, sources and artifacts for all modules
|
||||
* into the build state. I.e. flatten the module tree structure
|
||||
* into global maps stored in the BuildState for easy access.
|
||||
*
|
||||
* @param m The set of modules.
|
||||
*/
|
||||
public void collectPackagesSourcesAndArtifacts(Map<String,Module> m) {
|
||||
public void flattenPackagesSourcesAndArtifacts(Map<String,Module> m) {
|
||||
modules = m;
|
||||
// Extract all the found packages.
|
||||
for (Module i : modules.values()) {
|
||||
@ -121,11 +122,12 @@ public class BuildState {
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect all the artifacts of all modules and packages.
|
||||
* Store references to all artifacts found in the module tree into the maps
|
||||
* stored in the build state.
|
||||
*
|
||||
* @param m The set of modules.
|
||||
*/
|
||||
public void collectArtifacts(Map<String,Module> m) {
|
||||
public void flattenArtifacts(Map<String,Module> m) {
|
||||
modules = m;
|
||||
// Extract all the found packages.
|
||||
for (Module i : modules.values()) {
|
||||
@ -270,6 +272,8 @@ public class BuildState {
|
||||
Module mnew = findModuleFromPackageName(pkg);
|
||||
Package pprev = prev.packages().get(pkg);
|
||||
mnew.addPackage(pprev);
|
||||
// Do not forget to update the flattened data.
|
||||
packages.put(pkg, pprev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public class Main {
|
||||
// findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
|
||||
|
||||
// Add the set of sources to the build database.
|
||||
javac_state.now().collectPackagesSourcesAndArtifacts(modules);
|
||||
javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
|
||||
javac_state.now().checkInternalState("checking sources", false, sources);
|
||||
javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
|
||||
javac_state.setVisibleSources(sources_to_link_to);
|
||||
@ -311,7 +311,7 @@ public class Main {
|
||||
Map<String,Source> generated_sources = new HashMap<String,Source>();
|
||||
Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null,
|
||||
generated_sources, modules, current_module, false, true, false);
|
||||
javac_state.now().collectPackagesSourcesAndArtifacts(modules);
|
||||
javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
|
||||
// Recheck the the source files and their timestamps again.
|
||||
javac_state.checkSourceStatus(true);
|
||||
|
||||
@ -336,8 +336,8 @@ public class Main {
|
||||
// Only update the state if the compile went well.
|
||||
if (rc[0]) {
|
||||
javac_state.save();
|
||||
// Collect all the artifacts.
|
||||
javac_state.now().collectArtifacts(modules);
|
||||
// Reflatten only the artifacts.
|
||||
javac_state.now().flattenArtifacts(modules);
|
||||
// Remove artifacts that were generated during the last compile, but not this one.
|
||||
javac_state.removeSuperfluousArtifacts(recently_compiled);
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ public class JavacServer {
|
||||
PrintStream err) {
|
||||
int rc = -3;
|
||||
try {
|
||||
int port = portFile.getPort();
|
||||
int port = portFile.containsPortInfo() ? portFile.getPort() : 0;
|
||||
if (port == 0) {
|
||||
return ERROR_BUT_TRY_AGAIN;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user