From 580b5b9810b94ff0f9f77db4d6d46a238c0592ce Mon Sep 17 00:00:00 2001 From: azerr Date: Fri, 28 Feb 2020 11:30:38 +0100 Subject: [PATCH] Provide hover participant See https://github.com/redhat-developer/quarkus-ls/issues/229 Signed-off-by: azerr --- .../plugin.xml | 39 ++++++++--- .../schema/javaFeatureParticipants.exsd | 28 +++++++- ....java => MicroProfileConfigConstants.java} | 10 +-- .../jdt/core/PropertiesManagerForJava.java | 6 +- .../jdt/core/java/IJavaHoverParticipant.java | 55 +++++++++++++++ .../jdt/core/java/JavaHoverContext.java | 69 +++++++++++++++++++ .../MicroProfileConfigHoverParticipant.java | 50 ++++++++++++++ .../MicroProfileConfigPropertyProvider.java | 12 ++-- .../core/java/JavaFeatureDefinition.java | 47 ++++++++++--- .../core/java/JavaFeaturesRegistry.java | 14 ++-- ...ofileRestClientDiagnosticsParticipant.java | 2 +- .../QuarkusConfigPropertiesProvider.java | 8 +-- 12 files changed, 300 insertions(+), 40 deletions(-) rename microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/{MicroProfileConstants.java => MicroProfileConfigConstants.java} (82%) create mode 100644 microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/IJavaHoverParticipant.java create mode 100644 microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/JavaHoverContext.java create mode 100644 microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/java/MicroProfileConfigHoverParticipant.java rename microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/{core/providers => config/properties}/MicroProfileConfigPropertyProvider.java (87%) diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/plugin.xml b/microprofile.jdt/com.redhat.microprofile.jdt.core/plugin.xml index 4fd529434..0c2894f49 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/plugin.xml +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/plugin.xml @@ -36,26 +36,47 @@ + + + + + + + - + + + + + + + + + + + - - + + - - - - - + + + + + + + + + + - diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/schema/javaFeatureParticipants.exsd b/microprofile.jdt/com.redhat.microprofile.jdt.core/schema/javaFeatureParticipants.exsd index 8b0a40968..cb130e35b 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/schema/javaFeatureParticipants.exsd +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/schema/javaFeatureParticipants.exsd @@ -19,7 +19,8 @@ - + + @@ -69,6 +70,26 @@ + + + + Java hover participant. + + + + + + + Name of a class that implements IJavaHoverParticipant. + + + + + + + + + @@ -86,7 +107,10 @@ The following is an example of a java feature participant extension: <pre> - <extension point="com.redhat.quarkus.jdt.core.javaFeatureParticipants"> + <extension point="com.redhat.microprofile.jdt.core.javaFeatureParticipants"> + <hover + class="com.example.MyJavaHoverParticipant"> + </hover> <diagnostics class="com.example.MyJavaDiagnosticsParticipant"> </diagnostics> diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/MicroProfileConstants.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/MicroProfileConfigConstants.java similarity index 82% rename from microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/MicroProfileConstants.java rename to microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/MicroProfileConfigConstants.java index 7fd3e745f..53b81efb0 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/MicroProfileConstants.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/MicroProfileConfigConstants.java @@ -4,24 +4,26 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v20.html * +* SPDX-License-Identifier: EPL-2.0 +* * Contributors: * Red Hat Inc. - initial API and implementation *******************************************************************************/ package com.redhat.microprofile.jdt.core; /** - * MicroProfile constants + * MicroProfile Config constants * * @author Angelo ZERR * */ -public class MicroProfileConstants { +public class MicroProfileConfigConstants { - private MicroProfileConstants() { + private MicroProfileConfigConstants() { } public static final String INJECT_ANNOTATION = "javax.inject.Inject"; - + // MicroProfile Core annotations public static final String CONFIG_PROPERTY_ANNOTATION = "org.eclipse.microprofile.config.inject.ConfigProperty"; diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/PropertiesManagerForJava.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/PropertiesManagerForJava.java index c3984ff12..a0f672b0a 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/PropertiesManagerForJava.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/PropertiesManagerForJava.java @@ -277,7 +277,7 @@ public MicroProfileJavaHoverInfo hover(MicroProfileJavaHoverParams params, IJDTU IField hoverField = (IField) hoverElement; - IAnnotation annotation = getAnnotation(hoverField, MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION); + IAnnotation annotation = getAnnotation(hoverField, MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION); if (annotation == null) { return null; @@ -285,7 +285,7 @@ public MicroProfileJavaHoverInfo hover(MicroProfileJavaHoverParams params, IJDTU String annotationSource = ((ISourceReference) annotation).getSource(); String propertyKey = getAnnotationMemberValue(annotation, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION_NAME); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION_NAME); if (propertyKey == null) { return null; @@ -310,7 +310,7 @@ public MicroProfileJavaHoverInfo hover(MicroProfileJavaHoverParams params, IJDTU .getProperty(propertyKey, null); if (propertyValue == null) { propertyValue = getAnnotationMemberValue(annotation, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION_DEFAULT_VALUE); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION_DEFAULT_VALUE); if (propertyValue != null && propertyValue.length() == 0) { propertyValue = null; } diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/IJavaHoverParticipant.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/IJavaHoverParticipant.java new file mode 100644 index 000000000..860d1695d --- /dev/null +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/IJavaHoverParticipant.java @@ -0,0 +1,55 @@ +/******************************************************************************* +* Copyright (c) 2020 Red Hat Inc. and others. +* All rights reserved. This program and the accompanying materials +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* Red Hat Inc. - initial API and implementation +*******************************************************************************/ +package com.redhat.microprofile.jdt.core.java; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.core.JavaModelException; + +/** + * Java hover participants API. + * + * @author Angelo ZERR + * + */ +public interface IJavaHoverParticipant { + + /** + * Returns true if hover must be collected for the given context and false + * otherwise. + * + *

