8024609: sjavac assertion fails during call to BuildState.collectArtifacts

Thu, 19 Sep 2013 08:26:26 -0700

author
ohrstrom
date
Thu, 19 Sep 2013 08:26:26 -0700
changeset 2039
0cfd5baa7154
parent 2038
8d1c48de706d
child 2040
2375ce96e80d

8024609: sjavac assertion fails during call to BuildState.collectArtifacts
Reviewed-by: jjg

src/share/classes/com/sun/tools/sjavac/BuildState.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/sjavac/Main.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/sjavac/server/JavacServer.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/sjavac/BuildState.java	Thu Sep 19 17:05:08 2013 +0200
     1.2 +++ b/src/share/classes/com/sun/tools/sjavac/BuildState.java	Thu Sep 19 08:26:26 2013 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -81,12 +81,13 @@
    1.11      }
    1.12  
    1.13      /**
    1.14 -     * Collect all packages, sources and artifacts for all modules
    1.15 -     * into the build state.
    1.16 +     * Store references to all packages, sources and artifacts for all modules
    1.17 +     * into the build state. I.e. flatten the module tree structure
    1.18 +     * into global maps stored in the BuildState for easy access.
    1.19       *
    1.20       * @param m The set of modules.
    1.21       */
    1.22 -    public void collectPackagesSourcesAndArtifacts(Map<String,Module> m) {
    1.23 +    public void flattenPackagesSourcesAndArtifacts(Map<String,Module> m) {
    1.24          modules = m;
    1.25          // Extract all the found packages.
    1.26          for (Module i : modules.values()) {
    1.27 @@ -121,11 +122,12 @@
    1.28      }
    1.29  
    1.30      /**
    1.31 -     * Collect all the artifacts of all modules and packages.
    1.32 +     * Store references to all artifacts found in the module tree into the maps
    1.33 +     * stored in the build state.
    1.34       *
    1.35       * @param m The set of modules.
    1.36       */
    1.37 -    public void collectArtifacts(Map<String,Module> m) {
    1.38 +    public void flattenArtifacts(Map<String,Module> m) {
    1.39          modules = m;
    1.40          // Extract all the found packages.
    1.41          for (Module i : modules.values()) {
    1.42 @@ -270,6 +272,8 @@
    1.43              Module mnew = findModuleFromPackageName(pkg);
    1.44              Package pprev = prev.packages().get(pkg);
    1.45              mnew.addPackage(pprev);
    1.46 +            // Do not forget to update the flattened data.
    1.47 +            packages.put(pkg, pprev);
    1.48          }
    1.49      }
    1.50  }
     2.1 --- a/src/share/classes/com/sun/tools/sjavac/Main.java	Thu Sep 19 17:05:08 2013 +0200
     2.2 +++ b/src/share/classes/com/sun/tools/sjavac/Main.java	Thu Sep 19 08:26:26 2013 -0700
     2.3 @@ -274,7 +274,7 @@
     2.4  //          findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
     2.5  
     2.6              // Add the set of sources to the build database.
     2.7 -            javac_state.now().collectPackagesSourcesAndArtifacts(modules);
     2.8 +            javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
     2.9              javac_state.now().checkInternalState("checking sources", false, sources);
    2.10              javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
    2.11              javac_state.setVisibleSources(sources_to_link_to);
    2.12 @@ -311,7 +311,7 @@
    2.13              Map<String,Source> generated_sources = new HashMap<String,Source>();
    2.14              Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null,
    2.15                     generated_sources, modules, current_module, false, true, false);
    2.16 -            javac_state.now().collectPackagesSourcesAndArtifacts(modules);
    2.17 +            javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
    2.18              // Recheck the the source files and their timestamps again.
    2.19              javac_state.checkSourceStatus(true);
    2.20  
    2.21 @@ -336,8 +336,8 @@
    2.22              // Only update the state if the compile went well.
    2.23              if (rc[0]) {
    2.24                  javac_state.save();
    2.25 -                // Collect all the artifacts.
    2.26 -                javac_state.now().collectArtifacts(modules);
    2.27 +                // Reflatten only the artifacts.
    2.28 +                javac_state.now().flattenArtifacts(modules);
    2.29                  // Remove artifacts that were generated during the last compile, but not this one.
    2.30                  javac_state.removeSuperfluousArtifacts(recently_compiled);
    2.31              }
     3.1 --- a/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Thu Sep 19 17:05:08 2013 +0200
     3.2 +++ b/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Thu Sep 19 08:26:26 2013 -0700
     3.3 @@ -464,7 +464,7 @@
     3.4              PrintStream err) {
     3.5          int rc = -3;
     3.6          try {
     3.7 -            int port = portFile.getPort();
     3.8 +            int port = portFile.containsPortInfo() ? portFile.getPort() : 0;
     3.9              if (port == 0) {
    3.10                  return ERROR_BUT_TRY_AGAIN;
    3.11              }

mercurial