Home

Awesome

Eclipse LSP4Jakarta - Language Server for Jakarta EE

License Build Gitter

The Eclipse LSP4Jakarta (Language Server for Jakarta EE) project provides language support capabilities for the specifications defined under the Jakarta EE umbrella. It adheres to the language server protocol.

This project contains:

<img src="/docs/images/components.png" alt="component diagram" height="80%" width="80%"/>

Table of Contents


Client IDEs

Eclipse LSP4Jakarta is consumed by the following client IDEs.

Submit a PR to have your tools that use Eclipse LSP4Jakarta listed.

Features

The language features currently offered by Eclipse LSP4Jakarta to Jakarta EE APIs are code snippets, diagnostics, and quick-fixes.

Code snippets help you quickly generate common blocks of code.

Eclipse LSP4Jakarta code snippet to generate a new RESTful web services GET method

Diagnostics indicate incorrect API usage and suggest associated quick-fixes to correct API usage.

Eclipse LSP4Jakarta diagnostic and quick-fix for invalid RESTful web services usage

The following is a list of Eclipse LSP4Jakarta language features offered for each Jakarta EE API. Language features will only be delivered for a given Jakarta EE API if that API is found on the project's class path. Eclipse LSP4Jakarta is currently targeting Jakarta EE 9/9.1 (jakarta.* namespace).

If you would like to see language feature assistance for a Jakarta EE API that is not yet listed here, please open an issue on the issue tracker.

Jakarta Annotations

Eclipse LSP4Jakarta provides the following Jakarta Annotations diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
The @Generated annotation must define the 'date' attribute following the ISO 8601 standard.ErrorN/A
The @Resource annotation must define the attribute 'type' when applied on a class.ErrorAdd type to jakarta.annotation.Resource
The @Resource annotation must define the attribute 'name' when applied on a class.ErrorAdd name to jakarta.annotation.Resource
A method with the @PostConstruct annotation must be voidErrorChange return type to void
A method with the @PreDestroy annotation must not be static.ErrorN/A
A method with the @PostConstruct/@PreDestroy annotation must not have any parameters.ErrorRemove @PostConstruct/@PreDestroy OR Remove all parameters
A method with the @PostConstruct/@PreDestroy annotation must not throw checked exceptions.WarningN/A

Jakarta Bean Validation

Eclipse LSP4Jakarta provides the following Jakarta Bean Validation snippets.

Snippet prefixDescription
@EmailEmail address constraint, which validates a well-formed email address

Eclipse LSP4Jakarta provides the following Jakarta Bean Validation diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
Constraint annotations are not allowed on static fields or methods.ErrorRemove the constraint annotation OR Remove the static modifier
The @AssertTrue/@AssertFalse annotation can only be used on boolean and Boolean type fields or methods.ErrorRemove @AssertTrue/@AssertFalse
The @DecimalMax/@DecimalMin/@Digits annotation can only be used on: BigDecimal, BigInteger, CharSequence, byte, short, int, long (and their respective wrappers) type fields or methods.ErrorRemove @DecimalMax/@DecimalMin/@Digits
The @Email annotation can only be used on String and CharSequence type fields or methods.ErrorRemove @Email
The @Future/@FutureOrPresent/@Past/@PastOrPresent annotation can only be used on: Date, Calendar, Instant, LocalDate, LocalDateTime, LocalTime, MonthDay, OffsetDateTime, OffsetTime, Year, YearMonth, ZonedDateTime, HijrahDate, JapaneseDate, JapaneseDate, MinguoDate and ThaiBuddhistDate type fields or methods.ErrorRemove @Future/@FutureOrPresent/@Past/@PastOrPresent
The @Min/@Max annotation can only be used on BigDecimal, BigInteger, byte, short, int, long (and their respective wrappers) type fields or methods.ErrorRemove @Min/@Max
The @Negative/@NegativeOrZero/@Positive/@PositiveOrZero annotation can only be used on BigDecimal, BigInteger, byte, short, int, long, float, double (and their respective wrappers) type fields or methods.ErrorRemove @Negative/@NegativeOrZero/@Positive/@PositiveOrZero
The @NotBlank/@Pattern annotation can only be used on String and CharSequence type fields or methods.ErrorRemove @NotBlank/@Pattern

