diff --git a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/src/main/java/org/eclipse/lsp4jakarta/jdt/core/jax_rs/ResourceMethodDiagnosticsCollector.java b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/src/main/java/org/eclipse/lsp4jakarta/jdt/core/jax_rs/ResourceMethodDiagnosticsCollector.java index 4f4cdaf2..703f021f 100644 --- a/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/src/main/java/org/eclipse/lsp4jakarta/jdt/core/jax_rs/ResourceMethodDiagnosticsCollector.java +++ b/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/src/main/java/org/eclipse/lsp4jakarta/jdt/core/jax_rs/ResourceMethodDiagnosticsCollector.java @@ -53,17 +53,20 @@ public void collectDiagnostics(ICompilationUnit unit, List diagnosti alltypes = unit.getAllTypes(); for (IType type : alltypes) { methods = type.getMethods(); + boolean isInterface = type.isInterface(); + for (IMethod method : methods) { IAnnotation[] methodAnnotations = method.getAnnotations(); boolean isResourceMethod = false; boolean isValid = true; boolean isPublic = Flags.isPublic(method.getFlags()); + boolean usesDfltAccessModifier = Flags.isPackageDefault(method.getFlags()); for (IAnnotation annotation : methodAnnotations) { String matchedAnnotation = getMatchedJavaElementName(type, annotation.getElementName(), methodDesignators); if (matchedAnnotation != null) { - if (isValid && !isPublic) + if (isValid && !isPublic && !(usesDfltAccessModifier && isInterface) ) isValid = false; if (!Jax_RSConstants.PATH_ANNOTATION.equals(matchedAnnotation)) { isResourceMethod = true;