+ * Collection is done by default. Participants can override this to check if + * some classes are on the classpath before deciding to process the collection. + *

+ * + * @param the java hover context + * @param monitor the progress monitor + * @return true if hover must be collected for the given context and false + * otherwise. + * @throws JavaModelException + */ + default boolean isAdaptedForHover(JavaHoverContext context, IProgressMonitor monitor) throws JavaModelException { + return true; + } + + /** + * Collect hover according to the context. + * + * @param context the java hover context + * @param monitor the progress monitor + * @throws JavaModelException + * @throws CoreException + */ + void collectHover(JavaHoverContext context, IProgressMonitor monitor) throws JavaModelException, CoreException; + +} diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/JavaHoverContext.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/JavaHoverContext.java new file mode 100644 index 000000000..a8ef538c3 --- /dev/null +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/core/java/JavaHoverContext.java @@ -0,0 +1,69 @@ +/******************************************************************************* +* Copyright (c) 2020 Red Hat Inc. and others. +* All rights reserved. This program and the accompanying materials +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* Red Hat Inc. - initial API and implementation +*******************************************************************************/ +package com.redhat.microprofile.jdt.core.java; + +import java.util.List; + +import org.eclipse.jdt.core.ITypeRoot; +import org.eclipse.lsp4j.Diagnostic; +import org.eclipse.lsp4j.DiagnosticSeverity; +import org.eclipse.lsp4j.Range; + +import com.redhat.microprofile.commons.DocumentFormat; +import com.redhat.microprofile.jdt.core.utils.IJDTUtils; + +/** + * Java hover context for a given compilation unit. + * + * @author Angelo ZERR + * + */ +public class JavaHoverContext extends AbtractJavaContext { + + private final List hover; + + private final DocumentFormat documentFormat; + + public JavaHoverContext(String uri, ITypeRoot typeRoot, IJDTUtils utils, DocumentFormat documentFormat, + List hover) { + super(uri, typeRoot, utils); + this.hover = hover; + this.documentFormat = documentFormat; + } + + public List getHover() { + return hover; + } + + public DocumentFormat getDocumentFormat() { + return documentFormat; + } + + public Diagnostic addDiagnostic(String uri, String message, Range range, String source, IJavaErrorCode code) { + Diagnostic diagnostic = createDiagnostic(uri, message, range, source, code); + getHover().add(diagnostic); + return diagnostic; + } + + private Diagnostic createDiagnostic(String uri, String message, Range range, String source, IJavaErrorCode code) { + Diagnostic diagnostic = new Diagnostic(); + diagnostic.setSource(source); + diagnostic.setMessage(message); + diagnostic.setSeverity(DiagnosticSeverity.Warning); + diagnostic.setRange(range); + if (code != null) { + diagnostic.setCode(code.getCode()); + } + return diagnostic; + } + +} diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/java/MicroProfileConfigHoverParticipant.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/java/MicroProfileConfigHoverParticipant.java new file mode 100644 index 000000000..6d88f40c9 --- /dev/null +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/java/MicroProfileConfigHoverParticipant.java @@ -0,0 +1,50 @@ +/******************************************************************************* +* Copyright (c) 2020 Red Hat Inc. and others. +* All rights reserved. This program and the accompanying materials +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* Red Hat Inc. - initial API and implementation +*******************************************************************************/ +package com.redhat.microprofile.jdt.internal.config.java; + +import static com.redhat.microprofile.jdt.core.MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.ITypeRoot; +import org.eclipse.jdt.core.JavaModelException; + +import com.redhat.microprofile.jdt.core.java.IJavaHoverParticipant; +import com.redhat.microprofile.jdt.core.java.JavaHoverContext; +import com.redhat.microprofile.jdt.core.utils.JDTTypeUtils; + +/** + * + * MicroProfile Config Hover + * + * @author Angelo ZERR + * + * @See https://github.com/eclipse/microprofile-config + * + */ +public class MicroProfileConfigHoverParticipant implements IJavaHoverParticipant { + + @Override + public boolean isAdaptedForHover(JavaHoverContext context, IProgressMonitor monitor) throws JavaModelException { + // Hover is done only if microprofile-config is on the classpath + IJavaProject javaProject = context.getJavaProject(); + return JDTTypeUtils.findType(javaProject, CONFIG_PROPERTY_ANNOTATION) != null; + } + + @Override + public void collectHover(JavaHoverContext context, IProgressMonitor monitor) throws CoreException { + ITypeRoot typeRoot = context.getTypeRoot(); + IJavaElement[] elements = typeRoot.getChildren(); + } +} diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/providers/MicroProfileConfigPropertyProvider.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/properties/MicroProfileConfigPropertyProvider.java similarity index 87% rename from microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/providers/MicroProfileConfigPropertyProvider.java rename to microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/properties/MicroProfileConfigPropertyProvider.java index 3e161fdfa..811104be2 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/providers/MicroProfileConfigPropertyProvider.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/config/properties/MicroProfileConfigPropertyProvider.java @@ -4,10 +4,12 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v20.html * +* SPDX-License-Identifier: EPL-2.0 +* * Contributors: * Red Hat Inc. - initial API and implementation *******************************************************************************/ -package com.redhat.microprofile.jdt.internal.core.providers; +package com.redhat.microprofile.jdt.internal.config.properties; import static com.redhat.microprofile.jdt.core.utils.AnnotationUtils.getAnnotationMemberValue; import static com.redhat.microprofile.jdt.core.utils.JDTTypeUtils.findType; @@ -26,7 +28,7 @@ import com.redhat.microprofile.jdt.core.AbstractAnnotationTypeReferencePropertiesProvider; import com.redhat.microprofile.jdt.core.IPropertiesCollector; -import com.redhat.microprofile.jdt.core.MicroProfileConstants; +import com.redhat.microprofile.jdt.core.MicroProfileConfigConstants; import com.redhat.microprofile.jdt.core.SearchContext; /** @@ -39,7 +41,7 @@ */ public class MicroProfileConfigPropertyProvider extends AbstractAnnotationTypeReferencePropertiesProvider { - private static final String[] ANNOTATION_NAMES = { MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION }; + private static final String[] ANNOTATION_NAMES = { MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION }; @Override protected String[] getAnnotationNames() { @@ -52,7 +54,7 @@ protected void processAnnotation(IJavaElement javaElement, IAnnotation configPro if (javaElement.getElementType() == IJavaElement.FIELD) { IPropertiesCollector collector = context.getCollector(); String name = getAnnotationMemberValue(configPropertyAnnotation, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION_NAME); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION_NAME); if (name != null && !name.isEmpty()) { IField field = (IField) javaElement; String fieldTypeName = getResolvedTypeName(field); @@ -63,7 +65,7 @@ protected void processAnnotation(IJavaElement javaElement, IAnnotation configPro String sourceType = getSourceType(field); String sourceField = getSourceField(field); String defaultValue = getAnnotationMemberValue(configPropertyAnnotation, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION_DEFAULT_VALUE); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION_DEFAULT_VALUE); String extensionName = null; // Enumerations diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeatureDefinition.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeatureDefinition.java index f63e5b480..c32c48a88 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeatureDefinition.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeatureDefinition.java @@ -4,6 +4,8 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v20.html * +* SPDX-License-Identifier: EPL-2.0 +* * Contributors: * Red Hat Inc. - initial API and implementation *******************************************************************************/ @@ -12,34 +14,63 @@ import java.util.logging.Level; import java.util.logging.Logger; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.core.JavaModelException; import com.redhat.microprofile.jdt.core.java.IJavaDiagnosticsParticipant; +import com.redhat.microprofile.jdt.core.java.IJavaHoverParticipant; import com.redhat.microprofile.jdt.core.java.JavaDiagnosticsContext; +import com.redhat.microprofile.jdt.core.java.JavaHoverContext; /** - * Wrapper class around {@link IJavaDiagnosticsParticipant}. + * Wrapper class around java participants : + * + *
    + *
  • {@link IJavaHoverParticipant}.
  • + *
  • {@link IJavaDiagnosticsParticipant}.
  • + *
* */ -public class JavaFeatureDefinition implements IJavaDiagnosticsParticipant { +public class JavaFeatureDefinition implements IJavaHoverParticipant, IJavaDiagnosticsParticipant { private static final Logger LOGGER = Logger.getLogger(JavaFeatureDefinition.class.getName()); - private final IJavaDiagnosticsParticipant collector; - public JavaFeatureDefinition(IJavaDiagnosticsParticipant collector) { - this.collector = collector; + private final IJavaHoverParticipant hoverParticipant; + private final IJavaDiagnosticsParticipant diagnosticsParticipant; + + public JavaFeatureDefinition(IJavaHoverParticipant hoverParticipant, + IJavaDiagnosticsParticipant diagnosticsParticipant) { + this.hoverParticipant = hoverParticipant; + this.diagnosticsParticipant = diagnosticsParticipant; + } + + @Override + public void collectHover(JavaHoverContext context, IProgressMonitor monitor) + throws JavaModelException, CoreException { + if (hoverParticipant == null) { + return; + } + try { + if (hoverParticipant.isAdaptedForHover(context, monitor)) { + hoverParticipant.collectHover(context, monitor); + } + } catch (Exception e) { + LOGGER.log(Level.SEVERE, "Error while collecting hover", e); + } } @Override public void collectDiagnostics(JavaDiagnosticsContext context, IProgressMonitor monitor) { - if (collector == null) { + if (diagnosticsParticipant == null) { return; } try { - if (collector.isAdaptedForDiagnostics(context, monitor)) { - collector.collectDiagnostics(context, monitor); + if (diagnosticsParticipant.isAdaptedForDiagnostics(context, monitor)) { + diagnosticsParticipant.collectDiagnostics(context, monitor); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Error while collecting diagnostics", e); } } + } diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeaturesRegistry.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeaturesRegistry.java index f214bcd92..a588cda17 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeaturesRegistry.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/core/java/JavaFeaturesRegistry.java @@ -21,6 +21,7 @@ import com.redhat.microprofile.jdt.core.MicroProfileCorePlugin; import com.redhat.microprofile.jdt.core.java.IJavaDiagnosticsParticipant; +import com.redhat.microprofile.jdt.core.java.IJavaHoverParticipant; /** * Registry to hold the extension point @@ -29,9 +30,10 @@ */ public class JavaFeaturesRegistry { - private static final String CLASS_ATTR = "class"; - private static final String DIAGNOSTICS_ELT = "diagnostics"; private static final String EXTENSION_JAVA_FEATURE_PARTICIPANTS = "javaFeatureParticipants"; + private static final String DIAGNOSTICS_ELT = "diagnostics"; + private static final String HOVER_ELT = "hover"; + private static final String CLASS_ATTR = "class"; private static final Logger LOGGER = Logger.getLogger(JavaFeaturesRegistry.class.getName()); @@ -89,9 +91,13 @@ private void addJavaFeatureDefinition(IConfigurationElement[] cf) { private static JavaFeatureDefinition createDefinition(IConfigurationElement ce) throws CoreException { switch (ce.getName()) { + case HOVER_ELT: + IJavaHoverParticipant hoverParticipant = (IJavaHoverParticipant) ce.createExecutableExtension(CLASS_ATTR); + return new JavaFeatureDefinition(hoverParticipant, null); case DIAGNOSTICS_ELT: - IJavaDiagnosticsParticipant collector = (IJavaDiagnosticsParticipant) ce.createExecutableExtension(CLASS_ATTR); - return new JavaFeatureDefinition(collector); + IJavaDiagnosticsParticipant diagnosticsParticipant = (IJavaDiagnosticsParticipant) ce + .createExecutableExtension(CLASS_ATTR); + return new JavaFeatureDefinition(null, diagnosticsParticipant); default: return null; } diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/restclient/java/MicroProfileRestClientDiagnosticsParticipant.java b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/restclient/java/MicroProfileRestClientDiagnosticsParticipant.java index b477bf949..7bb99a8db 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/restclient/java/MicroProfileRestClientDiagnosticsParticipant.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.core/src/main/java/com/redhat/microprofile/jdt/internal/restclient/java/MicroProfileRestClientDiagnosticsParticipant.java @@ -9,7 +9,7 @@ *******************************************************************************/ package com.redhat.microprofile.jdt.internal.restclient.java; -import static com.redhat.microprofile.jdt.core.MicroProfileConstants.INJECT_ANNOTATION; +import static com.redhat.microprofile.jdt.core.MicroProfileConfigConstants.INJECT_ANNOTATION; import static com.redhat.microprofile.jdt.internal.restclient.MicroProfileRestClientConstants.REGISTER_REST_CLIENT_ANNOTATION; import static com.redhat.microprofile.jdt.internal.restclient.MicroProfileRestClientConstants.REST_CLIENT_ANNOTATION; diff --git a/microprofile.jdt/com.redhat.microprofile.jdt.quarkus/src/main/java/com/redhat/microprofile/jdt/internal/quarkus/providers/QuarkusConfigPropertiesProvider.java b/microprofile.jdt/com.redhat.microprofile.jdt.quarkus/src/main/java/com/redhat/microprofile/jdt/internal/quarkus/providers/QuarkusConfigPropertiesProvider.java index 03c6665a4..b2f674f34 100644 --- a/microprofile.jdt/com.redhat.microprofile.jdt.quarkus/src/main/java/com/redhat/microprofile/jdt/internal/quarkus/providers/QuarkusConfigPropertiesProvider.java +++ b/microprofile.jdt/com.redhat.microprofile.jdt.quarkus/src/main/java/com/redhat/microprofile/jdt/internal/quarkus/providers/QuarkusConfigPropertiesProvider.java @@ -50,7 +50,7 @@ import com.redhat.microprofile.commons.metadata.ItemMetadata; import com.redhat.microprofile.jdt.core.AbstractAnnotationTypeReferencePropertiesProvider; import com.redhat.microprofile.jdt.core.IPropertiesCollector; -import com.redhat.microprofile.jdt.core.MicroProfileConstants; +import com.redhat.microprofile.jdt.core.MicroProfileConfigConstants; import com.redhat.microprofile.jdt.core.SearchContext; import com.redhat.microprofile.jdt.core.project.JDTMicroProfileProjectManager; import com.redhat.microprofile.jdt.internal.quarkus.JDTQuarkusUtils; @@ -187,12 +187,12 @@ private void processConfigProperties(IJavaElement javaElement, IAnnotation confi String name = null; String defaultValue = null; IAnnotation configPropertyAnnotation = getAnnotation(method, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION); if (configPropertyAnnotation != null) { name = getAnnotationMemberValue(configPropertyAnnotation, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION_NAME); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION_NAME); defaultValue = getAnnotationMemberValue(configPropertyAnnotation, - MicroProfileConstants.CONFIG_PROPERTY_ANNOTATION_DEFAULT_VALUE); + MicroProfileConfigConstants.CONFIG_PROPERTY_ANNOTATION_DEFAULT_VALUE); } if (name == null) { name = getPropertyNameFromMethodName(method);