Jakarta Contexts and Dependency Injection

Eclipse LSP4Jakarta provides the following Jakarta Contexts and Dependency Injection diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
A bean constructor or a method annotated with @Inject cannot have parameter(s) annotated with @Disposes/@Observes/@ObservesAsyncErrorRemove @Inject OR Remove the '@Disposes/@Observes/@ObservesAsync' modifier from parameter 'parameter_name'
A producer method cannot have parameter(s) annotated with @Disposes/@Observes/@ObservesAsyncErrorRemove @Produces OR Remove the '@Disposes/@Observes/@ObservesAsync' modifier from parameter 'parameter_name'
The @Disposes annotation must not be defined on more than one parameter of a method.ErrorN/A
Managed bean class of generic type must have scope @DependentErrorReplace current scope with @Dependent
The @Dependent annotation must be the only scope defined by a managed bean with a non-static public field.ErrorReplace current scope with @Dependent
The @Inject annotation must define a managed bean constructor that takes parameters, or the managed bean must resolve to having a no-arg constructor instead.ErrorInsert @Inject OR Add a no-arg protected constructor to this class OR Add a no-arg public constructor to this class.
The @Produces and @Inject annotations must not be used on the same field or property.ErrorRemove @Produces OR @Inject
Scope type annotations must be specified by a managed bean class/producer field or method at most once.ErrorN/A

Jakarta Dependency Injection

Eclipse LSP4Jakarta provides the following Jakarta Dependency Injection diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
The @Inject annotation must not define a final method.ErrorRemove @Inject OR Remove the 'final' modifier from this field
The @Inject annotation must not define a final/abstract/static method.ErrorRemove @Inject OR Remove the 'final/asbtract/static' modifier from this method
The @Inject annotation must not define a generic method.ErrorRemove @Inject
The @Inject annotation must not define more than one constructor.ErrorRemove @Inject

Jakarta JSON Binding

Eclipse LSP4Jakarta provides the following Jakarta JSON Binding diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
Only one constructor or static factory method can be annotated with @JsonbCreator in a given class.ErrorRemove @JsonbCreator
When a class field is annotated with @JsonbTransient, this field, getter or setter must not be annotated with other JSON Binding annotations.ErrorRemove @JsonbTransient OR Remove @JsonbProperty/@JsonbAnnotation
When an accessor is annotated with @JsonbTransient, its field or the accessor must not be annotated with other JSON Binding annotations.ErrorRemove @JsonbTransient OR Remove @JsonbProperty/@JsonbAnnotation

Jakarta JSON Processing

Eclipse LSP4Jakarta provides the following Jakarta JSON Processing diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
Json.createPointer target must be a sequence of '/' prefixed tokens or an empty StringErrorN/A

Jakarta Persistence

Eclipse LSP4Jakarta provides the following Jakarta Persistence snippets.

Snippet prefixDescription
persist_contextEntity manager injection and associated persistence context
persist_context_extendedEntity manager injection with extended persistence context
persist_context_extended_unsyncEntity manager injection with extended, unsynchronized persistence context
persist_entityGeneric persistence entity model. Only available in an empty file.

Eclipse LSP4Jakarta provides the following Jakarta Persistence diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
A class using the @Entity annotation must contain a public or protected constructor with no arguments.ErrorAdd a no-arg protected constructor to this class OR Add a no-arg public constructor to this class
A class using the @Entity annotation must not be final.ErrorRemove the 'final' modifier from this class
A class using the @Entity annotation cannot contain any methods that are declared finalErrorRemove the 'final' modifier from this method
A class using the @Entity annotation cannot contain any persistent instance variables that are declared finalErrorRemove the 'final' modifier from this field
@MapKeyClass and @MapKey annotations cannot be used on the same field or propertyErrorRemove @MapKeyClass OR Remove @MapKey
A field with multiple @MapKeyJoinColumn annotations must specify both the name and referencedColumnName attributes in the corresponding @MapKeyJoinColumn annotations.ErrorAdd the missing attributes to the @MapKeyJoinColumn annotation

