Skip to content

Use javax.validation for null annotations #418

Description

The HtmlRenderer class uses the following annotations:

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

From a purely stylistic standpoint, when possible we should seek to use pure Java annotations. Equivalent functionality is provided by the Validation API.

The dependency on JetBrains' library will leak into code that implements extensions, such as:

public class BlockExtension implements HtmlRenderer.HtmlRendererExtension {
  public static class IdAttributeProvider implements AttributeProvider {
    private static AttributeProviderFactory createFactory() {
      return new IndependentAttributeProviderFactory() {
        @Override
        public @NotNull AttributeProvider apply(
            @NotNull final LinkResolverContext context ) {
          return new IdAttributeProvider();
...

Please consider using javax.validation.constraints.NotNull and other annotations from the javax package, instead, if possible.

See also: https://stackoverflow.com/a/42695253/59087

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions