From 1012e62bcc7a2a0a07f9d093e60a86261c4d3883 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Wed, 21 Jun 2023 17:50:27 -0400 Subject: [PATCH 01/27] Add headers to certain test files. Signed-off-by: Paul Gooderham --- .../lsp4jakarta/jdt/cdi/ManagedBeanTest.java | 13 +++++++++++++ .../lsp4jakarta/jdt/di/DependencyInjectionTest.java | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/cdi/ManagedBeanTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/cdi/ManagedBeanTest.java index ed98ba36..05c01807 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/cdi/ManagedBeanTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/cdi/ManagedBeanTest.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 IBM Corporation and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + package org.eclipse.lsp4jakarta.jdt.cdi; import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaCodeAction; diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/di/DependencyInjectionTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/di/DependencyInjectionTest.java index 4a0326cc..e5e3e339 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/di/DependencyInjectionTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/di/DependencyInjectionTest.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 IBM Corporation and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + package org.eclipse.lsp4jakarta.jdt.di; import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaCodeAction; From d743a9f6e9b800919e5ef65dc78cb2106c03616d Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Wed, 21 Jun 2023 18:13:06 -0400 Subject: [PATCH 02/27] Update test case pom not to use a beta runtime. Signed-off-by: Paul Gooderham --- .../projects/jakarta-sample/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/pom.xml index 6680d74f..2ebb97b9 100755 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/pom.xml +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/pom.xml @@ -85,9 +85,9 @@ 3.3.4 - io.openliberty.beta + io.openliberty openliberty-jakartaee9 - 21.0.0.2-beta + 21.0.0.2 zip From 2480a1f2299c1b2e8023846aa6caaab5f9451d77 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Wed, 28 Jun 2023 16:27:36 +0530 Subject: [PATCH 03/27] #305 - Improving automated tests for diagnostics and quick-fixes Check if the package name is incorrect. --- .../jax_rs/FullyQualifiedNameDiagnostic.java | 11 ++++++ .../jdt/core/JakartaForJavaAssert.java | 30 ++++++++++---- .../FullyQualifiedNameDiagnosticTest.java | 39 +++++++++++++++++++ 3 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java new file mode 100644 index 00000000..0ad5c290 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java @@ -0,0 +1,11 @@ +package io.openliberty.sample.jakarta.jax_rs; + +import fake.ws.rs.DELETE; +import jakarta.ws.rs.FormParam; + +public class FullyQualifiedNameDiagnostic { + @DELETE + public void resourceMethodWithTwoEntityParams(String entityParam1, @FormParam(value = "") String nonEntityParam, int entityParam2) { + + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java index 42dca4fa..7a609faf 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java @@ -156,22 +156,32 @@ public static Range r(int startLine, int startCharacter, int endLine, int endCha public static Position p(int line, int character) { return new Position(line, character); } + + public static void assertJavaDiagnosticsPresent(JakartaDiagnosticsParams params, JDTUtils utils, Diagnostic... expected) + throws JavaModelException { + List actual = JDTServicesManager.getInstance().getJavaDiagnostics(params); + assertDiagnostics(true, + actual != null && actual.size() > 0 ? actual.get(0).getDiagnostics() : Collections.emptyList(), + expected); + } + public static void assertJavaDiagnostics(JakartaDiagnosticsParams params, JDTUtils utils, Diagnostic... expected) throws JavaModelException { List actual = JDTServicesManager.getInstance().getJavaDiagnostics(params); - assertDiagnostics( + assertDiagnostics(false, actual != null && actual.size() > 0 ? actual.get(0).getDiagnostics() : Collections.emptyList(), expected); } - public static void assertDiagnostics(List actual, Diagnostic... expected) { - assertDiagnostics(actual, Arrays.asList(expected), false); + public static void assertDiagnostics( boolean checkForDiagnostic, List actual, Diagnostic... expected) { + assertDiagnostics(actual, Arrays.asList(expected), false, checkForDiagnostic); } - public static void assertDiagnostics(List actual, List expected, boolean filter) { - /** + public static void assertDiagnostics(List actual, List expected, boolean filter, boolean isDiagnosticPresent) { + + /** * ordering of diagnostics should not matter when testing for equality, so we * sort diagnostics by their range. */ @@ -193,7 +203,7 @@ public static void assertDiagnostics(List actual, List e for (Diagnostic dia : actual) { dia.setMessage(replaceNewLineCharacters(dia.getMessage())); } - + List received = actual; final boolean filterMessage; if (expected != null && !expected.isEmpty() @@ -212,9 +222,13 @@ public static void assertDiagnostics(List actual, List e return simpler; }).collect(Collectors.toList()); } - Assert.assertEquals("Unexpected diagnostics:\n" + actual, expected, received); + if (isDiagnosticPresent) { + Assert.assertNotEquals("Unexpected diagnostics:\n" + actual, expected, received); + } else { + Assert.assertEquals("Unexpected diagnostics:\n" + actual, expected, received); + } } - + public static String fixURI(URI uri) { String uriString = uri.toString(); return uriString.replaceFirst("file:/([^/])", "file:///$1"); diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java new file mode 100644 index 00000000..597eda49 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java @@ -0,0 +1,39 @@ +package org.eclipse.lsp4jakarta.jdt.jax_rs; + +import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaDiagnosticsPresent; +import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.d; + +import java.util.Arrays; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.lsp4j.Diagnostic; +import org.eclipse.lsp4j.DiagnosticSeverity; +import org.eclipse.lsp4jakarta.commons.JakartaDiagnosticsParams; +import org.eclipse.lsp4jakarta.jdt.core.BaseJakartaTest; +import org.eclipse.lsp4jakarta.jdt.core.JDTUtils; +import org.junit.Test; + +public class FullyQualifiedNameDiagnosticTest extends BaseJakartaTest { + + protected static JDTUtils JDT_UTILS = new JDTUtils(); + + @Test + public void verifyDiagnosticForFullyQualifiedName() throws Exception { + JDTUtils utils = JDT_UTILS; + IJavaProject javaProject = loadJavaProject("jakarta-sample", ""); + IFile javaFile = javaProject.getProject() + .getFile(new Path("src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java")); + String uri = javaFile.getLocation().toFile().toURI().toString(); + + JakartaDiagnosticsParams diagnosticsParams = new JakartaDiagnosticsParams(); + diagnosticsParams.setUris(Arrays.asList(uri)); + + Diagnostic d = d(21, 13, 46, "Resource methods cannot have more than one entity parameter", + DiagnosticSeverity.Error, "jakarta-jax_rs", "FullyQualifiedNameDiagnosticTest"); + assertJavaDiagnosticsPresent(diagnosticsParams, utils, d); + + } + +} From ef41854091fd22d631190f020706e8b95e8b2910 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Wed, 28 Jun 2023 17:38:23 +0530 Subject: [PATCH 04/27] #305 - Improving automated tests for diagnostics and quick-fixes Change the line number and code --- .../jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java index 597eda49..b43f7041 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java @@ -30,8 +30,8 @@ public void verifyDiagnosticForFullyQualifiedName() throws Exception { JakartaDiagnosticsParams diagnosticsParams = new JakartaDiagnosticsParams(); diagnosticsParams.setUris(Arrays.asList(uri)); - Diagnostic d = d(21, 13, 46, "Resource methods cannot have more than one entity parameter", - DiagnosticSeverity.Error, "jakarta-jax_rs", "FullyQualifiedNameDiagnosticTest"); + Diagnostic d = d(8, 13, 46, "Resource methods cannot have more than one entity parameter", + DiagnosticSeverity.Error, "jakarta-jax_rs", "ResourceMethodMultipleEntityParams"); assertJavaDiagnosticsPresent(diagnosticsParams, utils, d); } From 8f08d27413b7ad7e7503b612b492ad8f21bcd508 Mon Sep 17 00:00:00 2001 From: Trevor Crawford Date: Wed, 28 Jun 2023 17:13:28 -0400 Subject: [PATCH 05/27] Update to 0.1.2-SNAPSHOT --- .../org.eclipse.lsp4jakarta.lsp4e.core/META-INF/MANIFEST.MF | 2 +- jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/pom.xml | 4 ++-- .../org.eclipse.lsp4jakarta.lsp4e.feature/feature.xml | 2 +- jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/pom.xml | 2 +- jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.site/pom.xml | 2 +- .../org.eclipse.lsp4jakarta.lsp4e.test/META-INF/MANIFEST.MF | 4 ++-- jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/pom.xml | 2 +- jakarta.eclipse/pom.xml | 2 +- .../org.eclipse.lsp4jakarta.jdt.core/META-INF/MANIFEST.MF | 2 +- jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/pom.xml | 2 +- jakarta.jdt/org.eclipse.lsp4jakarta.jdt.site/pom.xml | 2 +- .../org.eclipse.lsp4jakarta.jdt.test/META-INF/MANIFEST.MF | 2 +- jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/pom.xml | 2 +- jakarta.jdt/pom.xml | 2 +- jakarta.ls/pom.xml | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/META-INF/MANIFEST.MF b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/META-INF/MANIFEST.MF index fac1d379..55709ab4 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/META-INF/MANIFEST.MF +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Eclipse LSP4Jakarta Plugin (Incubation) Bundle-Vendor: Eclipse LSP4Jakarta Bundle-SymbolicName: org.eclipse.lsp4jakarta.lsp4e.core;singleton:=true -Bundle-Version: 0.1.1.qualifier +Bundle-Version: 0.1.2.qualifier Bundle-Activator: org.eclipse.lsp4jakarta.lsp4e.Activator Require-Bundle: org.eclipse.lsp4e, diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/pom.xml b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/pom.xml index e706c77f..0d7043c7 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/pom.xml +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.core/pom.xml @@ -7,7 +7,7 @@ org.eclipse.lsp4jakarta.lsp4e org.eclipse.lsp4jakarta - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.eclipse.lsp4jakarta.lsp4e.core eclipse-plugin @@ -46,7 +46,7 @@ org.eclipse.lsp4jakarta org.eclipse.lsp4jakarta.ls - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT jar-with-dependencies diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/feature.xml b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/feature.xml index 5c27c81f..714ad538 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/feature.xml +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/feature.xml @@ -2,7 +2,7 @@ + version="0.1.2.qualifier"> [Enter Feature Description here.] diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/pom.xml b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/pom.xml index 069a7572..02537ac7 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/pom.xml +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.feature/pom.xml @@ -4,7 +4,7 @@ org.eclipse.lsp4jakarta.lsp4e org.eclipse.lsp4jakarta - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.eclipse.lsp4jakarta.lsp4e.feature eclipse-feature diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.site/pom.xml b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.site/pom.xml index 0568dd76..80700ff8 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.site/pom.xml +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.site/pom.xml @@ -4,7 +4,7 @@ org.eclipse.lsp4jakarta.lsp4e org.eclipse.lsp4jakarta - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.eclipse.lsp4jakarta.lsp4e.site eclipse-repository diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/META-INF/MANIFEST.MF b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/META-INF/MANIFEST.MF index 5ec4ed3a..0d7428df 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/META-INF/MANIFEST.MF +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Name: Eclipse LSP4Jakarta Plugin Test Fragment (Incubation) Bundle-Vendor: Eclipse LSP4Jakarta Bundle-SymbolicName: org.eclipse.lsp4jakarta.lsp4e.test -Bundle-Version: 0.1.1.qualifier -Fragment-Host: org.eclipse.lsp4jakarta.lsp4e.core;bundle-version="0.1.1" +Bundle-Version: 0.1.2.qualifier +Fragment-Host: org.eclipse.lsp4jakarta.lsp4e.core;bundle-version="0.1.2" Bundle-RequiredExecutionEnvironment: JavaSE-17 Require-Bundle: org.eclipse.jdt.junit4.runtime;bundle-version="1.1.0", org.junit;bundle-version="4.11" diff --git a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/pom.xml b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/pom.xml index dd5cc4e6..368ebab9 100644 --- a/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/pom.xml +++ b/jakarta.eclipse/org.eclipse.lsp4jakarta.lsp4e.test/pom.xml @@ -3,7 +3,7 @@ org.eclipse.lsp4jakarta.lsp4e org.eclipse.lsp4jakarta - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT 4.0.0 org.eclipse.lsp4jakarta.lsp4e.test diff --git a/jakarta.eclipse/pom.xml b/jakarta.eclipse/pom.xml index f9002351..d67d349b 100644 --- a/jakarta.eclipse/pom.xml +++ b/jakarta.eclipse/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.eclipse.lsp4jakarta org.eclipse.lsp4jakarta.lsp4e - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT pom Eclipse LSP4Jakarta LSP4E Parent diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/META-INF/MANIFEST.MF b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/META-INF/MANIFEST.MF index efd96190..d83cd1a6 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/META-INF/MANIFEST.MF +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Eclipse LSP4Jakarta JDT Extension (Incubation) Bundle-Vendor: Eclipse LSP4Jakarta Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.lsp4jakarta.jdt.core;singleton:=true -Bundle-Version: 0.1.1.qualifier +Bundle-Version: 0.1.2.qualifier Bundle-Activator: org.eclipse.lsp4jakarta.jdt.core.JakartaCorePlugin Require-Bundle: org.eclipse.core.runtime, diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/pom.xml index fe8092a5..9e675264 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/pom.xml +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/pom.xml @@ -3,7 +3,7 @@ org.eclipse.lsp4jakarta jdt-parent - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.eclipse.lsp4jakarta.jdt.core eclipse-plugin diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.site/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.site/pom.xml index daa26089..bcbe9b06 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.site/pom.xml +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.site/pom.xml @@ -3,7 +3,7 @@ org.eclipse.lsp4jakarta jdt-parent - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.eclipse.lsp4jakarta.jdt.site eclipse-repository diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/META-INF/MANIFEST.MF b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/META-INF/MANIFEST.MF index 44aa5674..198c3711 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/META-INF/MANIFEST.MF +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Eclipse LSP4Jakarta JDT Test Plugin (Incubation) Bundle-Vendor: Eclipse LSP4Jakarta Bundle-SymbolicName: org.eclipse.lsp4jakarta.jdt.test -Bundle-Version: 0.1.1.qualifier +Bundle-Version: 0.1.2.qualifier Automatic-Module-Name: org.eclipse.lsp4jakarta.jdt.test Bundle-RequiredExecutionEnvironment: JavaSE-17 Require-Bundle: diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/pom.xml index e175d600..61d12f6c 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/pom.xml +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/pom.xml @@ -3,7 +3,7 @@ org.eclipse.lsp4jakarta jdt-parent - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT org.eclipse.lsp4jakarta.jdt.test eclipse-test-plugin diff --git a/jakarta.jdt/pom.xml b/jakarta.jdt/pom.xml index b1e44a69..e239a10b 100644 --- a/jakarta.jdt/pom.xml +++ b/jakarta.jdt/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.eclipse.lsp4jakarta jdt-parent - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT pom Eclipse LSP4Jakarta JDT Plugin Parent diff --git a/jakarta.ls/pom.xml b/jakarta.ls/pom.xml index f99de8c9..7fd7dbad 100644 --- a/jakarta.ls/pom.xml +++ b/jakarta.ls/pom.xml @@ -5,7 +5,7 @@ org.eclipse.lsp4jakarta org.eclipse.lsp4jakarta.ls - 0.1.1-SNAPSHOT + 0.1.2-SNAPSHOT Eclipse LSP4Jakarta Language Server Eclipse LSP4Jakarta Language Server From 523ebe112e03a911f8ea3355519cc82697a95374 Mon Sep 17 00:00:00 2001 From: Paul Gooderham Date: Wed, 28 Jun 2023 17:29:45 -0400 Subject: [PATCH 06/27] Change jdt.ls.p2 repository from latest to a specific number. Signed-off-by: Paul Gooderham --- jakarta.jdt/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.jdt/pom.xml b/jakarta.jdt/pom.xml index e239a10b..f757391f 100644 --- a/jakarta.jdt/pom.xml +++ b/jakarta.jdt/pom.xml @@ -50,7 +50,7 @@ jdt.ls.p2 p2 - https://download.eclipse.org/jdtls/snapshots/repository/latest/ + https://download.eclipse.org/jdtls/milestones/1.21.0/repository/ jdt.ls.maven.snapshots From 1fff6f35737aba26a9541e0195fb30ffd71b70e4 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Mon, 10 Jul 2023 10:55:22 +0530 Subject: [PATCH 07/27] Added new test case in Jakarta.ls --- .../JakartaBeanValidationSnippetTest.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java new file mode 100644 index 00000000..11ad42c3 --- /dev/null +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java @@ -0,0 +1,24 @@ +package org.eclipse.lsp4jakarta.ls.snippet; + +import static org.junit.Assert.assertTrue; + +import java.util.Optional; + +import org.eclipse.lsp4jakarta.commons.snippets.Snippet; +import org.eclipse.lsp4jakarta.commons.snippets.SnippetRegistry; +import org.junit.Test; + +public class JakartaBeanValidationSnippetTest { + + @Test + public void validFieldConstraints() throws Exception { + SnippetRegistry registry = new SnippetRegistry(); + + Optional restClassSnippet = findByPrefix("@Email", registry); + assertTrue("Tests has @Email Java snippet", restClassSnippet.isPresent()); + } + + private static Optional findByPrefix(String prefix, SnippetRegistry registry) { + return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); + } +} From eab31b86e009cf96940fe0bb2dcf84505cd8e90d Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Mon, 10 Jul 2023 12:16:38 +0530 Subject: [PATCH 08/27] Adding test case for Jakarta Snippets Registry test. Removed and added new java file for snippet registry test. --- .../JakartaBeanValidationSnippetTest.java | 24 --------- .../snippets/JakartaSnippetRegistryTest.java | 51 +++++++++++++++++++ 2 files changed, 51 insertions(+), 24 deletions(-) delete mode 100644 jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java create mode 100644 jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java deleted file mode 100644 index 11ad42c3..00000000 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/ls/snippet/JakartaBeanValidationSnippetTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.lsp4jakarta.ls.snippet; - -import static org.junit.Assert.assertTrue; - -import java.util.Optional; - -import org.eclipse.lsp4jakarta.commons.snippets.Snippet; -import org.eclipse.lsp4jakarta.commons.snippets.SnippetRegistry; -import org.junit.Test; - -public class JakartaBeanValidationSnippetTest { - - @Test - public void validFieldConstraints() throws Exception { - SnippetRegistry registry = new SnippetRegistry(); - - Optional restClassSnippet = findByPrefix("@Email", registry); - assertTrue("Tests has @Email Java snippet", restClassSnippet.isPresent()); - } - - private static Optional findByPrefix(String prefix, SnippetRegistry registry) { - return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); - } -} diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java new file mode 100644 index 00000000..26ce1b1e --- /dev/null +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -0,0 +1,51 @@ +package org.eclipse.lsp4jakarta.snippets; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Optional; + +import org.eclipse.lsp4jakarta.commons.snippets.Snippet; +import org.eclipse.lsp4jakarta.commons.snippets.SnippetRegistry; +import org.junit.Test; + +/** + * Test for JakartaEE snippet registry. + **/ + +public class JakartaSnippetRegistryTest { + + SnippetRegistry registry = new SnippetRegistry(); + + @Test + public void haveJavaSnippets() { + assertFalse("Tests has Jakarta Java snippets", registry.getSnippets().isEmpty()); + } + + /** + * Jakarta Bean Validation snippets - @Email + */ + @Test + public void beanValidationSnippetsTest() { + Optional beanValidationSnippet = findByPrefix("@Email", registry); + assertTrue("Tests has @Email Java snippet", beanValidationSnippet.isPresent()); + } + + /** + * Jakarta Persistence snippets. - persist_context, persist_context_extended, + * persist_context_extended_unsync, persist_entity. + */ + @Test + public void persistenceSnippetsTest() { + Optional persistenceSnippet = findByPrefix("persist_context", registry); + assertTrue("Tests has persist_context Java snippet", persistenceSnippet.isPresent()); + + + } + + + // Verify whether the snippet is present in the registry. + private static Optional findByPrefix(String prefix, SnippetRegistry registry) { + return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); + } +} From 76d0c218fa02834d114b73811bfef845f410fa8c Mon Sep 17 00:00:00 2001 From: VAISAKH T Date: Mon, 10 Jul 2023 13:24:19 +0530 Subject: [PATCH 09/27] Update JakartaSnippetRegistryTest.java --- .../snippets/JakartaSnippetRegistryTest.java | 83 ++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index 26ce1b1e..c359da87 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -37,11 +37,90 @@ public void beanValidationSnippetsTest() { */ @Test public void persistenceSnippetsTest() { - Optional persistenceSnippet = findByPrefix("persist_context", registry); - assertTrue("Tests has persist_context Java snippet", persistenceSnippet.isPresent()); + Optional persistcontextSnippet = findByPrefix("persist_context", registry); + assertTrue("Tests has persist_context Java snippet", persistcontextSnippet.isPresent()); + Optional persistcontextextendedSnippet = findByPrefix("persist_context_extended", registry); + assertTrue("Tests has persist_context_extended Java snippet", persistcontextextendedSnippet.isPresent()); + Optional persistcontextextendedunsyncSnippet = findByPrefix("persist_context_extended_unsync", registry); + assertTrue("Tests has persist_context_extended_unsync Java snippet", persistcontextextendedunsyncSnippet.isPresent()); + + Optional persistentitySnippet = findByPrefix("persist_entity", registry); + assertTrue("Tests has persist_entity Java snippet", persistentitySnippet.isPresent()); + + } + + + /** + * Jakarta RESTful Web Services snippets - rest_class, rest_get + * rest_post, rest_put, rest_delete, rest_head + */ + @Test + public void RESTfulWebServicesSnippetsTest() { + Optional restclassSnippet = findByPrefix("rest_class", registry); + assertTrue("Tests has rest_class Java snippet", restclassSnippet.isPresent()); + + + Optional restgetSnippet = findByPrefix("rest_get", registry); + assertTrue("Tests has rest_get Java snippet", restgetSnippet.isPresent()); + + Optional restpostSnippet = findByPrefix("rest_post", registry); + assertTrue("Tests has rest_post Java snippet", restpostSnippet.isPresent()); + + Optional restputSnippet = findByPrefix("rest_put", registry); + assertTrue("Tests has rest_put Java snippet", restputSnippet.isPresent()); + + Optional restdeleteSnippet = findByPrefix("rest_delete", registry); + assertTrue("Tests has rest_delete Java snippet", restdeleteSnippet.isPresent()); + + Optional restheadSnippet = findByPrefix("rest_head", registry); + assertTrue("Tests has rest_head Java snippet", restheadSnippet.isPresent()); + + } + + + + /** + * Jakarta Servlet snippets - servlet_generic, servlet_doget + * servlet_dopost, servlet_webfilter + */ + @Test + public void ServletSnippetsTest() { + Optional servletgenericSnippet = findByPrefix("servlet_generic", registry); + assertTrue("Tests has servlet_generic Java snippet", servletgenericSnippet.isPresent()); + + Optional servletdogetSnippet = findByPrefix("servlet_doget", registry); + assertTrue("Tests has servlet_doget Java snippet", servletdogetSnippet.isPresent()); + + Optional servletdopostSnippet = findByPrefix("servlet_dopost", registry); + assertTrue("Tests has servlet_dopost Java snippet", servletdopostSnippet.isPresent()); + + Optional servletwebfilterSnippet = findByPrefix("servlet_webfilter", registry); + assertTrue("Tests has servlet_webfilter Java snippet", servletwebfilterSnippet.isPresent()); } + + + /** + * Jakarta Transactions snippets - tx_user_inject, + * tx_user_jndi, @ Transactional + */ + @Test + public void TransactionsSnippetsTest() { + Optional txuserinjectSnippet = findByPrefix("tx_user_inject", registry); + assertTrue("Tests has tx_user_inject Java snippet", txuserinjectSnippet.isPresent()); + + Optional txuserjndiSnippet = findByPrefix("tx_user_jndi", registry); + assertTrue("Tests has tx_user_jndi Java snippet", txuserjndiSnippet.isPresent()); + + Optional TransactionalSnippet = findByPrefix("@Transactional", registry); + assertTrue("Tests has @Transactional Java snippet", TransactionalSnippet.isPresent()); + } + + + + + // Verify whether the snippet is present in the registry. From d3b5dcc71fa71a82c28dc1ef9bcc60f8a3bb516b Mon Sep 17 00:00:00 2001 From: VAISAKH T Date: Tue, 11 Jul 2023 16:15:35 +0530 Subject: [PATCH 10/27] Update JakartaSnippetRegistryTest.java --- .../snippets/JakartaSnippetRegistryTest.java | 101 ++++++++++++++---- 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index c359da87..6ea5bb0e 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -1,10 +1,17 @@ package org.eclipse.lsp4jakarta.snippets; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Optional; +import org.eclipse.lsp4jakarta.commons.JavaCursorContextKind; +import org.eclipse.lsp4jakarta.commons.JavaCursorContextResult; +import org.eclipse.lsp4jakarta.commons.ProjectLabelInfoEntry; +import org.eclipse.lsp4jakarta.commons.snippets.ISnippetContext; import org.eclipse.lsp4jakarta.commons.snippets.Snippet; import org.eclipse.lsp4jakarta.commons.snippets.SnippetRegistry; import org.junit.Test; @@ -16,6 +23,8 @@ public class JakartaSnippetRegistryTest { SnippetRegistry registry = new SnippetRegistry(); + + @Test public void haveJavaSnippets() { @@ -29,6 +38,12 @@ public void haveJavaSnippets() { public void beanValidationSnippetsTest() { Optional beanValidationSnippet = findByPrefix("@Email", registry); assertTrue("Tests has @Email Java snippet", beanValidationSnippet.isPresent()); + + ISnippetContext context = beanValidationSnippet.get().getContext(); + assertNotNull("@Email snippet has context", context); + assertTrue("@Email snippet context is Java context", context instanceof SnippetContextForJava); + + } /** @@ -49,6 +64,12 @@ public void persistenceSnippetsTest() { Optional persistentitySnippet = findByPrefix("persist_entity", registry); assertTrue("Tests has persist_entity Java snippet", persistentitySnippet.isPresent()); + + ISnippetContext context = persistcontextSnippet.get().getContext(); + assertNotNull("persist_context snippet has context", context); + assertTrue("persist_context snippet context is Java context", context instanceof SnippetContextForJava); + + } @@ -57,30 +78,38 @@ public void persistenceSnippetsTest() { * rest_post, rest_put, rest_delete, rest_head */ @Test - public void RESTfulWebServicesSnippetsTest() { - Optional restclassSnippet = findByPrefix("rest_class", registry); - assertTrue("Tests has rest_class Java snippet", restclassSnippet.isPresent()); - + public void restfulWebServicesSnippetsPrefixTest() { + Optional restClassSnippet = findByPrefix("rest_class", registry); + assertTrue("Tests has rest_class Java snippet", restClassSnippet.isPresent()); - Optional restgetSnippet = findByPrefix("rest_get", registry); - assertTrue("Tests has rest_get Java snippet", restgetSnippet.isPresent()); + Optional restGetSnippet = findByPrefix("rest_get", registry); + assertTrue("Tests has rest_get Java snippet", restGetSnippet.isPresent()); - Optional restpostSnippet = findByPrefix("rest_post", registry); - assertTrue("Tests has rest_post Java snippet", restpostSnippet.isPresent()); + Optional restPostSnippet = findByPrefix("rest_post", registry); + assertTrue("Tests has rest_post Java snippet", restPostSnippet.isPresent()); - Optional restputSnippet = findByPrefix("rest_put", registry); - assertTrue("Tests has rest_put Java snippet", restputSnippet.isPresent()); + Optional restPutSnippet = findByPrefix("rest_put", registry); + assertTrue("Tests has rest_put Java snippet", restPutSnippet.isPresent()); - Optional restdeleteSnippet = findByPrefix("rest_delete", registry); - assertTrue("Tests has rest_delete Java snippet", restdeleteSnippet.isPresent()); + Optional restDeleteSnippet = findByPrefix("rest_delete", registry); + assertTrue("Tests has rest_delete Java snippet", restDeleteSnippet.isPresent()); - Optional restheadSnippet = findByPrefix("rest_head", registry); - assertTrue("Tests has rest_head Java snippet", restheadSnippet.isPresent()); + Optional restHeadSnippet = findByPrefix("rest_head", registry); + assertTrue("Tests has rest_head Java snippet", restHeadSnippet.isPresent()); + snippetsContextTest(restClassSnippet, "jakarta.ws.rs.GET", JavaCursorContextKind.IN_EMPTY_FILE); + snippetsContextTest(restGetSnippet, "jakarta.ws.rs.GET", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(restPostSnippet, "jakarta.ws.rs.POST", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(restPutSnippet, "jakarta.ws.rs.PUT", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(restDeleteSnippet, "jakarta.ws.rs.DELETE", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(restHeadSnippet, "jakarta.ws.rs.HEAD", JavaCursorContextKind.BEFORE_METHOD); + } + + /** * Jakarta Servlet snippets - servlet_generic, servlet_doget * servlet_dopost, servlet_webfilter @@ -98,6 +127,12 @@ public void ServletSnippetsTest() { Optional servletwebfilterSnippet = findByPrefix("servlet_webfilter", registry); assertTrue("Tests has servlet_webfilter Java snippet", servletwebfilterSnippet.isPresent()); + + ISnippetContext context = servletgenericSnippet.get().getContext(); + assertNotNull("servlet_generic snippet has context", context); + assertTrue("servlet_generic snippet context is Java context", context instanceof SnippetContextForJava); + + } @@ -115,16 +150,44 @@ public void TransactionsSnippetsTest() { Optional TransactionalSnippet = findByPrefix("@Transactional", registry); assertTrue("Tests has @Transactional Java snippet", TransactionalSnippet.isPresent()); - } - + + + ISnippetContext context = txuserinjectSnippet.get().getContext(); + assertNotNull("tx_user_inject snippet has context", context); + assertTrue("tx_user_inject snippet context is Java context", context instanceof SnippetContextForJava); - - - + + } // Verify whether the snippet is present in the registry. private static Optional findByPrefix(String prefix, SnippetRegistry registry) { return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); } + + private void snippetsContextTest(Optional snippet, String contextType, JavaCursorContextKind javaCursorContextKind) { + + ISnippetContext context = snippet.get().getContext(); + assertNotNull(snippet.get().getPrefixes() + " snippet has context", context); + assertTrue(snippet.get().getPrefixes() + " snippet context is Java context", context instanceof SnippetContextForJava); + + ProjectLabelInfoEntry projectInfo = new ProjectLabelInfoEntry("", new ArrayList<>()); + boolean match = ((SnippetContextForJava) context).isMatch(context(projectInfo, javaCursorContextKind)); + assertFalse("Project has no javax.ws.rs.GET or jakarta.ws.rs.GET type", match); + + + ProjectLabelInfoEntry projectInfo1 = new ProjectLabelInfoEntry("", Arrays.asList(contextType)); + boolean match1 = ((SnippetContextForJava) context).isMatch(context(projectInfo1, javaCursorContextKind )); + assertTrue("Project has " + contextType + " type", match1); + + + } + + private static JavaSnippetCompletionContext context(ProjectLabelInfoEntry projectInfo, JavaCursorContextKind javaCursorContext) { + return context(projectInfo, javaCursorContext, ""); + } + + private static JavaSnippetCompletionContext context(ProjectLabelInfoEntry projectInfo, JavaCursorContextKind javaCursorContext, String prefix) { + return new JavaSnippetCompletionContext(projectInfo, new JavaCursorContextResult(javaCursorContext, prefix)); + } } From 78e6575ebdb57bf6291ebabdc16d9c5d1e6e9e83 Mon Sep 17 00:00:00 2001 From: VAISAKH T Date: Tue, 11 Jul 2023 18:35:47 +0530 Subject: [PATCH 11/27] Update JakartaSnippetRegistryTest.java --- .../snippets/JakartaSnippetRegistryTest.java | 79 ++++++++----------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index 6ea5bb0e..af16e4ae 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -23,8 +23,6 @@ public class JakartaSnippetRegistryTest { SnippetRegistry registry = new SnippetRegistry(); - - @Test public void haveJavaSnippets() { @@ -39,10 +37,7 @@ public void beanValidationSnippetsTest() { Optional beanValidationSnippet = findByPrefix("@Email", registry); assertTrue("Tests has @Email Java snippet", beanValidationSnippet.isPresent()); - ISnippetContext context = beanValidationSnippet.get().getContext(); - assertNotNull("@Email snippet has context", context); - assertTrue("@Email snippet context is Java context", context instanceof SnippetContextForJava); - + snippetsContextTest( beanValidationSnippet, "jakarta.validation.constraints.Email", JavaCursorContextKind.BEFORE_METHOD); } @@ -52,23 +47,22 @@ public void beanValidationSnippetsTest() { */ @Test public void persistenceSnippetsTest() { - Optional persistcontextSnippet = findByPrefix("persist_context", registry); - assertTrue("Tests has persist_context Java snippet", persistcontextSnippet.isPresent()); - - Optional persistcontextextendedSnippet = findByPrefix("persist_context_extended", registry); - assertTrue("Tests has persist_context_extended Java snippet", persistcontextextendedSnippet.isPresent()); - - Optional persistcontextextendedunsyncSnippet = findByPrefix("persist_context_extended_unsync", registry); - assertTrue("Tests has persist_context_extended_unsync Java snippet", persistcontextextendedunsyncSnippet.isPresent()); + Optional persistContextSnippet = findByPrefix("persist_context", registry); + assertTrue("Tests has persist_context Java snippet", persistContextSnippet.isPresent()); - Optional persistentitySnippet = findByPrefix("persist_entity", registry); - assertTrue("Tests has persist_entity Java snippet", persistentitySnippet.isPresent()); + Optional persistContextExtendedSnippet = findByPrefix("persist_context_extended", registry); + assertTrue("Tests has persist_context_extended Java snippet", persistContextExtendedSnippet.isPresent()); + Optional persistContextExtendedunsyncSnippet = findByPrefix("persist_context_extended_unsync", registry); + assertTrue("Tests has persist_context_extended_unsync Java snippet", persistContextExtendedunsyncSnippet.isPresent()); - ISnippetContext context = persistcontextSnippet.get().getContext(); - assertNotNull("persist_context snippet has context", context); - assertTrue("persist_context snippet context is Java context", context instanceof SnippetContextForJava); + Optional persistEntitySnippet = findByPrefix("persist_entity", registry); + assertTrue("Tests has persist_entity Java snippet", persistEntitySnippet.isPresent()); + snippetsContextTest(persistContextSnippet, "jakarta.persistence.PersistenceContextType", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(persistContextExtendedSnippet, "jakarta.persistence.PersistenceContextType", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(persistContextExtendedunsyncSnippet, "jakarta.persistence.PersistenceContextType", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(persistEntitySnippet, "jakarta.persistence.Entity", JavaCursorContextKind.IN_EMPTY_FILE); } @@ -106,32 +100,28 @@ public void restfulWebServicesSnippetsPrefixTest() { } - - - - /** * Jakarta Servlet snippets - servlet_generic, servlet_doget * servlet_dopost, servlet_webfilter */ @Test public void ServletSnippetsTest() { - Optional servletgenericSnippet = findByPrefix("servlet_generic", registry); - assertTrue("Tests has servlet_generic Java snippet", servletgenericSnippet.isPresent()); + Optional servletGenericSnippet = findByPrefix("servlet_generic", registry); + assertTrue("Tests has servlet_generic Java snippet", servletGenericSnippet.isPresent()); - Optional servletdogetSnippet = findByPrefix("servlet_doget", registry); - assertTrue("Tests has servlet_doget Java snippet", servletdogetSnippet.isPresent()); + Optional servletDoGetSnippet = findByPrefix("servlet_doget", registry); + assertTrue("Tests has servlet_doget Java snippet", servletDoGetSnippet.isPresent()); - Optional servletdopostSnippet = findByPrefix("servlet_dopost", registry); - assertTrue("Tests has servlet_dopost Java snippet", servletdopostSnippet.isPresent()); + Optional servletDoPostSnippet = findByPrefix("servlet_dopost", registry); + assertTrue("Tests has servlet_dopost Java snippet", servletDoPostSnippet.isPresent()); - Optional servletwebfilterSnippet = findByPrefix("servlet_webfilter", registry); - assertTrue("Tests has servlet_webfilter Java snippet", servletwebfilterSnippet.isPresent()); + Optional servletWebFilterSnippet = findByPrefix("servlet_webfilter", registry); + assertTrue("Tests has servlet_webfilter Java snippet", servletWebFilterSnippet.isPresent()); - ISnippetContext context = servletgenericSnippet.get().getContext(); - assertNotNull("servlet_generic snippet has context", context); - assertTrue("servlet_generic snippet context is Java context", context instanceof SnippetContextForJava); - + snippetsContextTest(servletGenericSnippet, "jakarta.servlet.GenericServlet", JavaCursorContextKind.IN_EMPTY_FILE); + snippetsContextTest(servletDoGetSnippet, "jakarta.servlet.http.HttpServlet", JavaCursorContextKind.IN_EMPTY_FILE); + snippetsContextTest(servletDoPostSnippet, "jakarta.servlet.http.HttpServlet", JavaCursorContextKind.IN_EMPTY_FILE); + snippetsContextTest(servletWebFilterSnippet, "jakarta.servlet.Filter", JavaCursorContextKind.IN_EMPTY_FILE); } @@ -142,19 +132,19 @@ public void ServletSnippetsTest() { */ @Test public void TransactionsSnippetsTest() { - Optional txuserinjectSnippet = findByPrefix("tx_user_inject", registry); - assertTrue("Tests has tx_user_inject Java snippet", txuserinjectSnippet.isPresent()); + Optional txUserInjectSnippet = findByPrefix("tx_user_inject", registry); + assertTrue("Tests has tx_user_inject Java snippet", txUserInjectSnippet.isPresent()); - Optional txuserjndiSnippet = findByPrefix("tx_user_jndi", registry); - assertTrue("Tests has tx_user_jndi Java snippet", txuserjndiSnippet.isPresent()); + Optional txUserJndiSnippet = findByPrefix("tx_user_jndi", registry); + assertTrue("Tests has tx_user_jndi Java snippet", txUserJndiSnippet.isPresent()); - Optional TransactionalSnippet = findByPrefix("@Transactional", registry); - assertTrue("Tests has @Transactional Java snippet", TransactionalSnippet.isPresent()); + Optional transactionalSnippet = findByPrefix("@Transactional", registry); + assertTrue("Tests has @Transactional Java snippet", transactionalSnippet.isPresent()); - ISnippetContext context = txuserinjectSnippet.get().getContext(); - assertNotNull("tx_user_inject snippet has context", context); - assertTrue("tx_user_inject snippet context is Java context", context instanceof SnippetContextForJava); + snippetsContextTest(txUserInjectSnippet, "jakarta.transaction.UserTransaction", JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(txUserJndiSnippet, "jakarta.transaction.UserTransaction", JavaCursorContextKind.BEFORE_METHOD); + //snippetsContextTest(transactionalSnippet, "jakarta.transaction.Transactional", JavaCursorContextKind.BEFORE_METHOD); } @@ -165,6 +155,7 @@ private static Optional findByPrefix(String prefix, SnippetRegistry reg return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); } + // Verifying the snippet context private void snippetsContextTest(Optional snippet, String contextType, JavaCursorContextKind javaCursorContextKind) { ISnippetContext context = snippet.get().getContext(); From 0c8e0e341f29e8576ad8d77c642ef014eb6673c3 Mon Sep 17 00:00:00 2001 From: VAISAKH T Date: Tue, 11 Jul 2023 20:09:58 +0530 Subject: [PATCH 12/27] Update JakartaSnippetRegistryTest.java --- .../lsp4jakarta/snippets/JakartaSnippetRegistryTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index af16e4ae..42d95844 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -144,6 +144,8 @@ public void TransactionsSnippetsTest() { snippetsContextTest(txUserInjectSnippet, "jakarta.transaction.UserTransaction", JavaCursorContextKind.BEFORE_METHOD); snippetsContextTest(txUserJndiSnippet, "jakarta.transaction.UserTransaction", JavaCursorContextKind.BEFORE_METHOD); + + // getPrefix() method in JavaCursorContextResult is returning empty string instead of prefix. so the below test case is failing. //snippetsContextTest(transactionalSnippet, "jakarta.transaction.Transactional", JavaCursorContextKind.BEFORE_METHOD); @@ -164,8 +166,7 @@ private void snippetsContextTest(Optional snippet, String contextType, ProjectLabelInfoEntry projectInfo = new ProjectLabelInfoEntry("", new ArrayList<>()); boolean match = ((SnippetContextForJava) context).isMatch(context(projectInfo, javaCursorContextKind)); - assertFalse("Project has no javax.ws.rs.GET or jakarta.ws.rs.GET type", match); - + assertFalse("Project has no " + contextType + " type", match); ProjectLabelInfoEntry projectInfo1 = new ProjectLabelInfoEntry("", Arrays.asList(contextType)); boolean match1 = ((SnippetContextForJava) context).isMatch(context(projectInfo1, javaCursorContextKind )); From e2a87def571e34c2696263428ac67fdb2640f814 Mon Sep 17 00:00:00 2001 From: VAISAKH T Date: Wed, 12 Jul 2023 16:10:03 +0530 Subject: [PATCH 13/27] Update JakartaSnippetRegistryTest.java --- .../snippets/JakartaSnippetRegistryTest.java | 203 ++++++++++-------- 1 file changed, 113 insertions(+), 90 deletions(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index 42d95844..8fe39fc6 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -1,3 +1,15 @@ +/******************************************************************************* +* Copyright (c) 2020 IBM Corporation and others. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* IBM Corporation - initial API and implementation +*******************************************************************************/ package org.eclipse.lsp4jakarta.snippets; import static org.junit.Assert.assertFalse; @@ -21,165 +33,176 @@ **/ public class JakartaSnippetRegistryTest { - + SnippetRegistry registry = new SnippetRegistry(); @Test public void haveJavaSnippets() { - assertFalse("Tests has Jakarta Java snippets", registry.getSnippets().isEmpty()); + assertFalse("Tests has no Jakarta Java snippets", registry.getSnippets().isEmpty()); } - + /** - * Jakarta Bean Validation snippets - @Email + * Jakarta Bean Validation snippets - @Email */ @Test public void beanValidationSnippetsTest() { - Optional beanValidationSnippet = findByPrefix("@Email", registry); - assertTrue("Tests has @Email Java snippet", beanValidationSnippet.isPresent()); - - snippetsContextTest( beanValidationSnippet, "jakarta.validation.constraints.Email", JavaCursorContextKind.BEFORE_METHOD); - + Optional beanValidationSnippet = findByPrefix("@Email", registry); + assertTrue("@Email Java snippet is not present in SnippetRegistry", beanValidationSnippet.isPresent()); + + snippetsContextTest(beanValidationSnippet, "jakarta.validation.constraints.Email", + JavaCursorContextKind.BEFORE_METHOD); + } /** * Jakarta Persistence snippets. - persist_context, persist_context_extended, - * persist_context_extended_unsync, persist_entity. + * persist_context_extended_unsync, persist_entity. */ @Test public void persistenceSnippetsTest() { - Optional persistContextSnippet = findByPrefix("persist_context", registry); - assertTrue("Tests has persist_context Java snippet", persistContextSnippet.isPresent()); - + Optional persistContextSnippet = findByPrefix("persist_context", registry); + assertTrue("persist_context Java snippet is not present in SnippetRegistry", persistContextSnippet.isPresent()); + Optional persistContextExtendedSnippet = findByPrefix("persist_context_extended", registry); - assertTrue("Tests has persist_context_extended Java snippet", persistContextExtendedSnippet.isPresent()); - - Optional persistContextExtendedunsyncSnippet = findByPrefix("persist_context_extended_unsync", registry); - assertTrue("Tests has persist_context_extended_unsync Java snippet", persistContextExtendedunsyncSnippet.isPresent()); - + assertTrue("persist_context_extended Java snippet is not present in SnippetRegistry", + persistContextExtendedSnippet.isPresent()); + + Optional persistContextExtendedunsyncSnippet = findByPrefix("persist_context_extended_unsync", + registry); + assertTrue("persist_context_extended_unsync Java snippet is not present in SnippetRegistry", + persistContextExtendedunsyncSnippet.isPresent()); + Optional persistEntitySnippet = findByPrefix("persist_entity", registry); - assertTrue("Tests has persist_entity Java snippet", persistEntitySnippet.isPresent()); - - snippetsContextTest(persistContextSnippet, "jakarta.persistence.PersistenceContextType", JavaCursorContextKind.BEFORE_METHOD); - snippetsContextTest(persistContextExtendedSnippet, "jakarta.persistence.PersistenceContextType", JavaCursorContextKind.BEFORE_METHOD); - snippetsContextTest(persistContextExtendedunsyncSnippet, "jakarta.persistence.PersistenceContextType", JavaCursorContextKind.BEFORE_METHOD); + assertTrue("persist_entity Java snippet is not present in SnippetRegistry", persistEntitySnippet.isPresent()); + + snippetsContextTest(persistContextSnippet, "jakarta.persistence.PersistenceContextType", + JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(persistContextExtendedSnippet, "jakarta.persistence.PersistenceContextType", + JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(persistContextExtendedunsyncSnippet, "jakarta.persistence.PersistenceContextType", + JavaCursorContextKind.BEFORE_METHOD); snippetsContextTest(persistEntitySnippet, "jakarta.persistence.Entity", JavaCursorContextKind.IN_EMPTY_FILE); - + } - - + /** * Jakarta RESTful Web Services snippets - rest_class, rest_get - * rest_post, rest_put, rest_delete, rest_head + * rest_post, rest_put, rest_delete, rest_head */ @Test public void restfulWebServicesSnippetsPrefixTest() { - Optional restClassSnippet = findByPrefix("rest_class", registry); - assertTrue("Tests has rest_class Java snippet", restClassSnippet.isPresent()); - + Optional restClassSnippet = findByPrefix("rest_class", registry); + assertTrue("rest_class Java snippet is not present in SnippetRegistry", restClassSnippet.isPresent()); + Optional restGetSnippet = findByPrefix("rest_get", registry); - assertTrue("Tests has rest_get Java snippet", restGetSnippet.isPresent()); - + assertTrue("rest_get Java snippet is not present in SnippetRegistry", restGetSnippet.isPresent()); + Optional restPostSnippet = findByPrefix("rest_post", registry); - assertTrue("Tests has rest_post Java snippet", restPostSnippet.isPresent()); - + assertTrue("rest_post Java snippet is not present in SnippetRegistry", restPostSnippet.isPresent()); + Optional restPutSnippet = findByPrefix("rest_put", registry); - assertTrue("Tests has rest_put Java snippet", restPutSnippet.isPresent()); - + assertTrue("rest_put Java snippet is not present in SnippetRegistry", restPutSnippet.isPresent()); + Optional restDeleteSnippet = findByPrefix("rest_delete", registry); - assertTrue("Tests has rest_delete Java snippet", restDeleteSnippet.isPresent()); - + assertTrue("rest_delete Java snippet is not present in SnippetRegistry", restDeleteSnippet.isPresent()); + Optional restHeadSnippet = findByPrefix("rest_head", registry); - assertTrue("Tests has rest_head Java snippet", restHeadSnippet.isPresent()); - + assertTrue("rest_head Java snippet is not present in SnippetRegistry", restHeadSnippet.isPresent()); + snippetsContextTest(restClassSnippet, "jakarta.ws.rs.GET", JavaCursorContextKind.IN_EMPTY_FILE); snippetsContextTest(restGetSnippet, "jakarta.ws.rs.GET", JavaCursorContextKind.BEFORE_METHOD); snippetsContextTest(restPostSnippet, "jakarta.ws.rs.POST", JavaCursorContextKind.BEFORE_METHOD); snippetsContextTest(restPutSnippet, "jakarta.ws.rs.PUT", JavaCursorContextKind.BEFORE_METHOD); snippetsContextTest(restDeleteSnippet, "jakarta.ws.rs.DELETE", JavaCursorContextKind.BEFORE_METHOD); snippetsContextTest(restHeadSnippet, "jakarta.ws.rs.HEAD", JavaCursorContextKind.BEFORE_METHOD); - + } - + /** * Jakarta Servlet snippets - servlet_generic, servlet_doget * servlet_dopost, servlet_webfilter */ @Test public void ServletSnippetsTest() { - Optional servletGenericSnippet = findByPrefix("servlet_generic", registry); - assertTrue("Tests has servlet_generic Java snippet", servletGenericSnippet.isPresent()); - + Optional servletGenericSnippet = findByPrefix("servlet_generic", registry); + assertTrue("servlet_generic Java snippet is not present in SnippetRegistry", servletGenericSnippet.isPresent()); + Optional servletDoGetSnippet = findByPrefix("servlet_doget", registry); - assertTrue("Tests has servlet_doget Java snippet", servletDoGetSnippet.isPresent()); - + assertTrue("servlet_doget Java snippet is not present in SnippetRegistry", servletDoGetSnippet.isPresent()); + Optional servletDoPostSnippet = findByPrefix("servlet_dopost", registry); - assertTrue("Tests has servlet_dopost Java snippet", servletDoPostSnippet.isPresent()); - + assertTrue("servlet_dopost Java snippet is not present in SnippetRegistry", servletDoPostSnippet.isPresent()); + Optional servletWebFilterSnippet = findByPrefix("servlet_webfilter", registry); - assertTrue("Tests has servlet_webfilter Java snippet", servletWebFilterSnippet.isPresent()); - - snippetsContextTest(servletGenericSnippet, "jakarta.servlet.GenericServlet", JavaCursorContextKind.IN_EMPTY_FILE); - snippetsContextTest(servletDoGetSnippet, "jakarta.servlet.http.HttpServlet", JavaCursorContextKind.IN_EMPTY_FILE); - snippetsContextTest(servletDoPostSnippet, "jakarta.servlet.http.HttpServlet", JavaCursorContextKind.IN_EMPTY_FILE); + assertTrue("servlet_webfilter Java snippet is not present in SnippetRegistry", + servletWebFilterSnippet.isPresent()); + + snippetsContextTest(servletGenericSnippet, "jakarta.servlet.GenericServlet", + JavaCursorContextKind.IN_EMPTY_FILE); + snippetsContextTest(servletDoGetSnippet, "jakarta.servlet.http.HttpServlet", + JavaCursorContextKind.IN_EMPTY_FILE); + snippetsContextTest(servletDoPostSnippet, "jakarta.servlet.http.HttpServlet", + JavaCursorContextKind.IN_EMPTY_FILE); snippetsContextTest(servletWebFilterSnippet, "jakarta.servlet.Filter", JavaCursorContextKind.IN_EMPTY_FILE); - + } - - + /** - * Jakarta Transactions snippets - tx_user_inject, + * Jakarta Transactions snippets - tx_user_inject, * tx_user_jndi, @ Transactional */ @Test public void TransactionsSnippetsTest() { - Optional txUserInjectSnippet = findByPrefix("tx_user_inject", registry); - assertTrue("Tests has tx_user_inject Java snippet", txUserInjectSnippet.isPresent()); - + Optional txUserInjectSnippet = findByPrefix("tx_user_inject", registry); + assertTrue("tx_user_inject Java snippet is not present in SnippetRegistry", txUserInjectSnippet.isPresent()); + Optional txUserJndiSnippet = findByPrefix("tx_user_jndi", registry); - assertTrue("Tests has tx_user_jndi Java snippet", txUserJndiSnippet.isPresent()); - + assertTrue("tx_user_jndi Java snippet is not present in SnippetRegistry", txUserJndiSnippet.isPresent()); + Optional transactionalSnippet = findByPrefix("@Transactional", registry); - assertTrue("Tests has @Transactional Java snippet", transactionalSnippet.isPresent()); - - - snippetsContextTest(txUserInjectSnippet, "jakarta.transaction.UserTransaction", JavaCursorContextKind.BEFORE_METHOD); - snippetsContextTest(txUserJndiSnippet, "jakarta.transaction.UserTransaction", JavaCursorContextKind.BEFORE_METHOD); - - // getPrefix() method in JavaCursorContextResult is returning empty string instead of prefix. so the below test case is failing. - //snippetsContextTest(transactionalSnippet, "jakarta.transaction.Transactional", JavaCursorContextKind.BEFORE_METHOD); - - + assertTrue("@Transactional Java snippet is not present in SnippetRegistry", transactionalSnippet.isPresent()); + + snippetsContextTest(txUserInjectSnippet, "jakarta.transaction.UserTransaction", + JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(txUserJndiSnippet, "jakarta.transaction.UserTransaction", + JavaCursorContextKind.BEFORE_METHOD); + snippetsContextTest(transactionalSnippet, "jakarta.transaction.Transactional", + JavaCursorContextKind.IN_METHOD_ANNOTATIONS); + } - // Verify whether the snippet is present in the registry. private static Optional findByPrefix(String prefix, SnippetRegistry registry) { return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); } - - // Verifying the snippet context - private void snippetsContextTest(Optional snippet, String contextType, JavaCursorContextKind javaCursorContextKind) { - + + // Verify whether the snippet context is present in the registry. + private void snippetsContextTest(Optional snippet, String contextType, + JavaCursorContextKind javaCursorContextKind) { + ISnippetContext context = snippet.get().getContext(); assertNotNull(snippet.get().getPrefixes() + " snippet has context", context); - assertTrue(snippet.get().getPrefixes() + " snippet context is Java context", context instanceof SnippetContextForJava); - + assertTrue(snippet.get().getPrefixes() + " snippet context is Java context", + context instanceof SnippetContextForJava); + ProjectLabelInfoEntry projectInfo = new ProjectLabelInfoEntry("", new ArrayList<>()); boolean match = ((SnippetContextForJava) context).isMatch(context(projectInfo, javaCursorContextKind)); - assertFalse("Project has no " + contextType + " type", match); - + assertFalse("Project has " + contextType + " type", match); + ProjectLabelInfoEntry projectInfo1 = new ProjectLabelInfoEntry("", Arrays.asList(contextType)); - boolean match1 = ((SnippetContextForJava) context).isMatch(context(projectInfo1, javaCursorContextKind )); - assertTrue("Project has " + contextType + " type", match1); - - + boolean match1 = ((SnippetContextForJava) context).isMatch(context(projectInfo1, javaCursorContextKind, + snippet.get().getPrefixes().isEmpty() ? "" : snippet.get().getPrefixes().get(0))); + assertTrue("Project has no " + contextType + " type", match1); + } - - private static JavaSnippetCompletionContext context(ProjectLabelInfoEntry projectInfo, JavaCursorContextKind javaCursorContext) { + + private static JavaSnippetCompletionContext context(ProjectLabelInfoEntry projectInfo, + JavaCursorContextKind javaCursorContext) { return context(projectInfo, javaCursorContext, ""); } - - private static JavaSnippetCompletionContext context(ProjectLabelInfoEntry projectInfo, JavaCursorContextKind javaCursorContext, String prefix) { + + private static JavaSnippetCompletionContext context(ProjectLabelInfoEntry projectInfo, + JavaCursorContextKind javaCursorContext, String prefix) { return new JavaSnippetCompletionContext(projectInfo, new JavaCursorContextResult(javaCursorContext, prefix)); } } From 375bbc01aaa00a236aaff2e7ccb4ce1a7f657d04 Mon Sep 17 00:00:00 2001 From: vaisakhkannan <133869023+vaisakhkannan@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:01:16 +0530 Subject: [PATCH 14/27] Update jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java Co-authored-by: Trevor Crawford --- .../lsp4jakarta/snippets/JakartaSnippetRegistryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index 8fe39fc6..b4fdd9f6 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -173,7 +173,7 @@ public void TransactionsSnippetsTest() { // Verify whether the snippet is present in the registry. private static Optional findByPrefix(String prefix, SnippetRegistry registry) { - return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); + return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().equals(prefix)).findFirst(); } // Verify whether the snippet context is present in the registry. From dd1a50bdcd11816711138c9cc43d5ff4ad414122 Mon Sep 17 00:00:00 2001 From: vaisakhkannan <133869023+vaisakhkannan@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:01:32 +0530 Subject: [PATCH 15/27] Update jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java Co-authored-by: Trevor Crawford --- .../lsp4jakarta/snippets/JakartaSnippetRegistryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index b4fdd9f6..d112f7da 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -181,7 +181,7 @@ private void snippetsContextTest(Optional snippet, String contextType, JavaCursorContextKind javaCursorContextKind) { ISnippetContext context = snippet.get().getContext(); - assertNotNull(snippet.get().getPrefixes() + " snippet has context", context); + assertNotNull(snippet.get().getPrefixes() + " snippet context is null", context); assertTrue(snippet.get().getPrefixes() + " snippet context is Java context", context instanceof SnippetContextForJava); From 2e86c8086707afc15f273572a9a414989dd436f0 Mon Sep 17 00:00:00 2001 From: vaisakhkannan <133869023+vaisakhkannan@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:06:57 +0530 Subject: [PATCH 16/27] Update jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java Co-authored-by: Trevor Crawford --- .../lsp4jakarta/snippets/JakartaSnippetRegistryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index d112f7da..4f9984d6 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -182,7 +182,7 @@ private void snippetsContextTest(Optional snippet, String contextType, ISnippetContext context = snippet.get().getContext(); assertNotNull(snippet.get().getPrefixes() + " snippet context is null", context); - assertTrue(snippet.get().getPrefixes() + " snippet context is Java context", + assertTrue(snippet.get().getPrefixes() + " snippet context is not a Java context", context instanceof SnippetContextForJava); ProjectLabelInfoEntry projectInfo = new ProjectLabelInfoEntry("", new ArrayList<>()); From 4af272da65600bd83ace351618d8bf872bb87190 Mon Sep 17 00:00:00 2001 From: vaisakhkannan <133869023+vaisakhkannan@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:08:19 +0530 Subject: [PATCH 17/27] Update jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java Co-authored-by: Trevor Crawford --- .../lsp4jakarta/snippets/JakartaSnippetRegistryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index 4f9984d6..04e8a5ed 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -187,7 +187,7 @@ private void snippetsContextTest(Optional snippet, String contextType, ProjectLabelInfoEntry projectInfo = new ProjectLabelInfoEntry("", new ArrayList<>()); boolean match = ((SnippetContextForJava) context).isMatch(context(projectInfo, javaCursorContextKind)); - assertFalse("Project has " + contextType + " type", match); + assertFalse("Project should not have " + contextType + " type", match); ProjectLabelInfoEntry projectInfo1 = new ProjectLabelInfoEntry("", Arrays.asList(contextType)); boolean match1 = ((SnippetContextForJava) context).isMatch(context(projectInfo1, javaCursorContextKind, From 0d4fbde9dba71a9a889800976c6cdcfe3c85146c Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Fri, 14 Jul 2023 18:57:11 +0530 Subject: [PATCH 18/27] Added Parameterized test for no diagnostics --- .../jakarta-noDiagnostic-sample/pom.xml | 114 +++++++++++++++++ .../annotations/GeneratedAnnotation.java | 31 +++++ .../annotations/PostConstructAnnotation.java | 32 +++++ .../annotations/PreDestroyAnnotation.java | 43 +++++++ .../annotations/ResourceAnnotation.java | 45 +++++++ .../FieldConstraintValidation.java | 65 ++++++++++ .../MethodConstraintValidation.java | 35 ++++++ .../beanvalidation/ValidConstraints.java | 95 ++++++++++++++ ...njectAndDisposesObservesObservesAsync.java | 55 ++++++++ .../sample/jakarta/cdi/ManagedBean.java | 13 ++ .../jakarta/cdi/ManagedBeanConstructor.java | 25 ++++ .../sample/jakarta/cdi/MultipleDisposes.java | 13 ++ ...ducesAndDisposesObservesObservesAsync.java | 58 +++++++++ .../cdi/ProducesAndInjectTogether.java | 20 +++ .../sample/jakarta/cdi/ScopeDeclaration.java | 19 +++ .../sample/jakarta/di/Greeting.java | 13 ++ .../di/MultipleConstructorWithInject.java | 37 ++++++ .../MultipleEntityParamsResourceMethod.java | 25 ++++ .../jax_rs/NoPublicConstructorClass.java | 16 +++ .../NoPublicConstructorProviderClass.java | 39 ++++++ .../jax_rs/NotPublicResourceMethod.java | 25 ++++ .../RootResourceClassConstructorsDiffLen.java | 16 +++ ...RootResourceClassConstructorsEqualLen.java | 15 +++ .../jsonb/ExtraJsonbCreatorAnnotations.java | 25 ++++ .../jsonb/JsonbTransientDiagnostic.java | 78 ++++++++++++ .../jsonp/CreatePointerInvalidTarget.java | 25 ++++ .../persistence/EntityMissingConstructor.java | 10 ++ .../jakarta/persistence/FinalModifiers.java | 15 +++ .../MapKeyAndMapKeyClassTogether.java | 20 +++ .../MultipleMapKeyAnnotations.java | 22 ++++ .../servlet/DontExtendHttpServlet.java | 8 ++ .../jakarta/servlet/InvalidWebServlet.java | 17 +++ .../jakarta/websocket/AnnotationTest.java | 28 +++++ .../jakarta/websocket/DuplicateOnMessage.java | 22 ++++ .../jakarta/websocket/InvalidParamType.java | 28 +++++ .../ServerEndpointDuplicateVariableURI.java | 8 ++ .../ServerEndpointInvalidTemplateURI.java | 8 ++ .../websocket/ServerEndpointNoSlash.java | 9 ++ .../ServerEndpointRelativePathTest.java | 8 ++ .../websockets/PathParamURIWarningTest.java | 42 +++++++ .../FullyQualifiedNameDiagnosticTest.java | 39 ------ .../jdt/nodiagnostics/NoDiagnosticsTest.java | 118 ++++++++++++++++++ 42 files changed, 1340 insertions(+), 39 deletions(-) create mode 100755 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java delete mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml new file mode 100755 index 00000000..6680d74f --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml @@ -0,0 +1,114 @@ + + + 4.0.0 + + io.openliberty + jakarta-servlet + 1.0-SNAPSHOT + war + + + 1.8 + 1.8 + UTF-8 + UTF-8 + ${project.artifactId} + + + + + + jakarta.platform + jakarta.jakartaee-api + 9.0.0 + provided + + + org.eclipse.microprofile + microprofile + 3.3 + pom + provided + + + + junit + junit + 4.12 + test + + + org.apache.cxf + cxf-rt-rs-client + 3.2.6 + test + + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.2.6 + test + + + org.glassfish + javax.json + 1.0.4 + test + + + org.hibernate + hibernate-validator + 7.0.0.Final + + + org.glassfish + jakarta.el + 4.0.0 + + + + javax.xml.bind + jaxb-api + 2.3.1 + test + + + + + ${project.artifactId} + + + + + io.openliberty.tools + liberty-maven-plugin + 3.3.4 + + + io.openliberty.beta + openliberty-jakartaee9 + 21.0.0.2-beta + zip + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.2.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.2 + + + + diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java new file mode 100644 index 00000000..c672cf98 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java @@ -0,0 +1,31 @@ +package io.openliberty.sample.jakarta.annotations; + +import jakarta.fake.Generated; + +@Generated(value = "demoServlet", date="") +public class GeneratedAnnotation { + + @Generated(value = "demoServlet", date="not_ISO_compliant") + private Integer studentId; + + @Generated(value = "demoServlet", date="2001-07-04T12:08:56.235-0700") + private boolean isHappy; + + @Generated(value = "demoServletijiojioj", date="NOTISOCOMPLIANT2") + private boolean isSad; + + @Generated("com.sun.xml.rpc.AProcessor") + private String emailAddress; + + @Generated(value="com.sun.xml.rpc.AProcessor") + private String homeTown; + + public GeneratedAnnotation(Integer studentId, Boolean isHappy, boolean isSad, String graduationDate, Integer gpa, + String emailAddress) { + this.studentId = studentId; + this.isHappy = isHappy; + this.isSad = isSad; + this.emailAddress = emailAddress; + } + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java new file mode 100644 index 00000000..77200aef --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java @@ -0,0 +1,32 @@ +package io.openliberty.sample.jakarta.annotations; + +import jakarta.fake.PostConstruct; +import jakarta.fake.Resource; + +@Resource(type = Object.class, name = "aa") +public class PostConstructAnnotation { + + private Integer studentId; + + private boolean isHappy; + + private boolean isSad; + + @PostConstruct() + public Integer getStudentId() { + return this.studentId; + } + + @PostConstruct + public void getHappiness(String type) { + + } + + @PostConstruct + public void throwTantrum() throws Exception { + System.out.println("I'm sad"); + } + + private String emailAddress; + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java new file mode 100644 index 00000000..0f31ea0b --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java @@ -0,0 +1,43 @@ +package io.openliberty.sample.jakarta.annotations; + +import jakarta.fake.PreDestroy; +import jakarta.fake.Resource; + +@Resource(type = Object.class, name = "aa") +public class PreDestroyAnnotation { + + private Integer studentId; + + private boolean isHappy; + + private boolean isSad; + + @PreDestroy() + public Integer getStudentId() { + return this.studentId; + } + + @PreDestroy() + public boolean getHappiness(String type) { + if (type.equals("happy")) return this.isHappy; + return this.isSad; + } + + @PreDestroy() + public static void makeUnhappy() { + System.out.println("I'm sad"); + } + + @PreDestroy() + public void throwTantrum() throws Exception { + System.out.println("I'm sad"); + } + + + private String emailAddress; + + +} + + + diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java new file mode 100644 index 00000000..bb423335 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java @@ -0,0 +1,45 @@ +package io.openliberty.sample.jakarta.annotations; + +import jakarta.fake.Resource; + +@Resource(type = Object.class, name = "aa") +public class ResourceAnnotation { + + private Integer studentId; + + + @Resource(shareable = true) + private boolean isHappy; + + @Resource(name = "test") + private boolean isSad; + + + private String emailAddress; + + +} + +@Resource(name = "aa") +class PostDoctoralStudent { + + private Integer studentId; + + + @Resource(shareable = true) + private boolean isHappy; + + @Resource + private boolean isSad; + + + private String emailAddress; + +} + +@Resource(type = Object.class) +class MasterStudent { + + private Integer studentId; + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java new file mode 100644 index 00000000..baaf5824 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java @@ -0,0 +1,65 @@ +package io.openliberty.sample.jakarta.beanvalidation; + +import java.util.Calendar; +import java.util.List; + +import jakarta.fake.constraints.*; + +public class FieldConstraintValidation { + + @AssertTrue + private int isHappy; // invalid types + + @AssertFalse + private Double isSad; + + @DecimalMax("30.0") + @DecimalMin("10.0") + private String bigDecimal; + + @Digits(fraction = 0, integer = 0) + private boolean digits; + + @Email + private Integer emailAddress; + + @FutureOrPresent + private boolean graduationDate; + + @Future + private double fergiesYear; + + @Min(value = 50) + @Max(value = 100) + private boolean gpa; + + @Negative + private boolean subZero; + + @NegativeOrZero + private String notPos; + + @NotBlank + private boolean saysomething; + + @Pattern(regexp = "") + private Calendar thisIsUsed; + + @Past + private double theGoodOldDays; + + @PastOrPresent + private char[] aGoodFieldName; + + @Positive + private String[] area; + + @PositiveOrZero + private List maybeZero; + + @AssertTrue + private static boolean typeValid; // static + + @Past + private static boolean doubleBad; // static and invalid type +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java new file mode 100644 index 00000000..4562409f --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java @@ -0,0 +1,35 @@ +package io.openliberty.sample.jakarta.beanvalidation; + +import jakarta.fake.constraints.AssertFalse; +import jakarta.fake.constraints.AssertTrue; + +public class MethodConstraintValidation { + + // valid cases + @AssertFalse + private boolean falseMethod() { + return false; + } + + @AssertTrue + public boolean trueMethod() { + return true; + } + + // invalid cases + @AssertTrue + public static boolean anotherTruth() { // static + return true; + } + + @AssertTrue + public String notBoolean() { // invalid type + return "aha!"; + } + + @AssertFalse + private static int notBoolTwo(int x) { // invalid type, static + return x; + } + +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java new file mode 100644 index 00000000..da21e28c --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java @@ -0,0 +1,95 @@ +package io.openliberty.sample.jakarta.beanvalidation; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Time; +import java.time.OffsetDateTime; +import java.time.Year; +import java.time.YearMonth; +import java.util.Calendar; +import java.util.Map; + +import jakarta.fake.constraints.Email; +import jakarta.fake.constraints.Future; +import jakarta.fake.constraints.FutureOrPresent; +import jakarta.fake.constraints.Max; +import jakarta.fake.constraints.Min; +import jakarta.fake.constraints.Negative; +import jakarta.fake.constraints.NegativeOrZero; +import jakarta.fake.constraints.NotBlank; +import jakarta.fake.constraints.NotEmpty; +import jakarta.fake.constraints.NotNull; +import jakarta.fake.constraints.Null; +import jakarta.fake.constraints.Past; +import jakarta.fake.constraints.PastOrPresent; +import jakarta.fake.constraints.Positive; +import jakarta.fake.constraints.PositiveOrZero; +import jakarta.fake.constraints.Size; +import jakarta.fake.constraints.AssertFalse; +import jakarta.fake.constraints.AssertTrue; +import jakarta.fake.constraints.DecimalMax; +import jakarta.fake.constraints.DecimalMin; +import jakarta.fake.constraints.Digits; + +public class ValidConstraints { + @AssertTrue + private boolean isHappy; + + @AssertFalse + private boolean isSad; + + @DecimalMax("30.0") + @DecimalMin("10.0") + private BigDecimal bigDecimal; + + @Digits(integer=5, fraction=1) + private BigInteger digies; + + @Email + private String emailAddress; + + @FutureOrPresent + private Calendar graduationDate; + + @Future + private Year fergiesYear; + + @Min(value = 50) + @Max(value = 100) + private Integer gpa; + + @Negative + private int subZero; + + @NegativeOrZero + private double notPos; + + @NotBlank + private String saysomething; + +// not yet implemented - see issue #63 +// @NotEmpty +// private String imgivinguponyou; + + @NotNull + private String thisIsUsed; + + @Null + private String NeverUsed; + + @Past + private OffsetDateTime theGoodOldDays; + + @PastOrPresent + private YearMonth aGoodFieldName; + + @Positive + private int area; + + @PositiveOrZero + private int maybeZero; + +// not yet implemented - see issue #63 +// @Size +// private boolean wordMap; +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java new file mode 100644 index 00000000..c1e5cf01 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java @@ -0,0 +1,55 @@ +package io.openliberty.sample.jakarta.cdi; + +import jakarta.fake.Inject; +import jakarta.fake.inject.Disposes; +import jakarta.fake.event.Observes; +import jakarta.fake.event.ObservesAsync; + +public class InjectAndDisposesObservesObservesAsync { + + @Inject + public String greetDisposes(@Disposes String name) { + return "Hi " + name + "!"; + } + + + @Inject + public String greetObserves(@Observes String name) { + return "Hi " + name + "!"; + } + + + @Inject + public String greetObservesAsync(@ObservesAsync String name) { + return "Hi " + name + "!"; + } + + + @Inject + public String greetDisposesObserves(@Disposes String name1, @Observes String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } + + + @Inject + public String greetObservesObservesAsync(@Observes String name1, @ObservesAsync String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } + + + @Inject + public String greetDisposesObservesAsync(@Disposes String name1, @ObservesAsync String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } + + + @Inject + public String greetDisposesObservesObservesAsync(@Disposes String name1, @Observes String name2, @ObservesAsync String name3) { + return "Hi " + name1 + ", " + name2 + " and " + name3 + "!"; + } + + @Inject + public String greetDisposesObservesObservesAsync2(@Disposes @Observes @ObservesAsync String name) { + return "Hi " + name + "!"; + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java new file mode 100644 index 00000000..d474617c --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java @@ -0,0 +1,13 @@ +package io.openliberty.sample.jakarta.cdi; + +import jakarta.fake.context.*; + +@RequestScoped +public class ManagedBean { + public int a; + + + public ManagedBean() { + this.a = 10; + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java new file mode 100644 index 00000000..7eecff1c --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java @@ -0,0 +1,25 @@ +/******************************************************************************* +* Copyright (c) 2021 IBM Corporation. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* Hani Damlaj +*******************************************************************************/ + +package io.openliberty.sample.jakarta.cdi; + +import jakarta.fake.context.Dependent; + +@Dependent +public class ManagedBeanConstructor { + private int a; + + public ManagedBeanConstructor(int a) { + this.a = a; + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java new file mode 100644 index 00000000..979d7f4d --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java @@ -0,0 +1,13 @@ +package io.openliberty.sample.jakarta.cdi; + +import jakarta.fake.context.ApplicationScoped; + +import jakarta.enterprise.inject.Disposes; + +@ApplicationScoped +public class MultipleDisposes { + + public String greet(@Disposes String name1, @Disposes String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java new file mode 100644 index 00000000..919ffd01 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java @@ -0,0 +1,58 @@ +package io.openliberty.sample.jakarta.cdi; + +import jakarta.fake.context.ApplicationScoped; + +import jakarta.fake.inject.Produces; +import jakarta.fake.inject.Disposes; +import jakarta.fake.event.Observes; +import jakarta.fake.event.ObservesAsync; + +@ApplicationScoped +public class ProducesAndDisposesObservesObservesAsync { + @Produces + public String greetDisposes(@Disposes String name) { + return "Hi " + name + "!"; + } + + + @Produces + public String greetObserves(@Observes String name) { + return "Hi " + name + "!"; + } + + + @Produces + public String greetObservesAsync(@ObservesAsync String name) { + return "Hi " + name + "!"; + } + + + @Produces + public String greetDisposesObserves(@Disposes String name1, @Observes String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } + + + @Produces + public String greetObservesObservesAsync(@Observes String name1, @ObservesAsync String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } + + + @Produces + public String greetDisposesObservesAsync(@Disposes String name1, @ObservesAsync String name2) { + return "Hi " + name1 + " and " + name2 + "!"; + } + + + @Produces + public String greetDisposesObservesObservesAsync(@Disposes String name1, @Observes String name2, @ObservesAsync String name3) { + return "Hi " + name1 + ", " + name2 + " and " + name3 + "!"; + } + + + @Produces + public String greetDisposesObservesObservesAsync2(@Disposes @Observes @ObservesAsync String name) { + return "Hi " + name + "!"; + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java new file mode 100644 index 00000000..af869470 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java @@ -0,0 +1,20 @@ +package io.openliberty.sample.jakarta.cdi; + +import jakarta.fake.context.ApplicationScoped; +import jakarta.fake.inject.Produces; +import jakarta.fake.Inject; + + +@ApplicationScoped +public class ProducesAndInjectTogether { + @Produces + @Inject + private String greeting = "Hello"; + + + @Produces + @Inject + public String greet(String name) { + return this.greeting + " " + name + "!"; + } +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java new file mode 100644 index 00000000..4b41e1c2 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java @@ -0,0 +1,19 @@ +package io.openliberty.sample.jakarta.cdi; + +import java.util.Collections; +import java.util.List; + +import jakarta.fake.inject.Produces; + +import jakarta.fake.context.*; + +@ApplicationScoped @RequestScoped +public class ScopeDeclaration { + @Produces @ApplicationScoped @Dependent + private int n; + + @Produces @ApplicationScoped @RequestScoped + public List getAllProductIds() { + return Collections.emptyList(); + } +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java new file mode 100644 index 00000000..597035ef --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java @@ -0,0 +1,13 @@ +package io.openliberty.sample.jakarta.di; + +import jakarta.fake.context.ApplicationScoped; +import jakarta.fake.Singleton; + +@ApplicationScoped +public class Greeting { + + public String greet(String name) { + return "Hello, " + name; + } + +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java new file mode 100644 index 00000000..cdef4941 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java @@ -0,0 +1,37 @@ +/******************************************************************************* +* Copyright (c) 2021 IBM Corporation. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* Ananya Rao +*******************************************************************************/ + +package io.openliberty.sample.jakarta.di; + +import jakarta.fake.Inject; + +public class MultipleConstructorWithInject{ + private int productNum; + private String productDesc; + + @Inject + public MultipleConstructorWithInject(int productNum) { + this.productNum = productNum; + } + @Inject + public MultipleConstructorWithInject(String productDesc) { + this.productDesc = productDesc; + } + + @Inject + protected MultipleConstructorWithInject(int productNum, String productDesc) { + this.productNum = productNum; + this.productDesc = productDesc; + } +} + diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java new file mode 100644 index 00000000..1a563458 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java @@ -0,0 +1,25 @@ +/******************************************************************************* +* Copyright (c) 2021 IBM Corporation. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* Bera Sogut +*******************************************************************************/ + +package io.openliberty.sample.jakarta.jax_rs; + +import jakarta.fake.rs.DELETE; +import jakarta.fake.rs.FormParam; + +public class MultipleEntityParamsResourceMethod { + + @DELETE + public void resourceMethodWithTwoEntityParams(String entityParam1, @FormParam(value = "") String nonEntityParam, int entityParam2) { + + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java new file mode 100644 index 00000000..e541bff6 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java @@ -0,0 +1,16 @@ +package io.openliberty.sample.jakarta.jax_rs; + +import jakarta.fake.rs.Path; + +@Path("/somewhere") +public class NoPublicConstructorClass { + + private NoPublicConstructorClass() { + + } + + protected NoPublicConstructorClass(int arg1) { + + } + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java new file mode 100644 index 00000000..19a8f154 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java @@ -0,0 +1,39 @@ +package io.openliberty.sample.jakarta.jax_rs; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import jakarta.fake.rs.Consumes; +import jakarta.fake.rs.WebApplicationException; +import jakarta.fake.rs.core.MediaType; +import jakarta.fake.rs.core.MultivaluedMap; +import jakarta.fake.rs.ext.MessageBodyReader; +import jakarta.fake.rs.ext.Provider; + + +@Consumes("application/x-www-form-urlencoded") +@Provider +public class NoPublicConstructorProviderClass implements MessageBodyReader { + + private NoPublicConstructorProviderClass() { + + } + + protected NoPublicConstructorProviderClass(int arg1) { + + } + + @Override + public boolean isReadable(Class arg0, Type arg1, Annotation[] arg2, MediaType arg3) { + return false; + } + + @Override + public Object readFrom(Class arg0, Type arg1, Annotation[] arg2, MediaType arg3, + MultivaluedMap arg4, InputStream arg5) throws IOException, WebApplicationException { + return null; + } + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java new file mode 100644 index 00000000..31be4fc7 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2021 IBM Corporation, Matthew Shocrylas and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation, Matthew Shocrylas - initial API and implementation + *******************************************************************************/ + +package io.openliberty.sample.jakarta.jax_rs; + +import jakarta.fake.rs.HEAD; + +public class NotPublicResourceMethod { + + @HEAD + private void privateMethod() { + + } + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java new file mode 100644 index 00000000..d8e139ab --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java @@ -0,0 +1,16 @@ +package io.openliberty.sample.jakarta.jax_rs; + +import jakarta.fake.rs.Path; + +@Path("/somewhere") +public class RootResourceClassConstructorsDiffLen { + + public RootResourceClassConstructorsDiffLen() { + + } + + public RootResourceClassConstructorsDiffLen(int arg1) { + + } + +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java new file mode 100644 index 00000000..9e341572 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java @@ -0,0 +1,15 @@ +package io.openliberty.sample.jakarta.jax_rs; + +import jakarta.fake.rs.Path; + +@Path("/somewhere") +public class RootResourceClassConstructorsEqualLen { + + public RootResourceClassConstructorsEqualLen(int arg1) { + + } + + public RootResourceClassConstructorsEqualLen(String arg1) { + + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java new file mode 100644 index 00000000..b253e796 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2021 IBM Corporation and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package io.openliberty.sample.jakarta.jsonb; + +import jakarta.fake.bind.annotation.JsonbCreator; + +public class ExtraJsonbCreatorAnnotations { + @JsonbCreator + public ExtraJsonbCreatorAnnotations() {} + + @JsonbCreator + private static ExtraJsonbCreatorAnnotations factoryMethod() { + return null; + } +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java new file mode 100644 index 00000000..c0ea7cbf --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java @@ -0,0 +1,78 @@ +/******************************************************************************* +* Copyright (c) 2022 IBM Corporation and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Adit Rada, Yijia Jing - initial API and implementation + *******************************************************************************/ + +package io.openliberty.sample.jakarta.jsonb; + +import jakarta.fake.bind.annotation.JsonbAnnotation; +import jakarta.fake.bind.annotation.JsonbProperty; +import jakarta.fake.bind.annotation.JsonbTransient; + +public class JsonbTransientDiagnostic { + @JsonbTransient + private int id; + + @JsonbProperty("name") + @JsonbTransient + private String name; // Diagnostic: JsonbTransient is mutually exclusive with other JsonB annotations + + @JsonbProperty("fav_lang") + @JsonbAnnotation + @JsonbTransient + private String favoriteLanguage; // Diagnostic: JsonbTransient is mutually exclusive with other JsonB annotations + + // No diagnostic as field is not annotated with other Jsonb annotations, + // even though the accessors are annotated with @JsonbTransient + private String favoriteDatabase; + + // Diagnostic will appear as field accessors have @JsonbTransient, + // but field itself has annotation other than transient + @JsonbProperty("fav_editor") + private String favoriteEditor; + + @JsonbProperty("person-id") + private int getId() { + // A diagnostic is expected on getId because as a getter, it is annotated with other + // Jsonb annotations while its corresponding field id is annotated with JsonbTransient + return id; + } + + @JsonbAnnotation + private void setId(int id) { + // A diagnostic is expected on setId because as a setter, it is annotated with other + // Jsonb annotations while its corresponding field id is annotated with JsonbTransient + this.id = id; + } + + @JsonbTransient + private String getFavoriteDatabase() { + return favoriteDatabase; + } + + @JsonbTransient + private void setFavoriteDatabase(String favoriteDatabase) { + this.favoriteDatabase = favoriteDatabase; + } + + // A diagnostic will appear as field has conflicting annotation + @JsonbTransient + private String getFavoriteEditor() { + return favoriteEditor; + } + + // A diagnostic will appear as @JsonbTransient is not mutually exclusive on this accessor + @JsonbAnnotation + @JsonbTransient + private void setFavoriteEditor(String favoriteEditor) { + this.favoriteEditor = favoriteEditor; + } +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java new file mode 100644 index 00000000..55bb958f --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2022 IBM Corporation and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Yijia Jing + *******************************************************************************/ +package io.openliberty.sample.jakarta.jsonp; + +import jakarta.fake.Json; +import jakarta.fake.JsonPointer; + +public class CreatePointerInvalidTarget { + + public static void makePointers() { + JsonPointer doubleSlashPointer = Json.createPointer("//"); + JsonPointer noSlashPrefixPointer = Json.createPointer("name/1"); + JsonPointer slashSuffixPointer = Json.createPointer("/skills/languages/"); + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java new file mode 100644 index 00000000..fd6bebe9 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java @@ -0,0 +1,10 @@ +package io.openliberty.sample.jakarta.persistence; + +import jakarta.fake.Entity; + +@Entity +public class EntityMissingConstructor { + + private EntityMissingConstructor(int x) {} + +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java new file mode 100644 index 00000000..e9fc4f29 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java @@ -0,0 +1,15 @@ +package io.openliberty.sample.jakarta.persistence; + +import jakarta.fake.Entity; + +@Entity +public final class FinalModifiers { + + final int x = 1; + final String y = "hello", z = "world"; + + public final int methody() { + final int ret = 100; + return 100 + ret; + } +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java new file mode 100644 index 00000000..3374df47 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java @@ -0,0 +1,20 @@ +package io.openliberty.sample.jakarta.persistence; + +import java.util.HashMap; +import java.util.Map; + +import jakarta.fake.MapKey; +import jakarta.fake.MapKeyClass; + +public class MapKeyAndMapKeyClassTogether { + @MapKey() + @MapKeyClass(Map.class) + Map testMap = new HashMap<>(); + + + @MapKey() + @MapKeyClass(Map.class) + public Map getTestMap(){ + return this.testMap; + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java new file mode 100644 index 00000000..0d840a6e --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java @@ -0,0 +1,22 @@ +package io.openliberty.sample.jakarta.persistence; + +import java.util.Map; + +import jakarta.fake.Entity; +import jakarta.fake.Id; +import jakarta.fake.MapKeyJoinColumn; + +@Entity +public class MultipleMapKeyAnnotations { + @MapKeyJoinColumn() + @MapKeyJoinColumn() + Map test1; + + @MapKeyJoinColumn(name = "n1") + @MapKeyJoinColumn(referencedColumnName = "rcn2") + Map test2; + + @MapKeyJoinColumn(name = "n1", referencedColumnName = "rcn1") + @MapKeyJoinColumn() + Map test3; +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java new file mode 100644 index 00000000..e5dd5d95 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java @@ -0,0 +1,8 @@ +package io.openliberty.sample.jakarta.servlet; + +import jakarta.fake.annotation.WebServlet; + +@WebServlet(name = "demoServlet", urlPatterns = { "/demo" }) +public class DontExtendHttpServlet { + +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java new file mode 100644 index 00000000..70267c16 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java @@ -0,0 +1,17 @@ +package io.openliberty.sample.jakarta.servlet; + +import jakarta.fake.fakeException; +import jakarta.fake.annotation.WebServlet; +import jakarta.fake.http.Httpfake; +import jakarta.fake.http.HttpServletRequest; +import jakarta.fake.http.HttpServletResponse; +import java.io.IOException; + +@WebServlet() +public class InvalidWebServlet extends HttpServlet { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { + res.setContentType("text/html;charset=UTF-8"); + res.getWriter().println("Hello Jakarta EE 9 + Open Liberty!"); + } +} \ No newline at end of file diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java new file mode 100644 index 00000000..181597d1 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java @@ -0,0 +1,28 @@ +package io.openliberty.sample.jakarta.websocket; + +import java.io.IOException; + +import jakarta.fake.OnClose; +import jakarta.fake.OnOpen; +import jakarta.fake.server.ServerEndpoint; +import jakarta.fake.Session; + +/** + * Expected Diagnostics are related to validating that the parameters have the + * valid annotation @PathParam (code: AddPathParamsAnnotation) + * See issue #247 (onOpen) and #248 (onClose) + */ +@ServerEndpoint(value = "/infos") +public class AnnotationTest { + // @PathParam missing annotation for "String missingAnnotation" + @OnOpen + public void OnOpen(Session session, String missingAnnotation) throws IOException { + System.out.println("Websocket opened: " + session.getId().toString()); + } + + // Used to check that the expected diagnostic handle more than one case + @OnClose + public void OnClose(Session session, Integer missingAnnotation1, String missingAnnotation2) { + System.out.println("Websocket opened: " + session.getId().toString()); + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java new file mode 100644 index 00000000..543f9072 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java @@ -0,0 +1,22 @@ +package io.openliberty.sample.jakarta.websocket; + +import java.io.Reader; + +import jakarta.fake.OnMessage; +import jakarta.fake.Session; +import jakarta.fake.server.PathParam; +import jakarta.fake.server.ServerEndpoint; + +// String and Reader will cause a duplicate diagnostic as they're both text message formats. +@ServerEndpoint("/{var}") +public class DuplicateOnMessage { + @OnMessage + public void textHandler1(@PathParam("var") String var, String text, Session session) { + session.getAsyncRemote().sendText(text); + } + + @OnMessage + public void textHandler2(@PathParam("var") String var, Reader text, Session session) { + session.getAsyncRemote().sendText(var); + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java new file mode 100644 index 00000000..5e5990b4 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java @@ -0,0 +1,28 @@ +package io.openliberty.sample.jakarta.websocket; + +import java.io.IOException; + +import jakarta.fake.CloseReason; +import jakarta.fake.OnOpen; +import jakarta.fake.OnClose; +import jakarta.fake.Session; +import jakarta.fake.server.ServerEndpoint; + +/** + * Expected Diagnostics are related to validating that the parameters for the + * WebSocket methods are of valid types for onOpen (diagnostic code: OnOpenChangeInvalidParam) + * and onClose (diagnostic code: OnCloseChangeInvalidParam). + * See issues #247 (onOpen) and #248 (onClose) + */ +@ServerEndpoint(value = "/infos") +public class InvalidParamType { + @OnOpen + public void OnOpen(Session session, Object invalidParam) throws IOException { + System.out.println("WebSocket closed for " + session.getId()); + } + + @OnClose + public void OnClose(Session session, CloseReason closeReason, Object invalidParam) throws IOException { + System.out.println("WebSocket closed for " + session.getId()); + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java new file mode 100644 index 00000000..6f358fe0 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java @@ -0,0 +1,8 @@ +package io.openliberty.sample.jakarta.websocket; + +import jakarta.fake.server.ServerEndpoint; + +// Diagnostics: +// + Server endpoint paths must not use the same variable more than once in a path. +@ServerEndpoint("/{varA}/{varB}/{varA}") +public class ServerEndpointDuplicateVariableURI {} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java new file mode 100644 index 00000000..f991c9a1 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java @@ -0,0 +1,8 @@ +package io.openliberty.sample.jakarta.websocket; + +import jakarta.fake.server.ServerEndpoint; + +// Diagnostics: +// + Server endpoint paths must be a URI-template (level-1) or a partial URI. +@ServerEndpoint("/{very incorrect variable}/") +public class ServerEndpointInvalidTemplateURI {} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java new file mode 100644 index 00000000..efb3bf99 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java @@ -0,0 +1,9 @@ +package io.openliberty.sample.jakarta.websocket; + +import jakarta.fake.server.ServerEndpoint; + +// Diagnostics: +// + Server endpoint paths must start with a leading '/'. +// + Server endpoint paths must be a URI-template (level-1) or a partial URI. +@ServerEndpoint("path") +public class ServerEndpointNoSlash {} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java new file mode 100644 index 00000000..9ae4d13e --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java @@ -0,0 +1,8 @@ +package io.openliberty.sample.jakarta.websocket; + +import jakarta.fake.server.ServerEndpoint; + +// Diagnostics: +// + Server endpoint paths must not contain the sequences '/../', '/./' or '//'. +@ServerEndpoint("/../path") +public class ServerEndpointRelativePathTest {} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java new file mode 100644 index 00000000..bfde07fe --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java @@ -0,0 +1,42 @@ +package io.openliberty.sample.jakarta.websockets; + +import java.io.IOException; +import jakarta.fake.server.PathParam; +import jakarta.fake.server.ServerEndpoint; +import jakarta.fake.OnOpen; +import jakarta.fake.OnError; +import jakarta.fake.OnMessage; +import jakarta.fake.OnClose; +import jakarta.fake.Session; + +@ServerEndpoint(value = "/paramdemo/{test}/{abcd}") +public class PathParamURIWarningTest { + private static Session session; + + @OnOpen + public void OnOpen(Session session) throws IOException { + this.session = session; + System.out.println("Websocket opened: " + session.getId().toString()); + } + + @OnMessage + public void onMessage(String message, Session session, @PathParam("tast") String test) { + System.out.println("Program requested " + message + " using " + session.getId()); + System.out.println(session.getPathParameters() + " - " + session.getRequestURI()); + if (test == null) { + session.getAsyncRemote().sendText("Test String was Null!"); + } else { + session.getAsyncRemote().sendText("Test String was \"" + message + "\""); + } + } + + @OnError + public void onError(Session session, Throwable throwable) { + System.out.println("There was an error WebSocket error for " + session.getId() + " " + throwable.getMessage()); + } + + @OnClose + public void onClose(Session session) { + System.out.println("WebSocket closed for " + session.getId()); + } +} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java deleted file mode 100644 index b43f7041..00000000 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jax_rs/FullyQualifiedNameDiagnosticTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.lsp4jakarta.jdt.jax_rs; - -import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaDiagnosticsPresent; -import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.d; - -import java.util.Arrays; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.lsp4j.Diagnostic; -import org.eclipse.lsp4j.DiagnosticSeverity; -import org.eclipse.lsp4jakarta.commons.JakartaDiagnosticsParams; -import org.eclipse.lsp4jakarta.jdt.core.BaseJakartaTest; -import org.eclipse.lsp4jakarta.jdt.core.JDTUtils; -import org.junit.Test; - -public class FullyQualifiedNameDiagnosticTest extends BaseJakartaTest { - - protected static JDTUtils JDT_UTILS = new JDTUtils(); - - @Test - public void verifyDiagnosticForFullyQualifiedName() throws Exception { - JDTUtils utils = JDT_UTILS; - IJavaProject javaProject = loadJavaProject("jakarta-sample", ""); - IFile javaFile = javaProject.getProject() - .getFile(new Path("src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java")); - String uri = javaFile.getLocation().toFile().toURI().toString(); - - JakartaDiagnosticsParams diagnosticsParams = new JakartaDiagnosticsParams(); - diagnosticsParams.setUris(Arrays.asList(uri)); - - Diagnostic d = d(8, 13, 46, "Resource methods cannot have more than one entity parameter", - DiagnosticSeverity.Error, "jakarta-jax_rs", "ResourceMethodMultipleEntityParams"); - assertJavaDiagnosticsPresent(diagnosticsParams, utils, d); - - } - -} diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java new file mode 100644 index 00000000..3aa45fd1 --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java @@ -0,0 +1,118 @@ +/******************************************************************************* +* Copyright (c) 2023 IBM Corporation and others. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* IBM Corporation - initial API and implementation +*******************************************************************************/ + +package org.eclipse.lsp4jakarta.jdt.nodiagnostics; + +import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaDiagnostics; + +import java.util.Arrays; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.lsp4jakarta.commons.JakartaDiagnosticsParams; +import org.eclipse.lsp4jakarta.jdt.core.BaseJakartaTest; +import org.eclipse.lsp4jakarta.jdt.core.JDTUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class NoDiagnosticsTest extends BaseJakartaTest { + + @Parameter + public String filePath; + + protected static JDTUtils JDT_UTILS = new JDTUtils(); + + @Test + public void checkForNoDiagnostics() throws Exception { + + JDTUtils utils = JDT_UTILS; + + IJavaProject javaProject = loadJavaProject("jakarta-noDiagnostic-sample", ""); + IFile javaFile = javaProject.getProject() + .getFile(new Path(filePath)); + String uri = javaFile.getLocation().toFile().toURI().toString(); + + JakartaDiagnosticsParams diagnosticsParams = new JakartaDiagnosticsParams(); + diagnosticsParams.setUris(Arrays.asList(uri)); + + // should be no errors + assertJavaDiagnostics(diagnosticsParams, utils); + + } + + // list of java files in demo-servlet-no-diagnostics. + @Parameters + public static String[] projectFileProvider() throws Exception { + + String basePath = "src/main/java/io/openliberty/sample/jakarta/"; + String files[] = { basePath + "annotations/GeneratedAnnotation.java", + basePath + "annotations/PostConstructAnnotation.java", + basePath + "annotations/PreDestroyAnnotation.java", + basePath + "annotations/ResourceAnnotation.java", + + basePath + "beanvalidation/FieldConstraintValidation.java", + basePath + "beanvalidation/MethodConstraintValidation.java", + basePath + "beanvalidation/ValidConstraints.java", + + basePath + "cdi/InjectAndDisposesObservesObservesAsync.java", + basePath + "cdi/ManagedBean.java", + basePath + "cdi/ManagedBeanConstructor.java", + basePath + "cdi/MultipleDisposes.java", + basePath + "cdi/ProducesAndDisposesObservesObservesAsync.java", + basePath + "cdi/ProducesAndInjectTogether.java", + basePath + "cdi/ScopeDeclaration.java", + + basePath + "di/Greeting.java", + basePath + "di/MultipleConstructorWithInject.java", + + basePath + "jax_rs/MultipleEntityParamsResourceMethod.java", + basePath + "jax_rs/NoPublicConstructorClass.java", + basePath + "jax_rs/NoPublicConstructorProviderClass.java", + basePath + "jax_rs/NotPublicResourceMethod.java", + basePath + "jax_rs/RootResourceClassConstructorsDiffLen.java", + basePath + "jax_rs/RootResourceClassConstructorsEqualLen.java", + + basePath + "jsonb/ExtraJsonbCreatorAnnotations.java", + basePath + "jsonb/JsonbTransientDiagnostic.java", + + basePath + "jsonp/CreatePointerInvalidTarget.java", + + basePath + "persistence/EntityMissingConstructor.java", + basePath + "persistence/FinalModifiers.java", + basePath + "persistence/MapKeyAndMapKeyClassTogether.java", + basePath + "persistence/MultipleMapKeyAnnotations.java", + + basePath + "servlet/DontExtendHttpServlet.java", + basePath + "servlet/InvalidWebServlet.java", + + basePath + "websocket/AnnotationTest.java", + basePath + "websocket/DuplicateOnMessage.java", + basePath + "websocket/InvalidParamType.java", + basePath + "websocket/ServerEndpointDuplicateVariableURI.java", + basePath + "websocket/ServerEndpointInvalidTemplateURI.java", + basePath + "websocket/ServerEndpointNoSlash.java", + basePath + "websocket/ServerEndpointRelativePathTest.java", + + basePath + "websockets/PathParamURIWarningTest.java" + }; + + return files; + + } + +} From 25d72b1bc00818fdd53f8891f109b04e06beaca0 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Fri, 14 Jul 2023 19:02:46 +0530 Subject: [PATCH 19/27] Reverted the changes done in JakartaForJavaAssert file --- .../jdt/core/JakartaForJavaAssert.java | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java index 7a609faf..42dca4fa 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/core/JakartaForJavaAssert.java @@ -156,32 +156,22 @@ public static Range r(int startLine, int startCharacter, int endLine, int endCha public static Position p(int line, int character) { return new Position(line, character); } - - public static void assertJavaDiagnosticsPresent(JakartaDiagnosticsParams params, JDTUtils utils, Diagnostic... expected) - throws JavaModelException { - List actual = JDTServicesManager.getInstance().getJavaDiagnostics(params); - assertDiagnostics(true, - actual != null && actual.size() > 0 ? actual.get(0).getDiagnostics() : Collections.emptyList(), - expected); - } - public static void assertJavaDiagnostics(JakartaDiagnosticsParams params, JDTUtils utils, Diagnostic... expected) throws JavaModelException { List actual = JDTServicesManager.getInstance().getJavaDiagnostics(params); - assertDiagnostics(false, + assertDiagnostics( actual != null && actual.size() > 0 ? actual.get(0).getDiagnostics() : Collections.emptyList(), expected); } - public static void assertDiagnostics( boolean checkForDiagnostic, List actual, Diagnostic... expected) { - assertDiagnostics(actual, Arrays.asList(expected), false, checkForDiagnostic); + public static void assertDiagnostics(List actual, Diagnostic... expected) { + assertDiagnostics(actual, Arrays.asList(expected), false); } - public static void assertDiagnostics(List actual, List expected, boolean filter, boolean isDiagnosticPresent) { - - /** + public static void assertDiagnostics(List actual, List expected, boolean filter) { + /** * ordering of diagnostics should not matter when testing for equality, so we * sort diagnostics by their range. */ @@ -203,7 +193,7 @@ public static void assertDiagnostics(List actual, List e for (Diagnostic dia : actual) { dia.setMessage(replaceNewLineCharacters(dia.getMessage())); } - + List received = actual; final boolean filterMessage; if (expected != null && !expected.isEmpty() @@ -222,13 +212,9 @@ public static void assertDiagnostics(List actual, List e return simpler; }).collect(Collectors.toList()); } - if (isDiagnosticPresent) { - Assert.assertNotEquals("Unexpected diagnostics:\n" + actual, expected, received); - } else { - Assert.assertEquals("Unexpected diagnostics:\n" + actual, expected, received); - } + Assert.assertEquals("Unexpected diagnostics:\n" + actual, expected, received); } - + public static String fixURI(URI uri) { String uriString = uri.toString(); return uriString.replaceFirst("file:/([^/])", "file:///$1"); From ff5d792d0a8fefbea4ea4428bc7a19d1e9efa3ec Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Fri, 14 Jul 2023 19:05:25 +0530 Subject: [PATCH 20/27] Deleted the FullyQualifiedNameDiagnostic.java file --- .../jakarta/jax_rs/FullyQualifiedNameDiagnostic.java | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java deleted file mode 100644 index 0ad5c290..00000000 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/FullyQualifiedNameDiagnostic.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.openliberty.sample.jakarta.jax_rs; - -import fake.ws.rs.DELETE; -import jakarta.ws.rs.FormParam; - -public class FullyQualifiedNameDiagnostic { - @DELETE - public void resourceMethodWithTwoEntityParams(String entityParam1, @FormParam(value = "") String nonEntityParam, int entityParam2) { - - } -} From eb7861abf780ecbb9ce73b8fdaded414aad763ec Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Fri, 14 Jul 2023 19:09:56 +0530 Subject: [PATCH 21/27] Updated a comment --- .../lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java index 3aa45fd1..72c591ef 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java @@ -50,7 +50,7 @@ public void checkForNoDiagnostics() throws Exception { JakartaDiagnosticsParams diagnosticsParams = new JakartaDiagnosticsParams(); diagnosticsParams.setUris(Arrays.asList(uri)); - // should be no errors + // should be no diagnostics in the file. assertJavaDiagnostics(diagnosticsParams, utils); } From 7ea3c92f7c02f89b13becf03bc249027dd0f6399 Mon Sep 17 00:00:00 2001 From: VAISAKH T Date: Fri, 14 Jul 2023 21:59:15 +0530 Subject: [PATCH 22/27] Update JakartaSnippetRegistryTest.java --- .../lsp4jakarta/snippets/JakartaSnippetRegistryTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java index 04e8a5ed..5c39b8ba 100644 --- a/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java +++ b/jakarta.ls/src/test/java/org/eclipse/lsp4jakarta/snippets/JakartaSnippetRegistryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2020 IBM Corporation and others. +* Copyright (c) 2023 IBM Corporation and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -173,7 +173,7 @@ public void TransactionsSnippetsTest() { // Verify whether the snippet is present in the registry. private static Optional findByPrefix(String prefix, SnippetRegistry registry) { - return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().equals(prefix)).findFirst(); + return registry.getSnippets().stream().filter(snippet -> snippet.getPrefixes().contains(prefix)).findFirst(); } // Verify whether the snippet context is present in the registry. From 08893041b6a7298e266b6896a24d064735835492 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Mon, 17 Jul 2023 18:12:57 +0530 Subject: [PATCH 23/27] Replaced with new maven project for no diagnostics test --- .../demo-servlet-no-diagnostics/pom.xml | 75 ++++++++++++ .../annotations/GeneratedAnnotation.java | 0 .../annotations/PostConstructAnnotation.java | 0 .../annotations/PreDestroyAnnotation.java | 0 .../annotations/ResourceAnnotation.java | 0 .../FieldConstraintValidation.java | 0 .../MethodConstraintValidation.java | 0 .../beanvalidation/ValidConstraints.java | 0 ...njectAndDisposesObservesObservesAsync.java | 0 .../sample/jakarta/cdi/ManagedBean.java | 0 .../jakarta/cdi/ManagedBeanConstructor.java | 0 .../sample/jakarta/cdi/MultipleDisposes.java | 2 +- ...ducesAndDisposesObservesObservesAsync.java | 0 .../cdi/ProducesAndInjectTogether.java | 0 .../sample/jakarta/cdi/ScopeDeclaration.java | 0 .../sample/jakarta/di/Greeting.java | 0 .../di/MultipleConstructorWithInject.java | 0 .../MultipleEntityParamsResourceMethod.java | 0 .../jax_rs/NoPublicConstructorClass.java | 0 .../NoPublicConstructorProviderClass.java | 0 .../jax_rs/NotPublicResourceMethod.java | 0 .../RootResourceClassConstructorsDiffLen.java | 0 ...RootResourceClassConstructorsEqualLen.java | 0 .../jsonb/ExtraJsonbCreatorAnnotations.java | 0 .../jsonb/JsonbTransientDiagnostic.java | 0 .../jsonp/CreatePointerInvalidTarget.java | 0 .../persistence/EntityMissingConstructor.java | 0 .../jakarta/persistence/FinalModifiers.java | 0 .../MapKeyAndMapKeyClassTogether.java | 0 .../MultipleMapKeyAnnotations.java | 0 .../servlet/DontExtendHttpServlet.java | 0 .../jakarta/servlet/InvalidWebServlet.java | 4 +- .../jakarta/websocket/AnnotationTest.java | 0 .../jakarta/websocket/DuplicateOnMessage.java | 0 .../jakarta/websocket/InvalidParamType.java | 0 .../ServerEndpointDuplicateVariableURI.java | 0 .../ServerEndpointInvalidTemplateURI.java | 0 .../websocket/ServerEndpointNoSlash.java | 0 .../ServerEndpointRelativePathTest.java | 0 .../websockets/PathParamURIWarningTest.java | 0 .../jakarta-noDiagnostic-sample/pom.xml | 114 ------------------ .../jdt/nodiagnostics/NoDiagnosticsTest.java | 86 +++++-------- 42 files changed, 106 insertions(+), 175 deletions(-) create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java (86%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java (87%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java (100%) rename jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/{jakarta-noDiagnostic-sample => demo-servlet-no-diagnostics}/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java (100%) delete mode 100755 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml new file mode 100644 index 00000000..2fba39eb --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml @@ -0,0 +1,75 @@ + + + + 4.0.0 + + io.openliberty + demo-servlet-no-diagnostics + 0.0.1-SNAPSHOT + + demo-servlet-no-diagnostics + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + + + + + junit + junit + 4.11 + test + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/GeneratedAnnotation.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/PostConstructAnnotation.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/PreDestroyAnnotation.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/annotations/ResourceAnnotation.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/beanvalidation/MethodConstraintValidation.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/beanvalidation/ValidConstraints.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/InjectAndDisposesObservesObservesAsync.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBean.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ManagedBeanConstructor.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java similarity index 86% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java index 979d7f4d..32399f70 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/MultipleDisposes.java @@ -2,7 +2,7 @@ import jakarta.fake.context.ApplicationScoped; -import jakarta.enterprise.inject.Disposes; +import jakarta.fake.inject.Disposes; @ApplicationScoped public class MultipleDisposes { diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndDisposesObservesObservesAsync.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ProducesAndInjectTogether.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/cdi/ScopeDeclaration.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/di/Greeting.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/di/MultipleConstructorWithInject.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/MultipleEntityParamsResourceMethod.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorClass.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/NoPublicConstructorProviderClass.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/NotPublicResourceMethod.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsDiffLen.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jax_rs/RootResourceClassConstructorsEqualLen.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jsonb/ExtraJsonbCreatorAnnotations.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jsonb/JsonbTransientDiagnostic.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/jsonp/CreatePointerInvalidTarget.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/EntityMissingConstructor.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/FinalModifiers.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/MapKeyAndMapKeyClassTogether.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/persistence/MultipleMapKeyAnnotations.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/servlet/DontExtendHttpServlet.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java similarity index 87% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java index 70267c16..209aed39 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/servlet/InvalidWebServlet.java @@ -1,8 +1,8 @@ package io.openliberty.sample.jakarta.servlet; -import jakarta.fake.fakeException; +import jakarta.fake.ServletException; import jakarta.fake.annotation.WebServlet; -import jakarta.fake.http.Httpfake; +import jakarta.fake.http.HttpServlet; import jakarta.fake.http.HttpServletRequest; import jakarta.fake.http.HttpServletResponse; import java.io.IOException; diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/AnnotationTest.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/DuplicateOnMessage.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/InvalidParamType.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointDuplicateVariableURI.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointInvalidTemplateURI.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointNoSlash.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websocket/ServerEndpointRelativePathTest.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java similarity index 100% rename from jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java rename to jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/src/main/java/io/openliberty/sample/jakarta/websockets/PathParamURIWarningTest.java diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml deleted file mode 100755 index 6680d74f..00000000 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/jakarta-noDiagnostic-sample/pom.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - 4.0.0 - - io.openliberty - jakarta-servlet - 1.0-SNAPSHOT - war - - - 1.8 - 1.8 - UTF-8 - UTF-8 - ${project.artifactId} - - - - - - jakarta.platform - jakarta.jakartaee-api - 9.0.0 - provided - - - org.eclipse.microprofile - microprofile - 3.3 - pom - provided - - - - junit - junit - 4.12 - test - - - org.apache.cxf - cxf-rt-rs-client - 3.2.6 - test - - - org.apache.cxf - cxf-rt-rs-extension-providers - 3.2.6 - test - - - org.glassfish - javax.json - 1.0.4 - test - - - org.hibernate - hibernate-validator - 7.0.0.Final - - - org.glassfish - jakarta.el - 4.0.0 - - - - javax.xml.bind - jaxb-api - 2.3.1 - test - - - - - ${project.artifactId} - - - - - io.openliberty.tools - liberty-maven-plugin - 3.3.4 - - - io.openliberty.beta - openliberty-jakartaee9 - 21.0.0.2-beta - zip - - - - - - org.apache.maven.plugins - maven-war-plugin - 3.2.2 - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.2 - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.2 - - - - diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java index 72c591ef..2d7230c0 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java @@ -15,7 +15,10 @@ import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaDiagnostics; +import java.io.File; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.Path; @@ -42,7 +45,7 @@ public void checkForNoDiagnostics() throws Exception { JDTUtils utils = JDT_UTILS; - IJavaProject javaProject = loadJavaProject("jakarta-noDiagnostic-sample", ""); + IJavaProject javaProject = loadJavaProject("demo-servlet-no-diagnostics", ""); IFile javaFile = javaProject.getProject() .getFile(new Path(filePath)); String uri = javaFile.getLocation().toFile().toURI().toString(); @@ -57,62 +60,29 @@ public void checkForNoDiagnostics() throws Exception { // list of java files in demo-servlet-no-diagnostics. @Parameters - public static String[] projectFileProvider() throws Exception { - - String basePath = "src/main/java/io/openliberty/sample/jakarta/"; - String files[] = { basePath + "annotations/GeneratedAnnotation.java", - basePath + "annotations/PostConstructAnnotation.java", - basePath + "annotations/PreDestroyAnnotation.java", - basePath + "annotations/ResourceAnnotation.java", - - basePath + "beanvalidation/FieldConstraintValidation.java", - basePath + "beanvalidation/MethodConstraintValidation.java", - basePath + "beanvalidation/ValidConstraints.java", - - basePath + "cdi/InjectAndDisposesObservesObservesAsync.java", - basePath + "cdi/ManagedBean.java", - basePath + "cdi/ManagedBeanConstructor.java", - basePath + "cdi/MultipleDisposes.java", - basePath + "cdi/ProducesAndDisposesObservesObservesAsync.java", - basePath + "cdi/ProducesAndInjectTogether.java", - basePath + "cdi/ScopeDeclaration.java", - - basePath + "di/Greeting.java", - basePath + "di/MultipleConstructorWithInject.java", - - basePath + "jax_rs/MultipleEntityParamsResourceMethod.java", - basePath + "jax_rs/NoPublicConstructorClass.java", - basePath + "jax_rs/NoPublicConstructorProviderClass.java", - basePath + "jax_rs/NotPublicResourceMethod.java", - basePath + "jax_rs/RootResourceClassConstructorsDiffLen.java", - basePath + "jax_rs/RootResourceClassConstructorsEqualLen.java", - - basePath + "jsonb/ExtraJsonbCreatorAnnotations.java", - basePath + "jsonb/JsonbTransientDiagnostic.java", - - basePath + "jsonp/CreatePointerInvalidTarget.java", - - basePath + "persistence/EntityMissingConstructor.java", - basePath + "persistence/FinalModifiers.java", - basePath + "persistence/MapKeyAndMapKeyClassTogether.java", - basePath + "persistence/MultipleMapKeyAnnotations.java", - - basePath + "servlet/DontExtendHttpServlet.java", - basePath + "servlet/InvalidWebServlet.java", - - basePath + "websocket/AnnotationTest.java", - basePath + "websocket/DuplicateOnMessage.java", - basePath + "websocket/InvalidParamType.java", - basePath + "websocket/ServerEndpointDuplicateVariableURI.java", - basePath + "websocket/ServerEndpointInvalidTemplateURI.java", - basePath + "websocket/ServerEndpointNoSlash.java", - basePath + "websocket/ServerEndpointRelativePathTest.java", - - basePath + "websockets/PathParamURIWarningTest.java" - }; - - return files; - + public static List projectFileProvider() throws Exception { + + String packagePath = "src/main/java/io/openliberty/sample/jakarta/"; + String basePath = System.getProperty("user.dir") + + "/projects/demo-servlet-no-diagnostics/" + packagePath; + + List results = new ArrayList(); + File[] directories = new File(basePath).listFiles(); + // If this pathname does not denote a directory, then listFiles() returns null. + + for (File directory : directories) { + // Check for directory. + if (directory.isDirectory()) { + File[] files = new File(basePath + "/" + directory.getName() + "/").listFiles(); + for (File file : files) { + if (file.isFile()) { + // Add test file path. + results.add(packagePath + directory.getName() + "/" + file.getName()); + } + } + } + + } + return results; } - } From e9be21c332f1ef21635e89dc07730394b8ad272f Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Mon, 17 Jul 2023 18:23:10 +0530 Subject: [PATCH 24/27] Adding .project file of newly generated project --- .../demo-servlet-no-diagnostics/.project | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/.project diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/.project b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/.project new file mode 100644 index 00000000..5ddab1be --- /dev/null +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/.project @@ -0,0 +1,23 @@ + + + demo-servlet-no-diagnostics + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + From 7af7b7557d2488633c5367d07e807e8605177dbb Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Tue, 18 Jul 2023 15:58:15 +0530 Subject: [PATCH 25/27] Used Apache Commons IO for getting the list of java files --- .../demo-servlet-no-diagnostics/pom.xml | 146 +++++++++++------- .../jdt/nodiagnostics/NoDiagnosticsTest.java | 27 ++-- 2 files changed, 104 insertions(+), 69 deletions(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml index 2fba39eb..4fe6d0fd 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/demo-servlet-no-diagnostics/pom.xml @@ -19,57 +19,99 @@ - - junit - junit - 4.11 - test - - + + + jakarta.platform + jakarta.jakartaee-api + 9.0.0 + provided + + + org.eclipse.microprofile + microprofile + 3.3 + pom + provided + + + + junit + junit + 4.12 + test + + + org.apache.cxf + cxf-rt-rs-client + 3.2.6 + test + + + org.apache.cxf + cxf-rt-rs-extension-providers + 3.2.6 + test + + + org.glassfish + javax.json + 1.0.4 + test + + + org.hibernate + hibernate-validator + 7.0.0.Final + + + org.glassfish + jakarta.el + 4.0.0 + + + + javax.xml.bind + jaxb-api + 2.3.1 + test + + - - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - - + + ${project.artifactId} + + + + + io.openliberty.tools + liberty-maven-plugin + 3.3.4 + + + io.openliberty.beta + openliberty-jakartaee9 + 21.0.0.2-beta + zip + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.2.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.2 + + + diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java index 2d7230c0..7154e57a 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java @@ -20,6 +20,7 @@ import java.util.Arrays; import java.util.List; +import org.apache.commons.io.FileUtils; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IJavaProject; @@ -62,27 +63,19 @@ public void checkForNoDiagnostics() throws Exception { @Parameters public static List projectFileProvider() throws Exception { - String packagePath = "src/main/java/io/openliberty/sample/jakarta/"; + String packagePath = "./src/main/java/io/openliberty/sample/jakarta/"; String basePath = System.getProperty("user.dir") - + "/projects/demo-servlet-no-diagnostics/" + packagePath; - + + "/projects/demo-servlet-no-diagnostics/"; + File dir = new File(basePath + packagePath); + String[] extensions = new String[] { "java" }; List results = new ArrayList(); - File[] directories = new File(basePath).listFiles(); - // If this pathname does not denote a directory, then listFiles() returns null. - - for (File directory : directories) { - // Check for directory. - if (directory.isDirectory()) { - File[] files = new File(basePath + "/" + directory.getName() + "/").listFiles(); - for (File file : files) { - if (file.isFile()) { - // Add test file path. - results.add(packagePath + directory.getName() + "/" + file.getName()); - } - } - } + List files = (List) FileUtils.listFiles(dir, extensions, true); + for (File file : files) { + // Get relative path from source folder and add it in the results array. + results.add(file.getAbsolutePath().substring(basePath.length())); } return results; } + } From 5293850e575c048dfabf8363503669258fd57b25 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Wed, 19 Jul 2023 12:30:51 +0530 Subject: [PATCH 26/27] Removed the typecasting. --- .../lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java index 7154e57a..8e14b13f 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java @@ -18,6 +18,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.List; import org.apache.commons.io.FileUtils; @@ -70,7 +71,7 @@ public static List projectFileProvider() throws Exception { String[] extensions = new String[] { "java" }; List results = new ArrayList(); - List files = (List) FileUtils.listFiles(dir, extensions, true); + Collection files = FileUtils.listFiles(dir, extensions, true); for (File file : files) { // Get relative path from source folder and add it in the results array. results.add(file.getAbsolutePath().substring(basePath.length())); From 63eb5929164cc4e9eb4f8ae13e0d8f2e87ca8724 Mon Sep 17 00:00:00 2001 From: Aparna Michael Date: Wed, 19 Jul 2023 12:54:39 +0530 Subject: [PATCH 27/27] removing . from the path --- .../lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java index 8e14b13f..e12afb44 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/nodiagnostics/NoDiagnosticsTest.java @@ -64,7 +64,7 @@ public void checkForNoDiagnostics() throws Exception { @Parameters public static List projectFileProvider() throws Exception { - String packagePath = "./src/main/java/io/openliberty/sample/jakarta/"; + String packagePath = "/src/main/java/io/openliberty/sample/jakarta/"; String basePath = System.getProperty("user.dir") + "/projects/demo-servlet-no-diagnostics/"; File dir = new File(basePath + packagePath);