GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Ignore AddEmptyString rule in annotations by smyachenkov · Pull Request #3549 · pmd/pmd

Conversation

@smyachenkov

@smyachenkov smyachenkov commented Oct 9, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Describe the PR

Ignore AddEmptyString rule in annotations. In Java, value that is used in annotation, must be a constant. There are cases when creation of such a constant can only be achieved by converting it into String using addition of an empty string.

Code example:

class Foo{
  private static final int VERSION = 1;

  @Deprecated(since = "" + VERSION)
  public void foo() {
  }
}

I suggest to exclude this case from the rule.

Related issues

  • Fixes [java] AddEmptyString false positive in annotation value #2364

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
smyachenkov added 2 commits October 9, 2021 16:37
@smyachenkov
Ignore AddEmptyString rule in annotations
83dfeb5
@smyachenkov
update testcase
becd447
@adangel adangel changed the title [Java] Ignore AddEmptyString rule in annotations [java] Ignore AddEmptyString rule in annotations Oct 10, 2021
@adangel adangel added this to the 6.40.0 milestone Oct 10, 2021
@adangel adangel self-assigned this Oct 10, 2021
adangel
adangel approved these changes Oct 10, 2021
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks fine!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost

ghost commented Oct 10, 2021

Copy link
Copy Markdown
1 Message
📖 This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 3 configuration errors.
Full report

Generated by 🚫 Danger

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adangel

adangel commented Oct 14, 2021

Copy link
Copy Markdown
Member

@all-contributors please add @smyachenkov for code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allcontributors allcontributors Bot mentioned this pull request Oct 14, 2021
docs: add smyachenkov as a contributor for code #3554
Merged
@allcontributors

allcontributors Bot commented Oct 14, 2021

Copy link
Copy Markdown
Contributor

@adangel

I've put up a pull request to add @smyachenkov! 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adangel added a commit to adangel/pmd that referenced this pull request Oct 14, 2021
@adangel
[doc] Update release notes (pmd#2364, pmd#3549)
ae877b3
adangel added a commit to adangel/pmd that referenced this pull request Oct 14, 2021
@adangel
Merge pull request pmd#3549 from
eb1f30c
smyachenkov:addemptystring-anotations-ignore

[java] Ignore AddEmptyString rule in annotations pmd#3549
@adangel
adangel merged commit becd447 into pmd:master Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@adangel adangel

Labels

None yet

Projects

None yet

Milestone

6.40.0

Development

Successfully merging this pull request may close these issues.

[java] AddEmptyString false positive in annotation value

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@smyachenkov @adangel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.