src/share/classes/com/sun/tools/javac/file/Locations.java

changeset 1375
ea2616a6bd01
parent 1358
fc123bdeddb8
child 2413
fe033d997ddf
     1.1 --- a/src/share/classes/com/sun/tools/javac/file/Locations.java	Thu Oct 25 11:09:36 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/file/Locations.java	Thu Oct 25 13:33:27 2012 -0700
     1.3 @@ -420,14 +420,10 @@
     1.4              if (!options.contains(option))
     1.5                  return false;
     1.6              searchPath = value == null ? null :
     1.7 -                    Collections.unmodifiableCollection(computePath(value));
     1.8 +                    Collections.unmodifiableCollection(createPath().addFiles(value));
     1.9              return true;
    1.10          }
    1.11  
    1.12 -        protected Path computePath(String value) {
    1.13 -            return new Path().addFiles(value);
    1.14 -        }
    1.15 -
    1.16          @Override
    1.17          Collection<File> getLocation() {
    1.18              return searchPath;
    1.19 @@ -439,10 +435,18 @@
    1.20              if (files == null) {
    1.21                  p = computePath(null);
    1.22              } else {
    1.23 -                p = new Path().addFiles(files);
    1.24 +                p = createPath().addFiles(files);
    1.25              }
    1.26              searchPath = Collections.unmodifiableCollection(p);
    1.27          }
    1.28 +
    1.29 +        protected Path computePath(String value) {
    1.30 +            return createPath().addFiles(value);
    1.31 +        }
    1.32 +
    1.33 +        protected Path createPath() {
    1.34 +            return new Path();
    1.35 +        }
    1.36      }
    1.37  
    1.38      /**
    1.39 @@ -477,11 +481,15 @@
    1.40              // Default to current working directory.
    1.41              if (cp == null) cp = ".";
    1.42  
    1.43 +            return createPath().addFiles(cp);
    1.44 +        }
    1.45 +
    1.46 +        @Override
    1.47 +        protected Path createPath() {
    1.48              return new Path()
    1.49 -                .expandJarClassPaths(true)        // Only search user jars for Class-Paths
    1.50 -                .emptyPathDefault(new File("."))  // Empty path elt ==> current directory
    1.51 -                .addFiles(cp);
    1.52 -            }
    1.53 +                .expandJarClassPaths(true)         // Only search user jars for Class-Paths
    1.54 +                .emptyPathDefault(new File("."));  // Empty path elt ==> current directory
    1.55 +        }
    1.56  
    1.57          private void lazy() {
    1.58              if (searchPath == null)
    1.59 @@ -591,7 +599,6 @@
    1.60              String extdirsOpt = optionValues.get(EXTDIRS);
    1.61              String xbootclasspathPrependOpt = optionValues.get(XBOOTCLASSPATH_PREPEND);
    1.62              String xbootclasspathAppendOpt = optionValues.get(XBOOTCLASSPATH_APPEND);
    1.63 -
    1.64              path.addFiles(xbootclasspathPrependOpt);
    1.65  
    1.66              if (endorseddirsOpt != null)

mercurial