Skip to content

Commit e2785e3

Browse files
Format source
1 parent 5ecf1be commit e2785e3

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*******************************************************************************
2-
* Copyright (c) 2025 IBM Corporation and others.
3-
*
4-
* This program and the accompanying materials are made available under the
5-
* terms of the Eclipse Public License v. 2.0 which is available at
6-
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
7-
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
8-
*
9-
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
13-
*******************************************************************************/
2+
* Copyright (c) 2025 IBM Corporation and others.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0 which is available at
6+
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
7+
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
8+
*
9+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
1414
package io.openliberty.tools.intellij.lsp4jakarta.lsp4ij;
1515

1616
import java.util.regex.Matcher;
@@ -31,7 +31,7 @@ public class JsonPropertyUtils {
3131
* @return String
3232
* @description Method decodes unicode property name value to string value
3333
*/
34-
public static String decodeUniCodeName(String propertyName) {
34+
public static String decodeUnicodeName(String propertyName) {
3535
Pattern pattern = Pattern.compile(JsonbConstants.JSONB_PROPERTYNAME_UNICODE); // Pattern for detecting unicode sequence
3636
Matcher matcher = pattern.matcher(propertyName);
3737
StringBuffer decoded = new StringBuffer();
@@ -51,10 +51,10 @@ public static String decodeUniCodeName(String propertyName) {
5151
*/
5252
public static String extractPropertyNameFromJsonField(PsiAnnotation annotation) {
5353
PsiAnnotationMemberValue psiValue = annotation.findAttributeValue("value");
54-
String value = psiValue !=null ? psiValue.getText(): null;
54+
String value = psiValue != null ? psiValue.getText() : null;
5555
// Remove wrapping quotes if it's a string literal
56-
if (value!=null && value.startsWith("\"") && value.endsWith("\"")) {
57-
value = value.substring(1, value.length() - 1);
56+
if (value != null && value.startsWith("\"") && value.endsWith("\"")) {
57+
value = value.substring(1, value.length() - 1);
5858
}
5959
return value;
6060
}

src/main/java/io/openliberty/tools/intellij/lsp4jakarta/lsp4ij/jsonb/JsonbDiagnosticsCollector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private void collectJsonbUniquePropertyNames(Set<String> uniquePropertyNames, Ps
9696
if (isMatchedAnnotation(annotation, JsonbConstants.JSONB_PROPERTY)) { // Checks whether annotation is JsonbProperty
9797
String propertyName = JsonPropertyUtils.extractPropertyNameFromJsonField(annotation);
9898
if (propertyName != null) {
99-
uniquePropertyNames.add(JsonPropertyUtils.decodeUniCodeName(propertyName));
99+
uniquePropertyNames.add(JsonPropertyUtils.decodeUnicodeName(propertyName));
100100
}
101101
}
102102
}
@@ -156,7 +156,7 @@ private Map<String, List<PsiField>> buildPropertyMap(Set<String> uniquePropertyN
156156
if (isMatchedAnnotation(annotation, JsonbConstants.JSONB_PROPERTY)) {
157157
String propertyName = JsonPropertyUtils.extractPropertyNameFromJsonField(annotation);
158158
if (propertyName != null) {
159-
propertyName = JsonPropertyUtils.decodeUniCodeName(propertyName);
159+
propertyName = JsonPropertyUtils.decodeUnicodeName(propertyName);
160160
if (uniquePropertyNames.contains(propertyName)) {
161161
// Checks if the propertyName exists, if not, creates a new key for the property with List<IField> as value.
162162
// If it exists, add the field into the list.

src/test/resources/projects/maven/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnosticSubClass.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
import jakarta.json.bind.annotation.JsonbProperty;
44

5-
public class JsonbTransientDiagnosticSubClass extends JsonbTransientDiagnostic{
6-
5+
public class JsonbTransientDiagnosticSubClass extends JsonbTransientDiagnostic {
6+
77

88
@JsonbProperty("hello")
99
private String subFirstName;
10-
10+
1111
@JsonbProperty("fav_lang")
1212
private String subfavoriteEditor; // Diagnostic: @JsonbProperty property uniqueness in subclass, multiple properties cannot have same property names.
13-
13+
1414
@JsonbProperty("fav_lang1")
1515
private String subfavoriteEditor1;
16-
16+
1717
@JsonbProperty("just_in_sub_class")
1818
private String justInSubClass1; // Diagnostic: @JsonbProperty property uniqueness in subclass, multiple properties cannot have same property names.
19-
19+
2020
@JsonbProperty("just_in_sub_class")
2121
private String justInSubClass2; // Diagnostic: @JsonbProperty property uniqueness in subclass, multiple properties cannot have same property names.
2222

src/test/resources/projects/maven/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnosticSubSubClass.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import jakarta.json.bind.annotation.JsonbProperty;
44

5-
public class JsonbTransientDiagnosticSubSubClass extends JsonbTransientDiagnosticSubClass{
6-
5+
public class JsonbTransientDiagnosticSubSubClass extends JsonbTransientDiagnosticSubClass {
6+
77

88
@JsonbProperty("name")
99
private String subFirstName; // Diagnostic: @JsonbProperty property uniqueness in subclass, multiple properties cannot have same property names.
10-
10+
1111
@JsonbProperty("fav_editor")
1212
private String subfavoriteEditor; // Diagnostic: @JsonbProperty property uniqueness in subclass, multiple properties cannot have same property names.
13-
13+
1414
@JsonbProperty("fav_lang1")
1515
private String subfavoriteEditor2; // Diagnostic: @JsonbProperty property uniqueness in subclass, multiple properties cannot have same property names.
1616

0 commit comments

Comments
 (0)