Skip to content

Commit 3e898d8

Browse files
committed
Merge pull request #90 in G/mx from fix/more-jdk9-adjustments to master
* commit '0273dda510caabbe6dc55a2fc2d86401d463814e': bootclasspath is empty string on jdk >= 9 handle new 2 arg JVM options when partitioning command line args
2 parents 16c3de6 + 0273dda commit 3e898d8

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

mx.py

+27-15
Original file line numberDiff line numberDiff line change
@@ -6877,7 +6877,7 @@ def classpath(names=None, resolve=True, includeSelf=True, includeBootClasspath=F
68776877
"""
68786878
cpEntries = classpath_entries(names=names, includeSelf=includeSelf, preferProjects=preferProjects)
68796879
cp = []
6880-
if includeBootClasspath:
6880+
if includeBootClasspath and get_jdk().bootclasspath():
68816881
cp.append(get_jdk().bootclasspath())
68826882
if _opts.cp_prefix is not None:
68836883
cp.append(_opts.cp_prefix)
@@ -7020,6 +7020,8 @@ def extract_VM_args(args, useDoubleDash=False, allowClasspath=False, defaultAllV
70207020
abort('Cannot supply explicit class path option')
70217021
else:
70227022
continue
7023+
if i != 0 and (args[i - 1] in ['-mp', '-modulepath', '-limitmods', '-addmods', '-upgrademodulepath', '-m']):
7024+
continue
70237025
vmArgs = args[:i]
70247026
remainder = args[i:]
70257027
return vmArgs, remainder
@@ -8207,15 +8209,19 @@ def _checkOutput0(out):
82078209
def _init_classpaths(self):
82088210
if not self._classpaths_initialized:
82098211
_, binDir = _compile_mx_class('ClasspathDump', jdk=self)
8210-
self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', _cygpathU2W(binDir), 'ClasspathDump'], stderr=subprocess.PIPE).split('|')]
82118212
if self.javaCompliance <= JavaCompliance('1.8'):
8213+
self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', _cygpathU2W(binDir), 'ClasspathDump'], stderr=subprocess.PIPE).split('|')]
82128214
# All 3 system properties accessed by ClasspathDump are expected to exist
82138215
if not self._bootclasspath or not self._extdirs or not self._endorseddirs:
82148216
warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'")
8215-
self._bootclasspath_unfiltered = self._bootclasspath
8216-
self._bootclasspath = _filter_non_existant_paths(self._bootclasspath)
8217-
self._extdirs = _filter_non_existant_paths(self._extdirs)
8218-
self._endorseddirs = _filter_non_existant_paths(self._endorseddirs)
8217+
self._bootclasspath_unfiltered = self._bootclasspath
8218+
self._bootclasspath = _filter_non_existant_paths(self._bootclasspath)
8219+
self._extdirs = _filter_non_existant_paths(self._extdirs)
8220+
self._endorseddirs = _filter_non_existant_paths(self._endorseddirs)
8221+
else:
8222+
self._bootclasspath = ''
8223+
self._extdirs = None
8224+
self._endorseddirs = None
82198225
self._classpaths_initialized = True
82208226

82218227
def __repr__(self):
@@ -8242,7 +8248,7 @@ def __cmp__(self, other):
82428248

82438249
def processArgs(self, args, addDefaultArgs=True):
82448250
"""
8245-
Return a list composed of the arguments specified by the -P, -J and -A options (in that order)
8251+
Returns a list composed of the arguments specified by the -P, -J and -A options (in that order)
82468252
prepended to `args` if `addDefaultArgs` is true otherwise just return `args`.
82478253
"""
82488254
if addDefaultArgs:
@@ -8254,13 +8260,19 @@ def run_java(self, args, nonZeroIsFatal=True, out=None, err=None, cwd=None, time
82548260
return run(cmd, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout, env=env)
82558261

82568262
def bootclasspath(self, filtered=True):
8263+
"""
8264+
Gets the value of the ``sun.boot.class.path`` system property. This will be
8265+
the empty string if this JDK is version 9 or later.
8266+
8267+
:param bool filtered: specifies whether to exclude non-existant paths from the returned value
8268+
"""
82578269
self._init_classpaths()
82588270
return _separatedCygpathU2W(self._bootclasspath if filtered else self._bootclasspath_unfiltered)
82598271

8260-
"""
8261-
Add javadoc style options for the library paths of this JDK.
8262-
"""
82638272
def javadocLibOptions(self, args):
8273+
"""
8274+
Adds javadoc style options for the library paths of this JDK.
8275+
"""
82648276
self._init_classpaths()
82658277
if args is None:
82668278
args = []
@@ -8272,10 +8284,10 @@ def javadocLibOptions(self, args):
82728284
args.append(_separatedCygpathU2W(self._extdirs))
82738285
return args
82748286

8275-
"""
8276-
Add javac style options for the library paths of this JDK.
8277-
"""
82788287
def javacLibOptions(self, args):
8288+
"""
8289+
Adds javac style options for the library paths of this JDK.
8290+
"""
82798291
args = self.javadocLibOptions(args)
82808292
if self._endorseddirs:
82818293
args.append('-endorseddirs')
@@ -9908,7 +9920,7 @@ def make_eclipse_launch(suite, javaArgs, jre, name=None, deps=None):
99089920
mainClass = '-jar'
99099921
appArgs = list(reversed(argsCopy))
99109922
break
9911-
if a == '-cp' or a == '-classpath':
9923+
if a in ['-cp', '-classpath', '-mp', '-modulepath', '-limitmods', '-addmods', '-upgrademodulepath', '-m']:
99129924
assert len(argsCopy) != 0
99139925
cp = argsCopy.pop()
99149926
vmArgs.append(a)
@@ -13603,7 +13615,7 @@ def alarm_handler(signum, frame):
1360313615
# no need to show the stack trace when the user presses CTRL-C
1360413616
abort(1)
1360513617

13606-
version = VersionSpec("5.26.0")
13618+
version = VersionSpec("5.26.1")
1360713619

1360813620
currentUmask = None
1360913621

0 commit comments

Comments
 (0)