Skip to content

Commit 5347efc

Browse files
SajeerSajeer
authored andcommitted
Revert "JavaCursorContextKind IllegalArgumentException workaround deletion Liberty tools (#1365)"
This reverts commit f53dc01.
1 parent 51e25c7 commit 5347efc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/main/java/io/openliberty/tools/intellij/lsp4jakarta/lsp4ij/PropertiesManagerForJakarta.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2020, 2025 Red Hat, Inc.
2+
* Copyright (c) 2020, 2024 Red Hat, Inc.
33
* Distributed under license by Red Hat, Inc. All rights reserved.
44
* This program is made available under the terms of the
55
* Eclipse Public License v2.0 which accompanies this distribution,
@@ -122,9 +122,19 @@ private MicroProfileJavaCompletionParams adapt(JakartaJavaCompletionParams param
122122

123123
private JavaCursorContextResult adapt(org.eclipse.lsp4mp.commons.JavaCursorContextResult contextResult) {
124124
if (contextResult != null) {
125-
var kind = contextResult.getKind();
126-
if(kind != null)
127-
return new JavaCursorContextResult(JavaCursorContextKind.forValue(kind.getValue()), contextResult.getPrefix());
125+
return new JavaCursorContextResult(adapt(contextResult.getKind()), contextResult.getPrefix());
126+
}
127+
return null;
128+
}
129+
130+
private JavaCursorContextKind adapt(org.eclipse.lsp4mp.commons.JavaCursorContextKind kind) {
131+
if (kind != null) {
132+
// Workaround for an issue with JavaCursorContextKind.forValue().
133+
// See https://github.com/OpenLiberty/liberty-tools-intellij/issues/681 for details.
134+
if (kind == org.eclipse.lsp4mp.commons.JavaCursorContextKind.NONE) {
135+
return JavaCursorContextKind.NONE;
136+
}
137+
return JavaCursorContextKind.forValue(kind.getValue());
128138
}
129139
return null;
130140
}

0 commit comments

Comments
 (0)