Skip to content

Commit 4e3613c

Browse files
authored
Ensure jdtls script helper functions always return a string path (#3179)
- Certain helper functions wrongly returned paths under certain conditions Signed-off-by: Ahmed Yehia <[email protected]>
1 parent bb26c98 commit 4e3613c

File tree

1 file changed

+6
-6
lines changed
  • org.eclipse.jdt.ls.product/scripts

1 file changed

+6
-6
lines changed

org.eclipse.jdt.ls.product/scripts/jdtls.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ def get_java_executable(known_args):
2626
java_executable = 'java'
2727

2828
if 'JAVA_HOME' in os.environ:
29-
ext = '.exe' if platform.system() == 'Windows' else ''
29+
ext = '.exe' if platform.system() == 'Windows' else ''
3030
java_exec_to_test = Path(os.environ['JAVA_HOME']) / 'bin' / f'java{ext}'
3131
if java_exec_to_test.is_file():
32-
java_executable = java_exec_to_test.resolve()
32+
java_executable = str(java_exec_to_test.resolve())
3333

3434
if not known_args.validate_java_version:
3535
return java_executable
@@ -51,7 +51,7 @@ def find_equinox_launcher(jdtls_base_directory):
5151
plugins_dir = jdtls_base_directory / "plugins"
5252
launchers = plugins_dir.glob('org.eclipse.equinox.launcher_*.jar')
5353
for launcher in launchers:
54-
return plugins_dir / launcher
54+
return str(plugins_dir / launcher)
5555

5656
raise Exception("Cannot find equinox launcher")
5757

@@ -67,7 +67,7 @@ def get_shared_config_path(jdtls_base_path):
6767
else:
6868
raise Exception("Unknown platform {} detected".format(system))
6969

70-
return jdtls_base_path / config_dir
70+
return str(jdtls_base_path / config_dir)
7171

7272
def main(args):
7373
cwd_name = os.path.basename(os.getcwd())
@@ -82,7 +82,7 @@ def main(args):
8282
action="append",
8383
help="An additional JVM option (can be used multiple times. Note, use with equal sign. For example: --jvm-arg=-Dlog.level=ALL")
8484
parser.add_argument("-data", default=jdtls_data_path)
85-
85+
8686
known_args, args = parser.parse_known_args(args)
8787
java_executable = get_java_executable(known_args)
8888

@@ -95,7 +95,7 @@ def main(args):
9595
"-Dosgi.bundles.defaultStartLevel=4",
9696
"-Declipse.product=org.eclipse.jdt.ls.core.product",
9797
"-Dosgi.checkConfiguration=true",
98-
"-Dosgi.sharedConfiguration.area=" + str(shared_config_path),
98+
"-Dosgi.sharedConfiguration.area=" + shared_config_path,
9999
"-Dosgi.sharedConfiguration.area.readOnly=true",
100100
"-Dosgi.configuration.cascaded=true",
101101
"-Xms1G",

0 commit comments

Comments
 (0)