Jakarta RESTful Web Services

Eclipse LSP4Jakarta provides the following Jakarta RESTful Web Services snippets.

Snippet prefixDescription
rest_classResource class with GET resource method. Only available in an empty file.
rest_getGET resource method
rest_postPOST resource method
rest_putPUT resource method
rest_deleteDELETE resource method
rest_headHEAD resource method

Eclipse LSP4Jakarta provides the following Jakarta RESTful Web Services diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
Resource methods cannot have more than one entity parameter.ErrorRemove all entity parameters except 'entity_param_name'
Provider/Root resource classes are instantiated by the JAX-RS runtime and MUST have a public constructor.ErrorMake constructor public OR Add a no-arg public constructor to this class
Only public methods can be exposed as resource methods.ErrorMake method public
This constructor is unused, as root resource classes will only use the constructor with the most parameters.WarningN/A
Multiple constructors have the same number of parameters, it might be ambiguous which constructor is used.WarningN/A

Jakarta Servlet

Eclipse LSP4Jakarta provides the following Jakarta Servlet snippets. All these snippets are only available in an empty file.

Snippet prefixDescription
servlet_genericGeneric protocol independent servlet
servlet_dogetHTTPServlet with GET request
servlet_dopostHTTPServlet with POST request
servlet_webfilterServlet WebFilter

Eclipse LSP4Jakarta provides the following Jakarta Servlet diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
Annotated classes with @WebServlet must extend the HttpServlet class.ErrorLet 'class_name' extend 'HttpServlet'
The @WebServlet annotation must define the attribute 'urlPatterns' or 'value'.ErrorAdd the 'value' attribute to @WebServlet OR Add the 'urlPatterns' attribute to @WebServlet

Jakarta Transactions

Eclipse LSP4Jakarta provides the following Jakarta Transactions snippets.

Snippet prefixDescription
tx_user_injectInitializes a UserTransaction object via injection
tx_user_jndiInitializes a UserTransaction object via JNDI lookup
@TransactionalTransactional annotation with rollbackOn and dontRollbackOn

Jakarta WebSocket

Eclipse LSP4Jakarta provides the following Jakarta WebSocket diagnostics.

Diagnostic descriptionSeverityAssociated quick-fixes
Parameters of type String, any Java primitive type, or boxed version thereof must be annotated with @PathParams.ErrorInsert @PathParam
Classes annotated with @ServerEndpoint or @ClientEndpoint must have only one @OnMessage annotated method for each of the native WebSocket message formats: text, binary and pong.ErrorN/A
Invalid parameter type. When using @OnOpen, parameter must be of type: jakarta.websocket.EndpointConfig, jakarta.websocket.Session, annotated with @PathParams and of type String or any Java primitive type or boxed version thereof.ErrorN/A
Invalid parameter type. When using @OnClose, parameter must be of type: jakarta.websocket.CloseReason, jakarta.websocket.Session, annotated with @PathParams and of type String or any Java primitive type or boxed version thereof.ErrorN/A
Server endpoint paths must not use the same variable more than once in a path.ErrorN/A
Server endpoint paths must be a URI-template (level-1) or a partial URI.ErrorN/A
Server endpoint paths must start with a leading '/'.ErrorN/A
Server endpoint paths must not contain the sequences '/../', '/./' or '//'.ErrorN/A

Contributing

See the DEVELOPING and CONTRIBUTING documents for more details.

License

Eclipse Public License - v 2.0 See LICENSE file.

Feedback

Please report bugs, issues and feature requests by creating a GitHub issue.