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] Fix False-positive UnnecessaryFullyQualifiedName when nested and non-nest… by OlegAndreych · Pull Request #4103 · pmd/pmd

Conversation

@OlegAndreych

@OlegAndreych OlegAndreych commented Aug 25, 2022 •
edited by adangel
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

…ed classes with the same name and in the same package are used together #4085

Describe the PR

Additional search and exclusion of inner classes/interfaces with the same simple name as fully qualified class usage is added.

Related issues

  • Fixes [java] UnnecessaryFullyQualifiedName false positive when nested and non-nested classes with the same name and in the same package are used together #4085

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
adangel and others added 30 commits May 13, 2022 19:57
@adangel
[core] Remember forced language per file
1b5f7e8
Fixes pmd#3970
@adangel
Merge branch 'master' into filecollector-language
2cfdc9c
@adangel
[core] Store languageVersion in DataSource
815242a
in order to support FileCollector.addFile with language

Fixes pmd#3970
@adangel @oowekyala
Fixups from review
ca87fe5
Co-authored-by: Clément Fournier <[email protected]>
zon
Added begin and end token attributes to XML output of CPD
91fbcc8
@tprouvot
Add new assert methods for api 56
237b106
@tprouvot
Update @tprouvot as a contributor
2e1d913
@tprouvot
Update @tprouvot as a contributor
2edcfe2
@tprouvot
Update previous negative test which is ok now and add new positive test.
539838c
@tprouvot
Fix contributors
ad21a24
@tprouvot
move fully qualified variant under comment (PR Comment)
a2058c4
@tprouvot
Update method name and number of parameters (PR Comment)
dc03e52
@tprouvot
fix contributors
4180286
@tprouvot @adangel
Update pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/best…
e0b9965
…practices/ApexUnitTestClassShouldHaveAssertsRule.java

Co-authored-by: Andreas Dangel <[email protected]>
@tprouvot @adangel
Update pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule…
d5098ca
…/bestpractices/xml/ApexUnitTestClassShouldHaveAsserts.xml

Co-authored-by: Andreas Dangel <[email protected]>
@tprouvot
Fix typo
50641a5
@tprouvot
PR review comment
2e9f25c
@tprouvot
Add new Assert methods to ApexAssertionsShouldIncludeMessageRule
c61108c
@tprouvot
Merge branch 'pmd:master' into feature/addNewClassForAssertion
d7cf959
@tprouvot
Merge branch 'feature/addNewClassForAssertion' of https://github.com/…
46aa491
…tprouvot/pmd into feature/addNewClassForAssertion
@tprouvot
Add tests for new methods
d6194be
@tprouvot
Update add violation parameters to macth with new tests
ac94df9
@tprouvot
Remove param message not mandatory in this test
065b4b8
@tprouvot
Ad new tests for Assert method class
d73cdcc
@tprouvot
Increase test coverage
29c4e99
@OlegAndreych
False-positive UnnecessaryFullyQualifiedName when nested and non-nest…
f228bfe
…ed classes with the same name and in the same package are used together pmd#4085
@nvuillam
Add MegaLinter in the list of integrations
d6399b0
@adangel
[doc] Update release notes (pmd#4104)
b83ca31
@adangel
Add @nvuillam as a contributor
bb81bd7
@adangel
Merge pull request pmd#4104 from nvuillam:patch-1
563d7b6
[doc] Add MegaLinter in the list of integrations pmd#4104
adangel
adangel requested changes Aug 29, 2022
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 for the PR!

It seems your check "hasSameSimpleNameInScope" is too simple - we now get some false negatives, e.g. the following two unnecessary FQNs are not found anymore:

  • https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityPackageName.java#L24
  • https://github.com/checkstyle/checkstyle/tree/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/classfanoutcomplexity/InputClassFanOutComplexityPackageName.java#L27

You can see the full regression report here: https://chunk.io/pmd/07f9b7da4d404e328741fa9da9340a3d/diff1/index.html

The removed violation all seem to have in common, that they don't have nested classes... only one main class - and this class is referenced via a FQN.

Can you please check these cases?

Sorry, something went wrong.

Uh oh!

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

All reactions
adangel added 5 commits August 30, 2022 19:02
@adangel
Add @pacvz as a contributor
aafd95e
@adangel
[doc] Update release notes (pmd#4095)
504d2ad
@adangel
Merge pull request pmd#4095 from pacvz:master
814ee91
[core] CPD: Added begin and end token to XML reports pmd#4095
@adangel
Merge branch 'master' into filecollector-language
b232ea4
@adangel
Merge pull request pmd#3971 from adangel:filecollector-language
bdde4b7
[core] Remember language when using FileCollector.addFile pmd#3971
@OlegAndreych

OlegAndreych commented Aug 30, 2022

Copy link
Copy Markdown
Contributor Author

Can you please check these cases?

Yes, sure.

All reactions

Sorry, something went wrong.

Uh oh!

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

@OlegAndreych

OlegAndreych commented Aug 31, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

Please help me to reproduce regressions.

I've ran pmdtester locally and haven't got any difference between upstream master and my branch.
The command I ran:

bin/pmdtester -b upstream/master -p master -r ~/devel/pmd
All reactions

Sorry, something went wrong.

Uh oh!

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

adangel and others added 19 commits August 31, 2022 18:34
@adangel
Bump pmd-designer from 6.37.0 to 6.49.0
fe65a6b
@adangel
Prepare pmd release 6.49.0
2329495
@adangel
[maven-release-plugin] prepare release pmd_releases/6.49.0
4b4ebab
@adangel
[maven-release-plugin] prepare for next development iteration
90663d7
@adangel
Prepare next development version [skip ci]
76be7ba
@adangel
Bump pmd from 6.48.0 to 6.49.0
c374d39
@adangel
[html] Bump jsoup from 1.14.3 to 1.15.3
0f99ef0
Fixes https://github.com/pmd/pmd/security/dependabot/23
CVE-2022-36033
GHSA-gp7f-rwcx-9369
@mohan-chinnappan-n
Update TreeExportCli.java
11b7bda
missing --file arg in "Example: ast-dump --format xml --language java --file MyFile.java" added
@mohan-chinnappan-n
Merge pull request pmd#3 from mohan-chinnappan-n/mohan-chinnappan-n-p…
9ebabbe
…atch-1

Update TreeExportCli.java
@adangel
Bump maven-pmd-plugin from 3.18.0 to 3.19.0
9a46adf
@adangel
Bump maven-checkstyle-plugin from 3.1.2 to 3.2.0
1510010
@adangel
Bump checkstyle from 9.3 to 10.3.3
940252b
@adangel
Bump org.yaml:snakeyaml from 1.30 to 1.31
ba26267
Fixes GHSA-3mc7-4q67-w48m
Fixes https://github.com/pmd/pmd/security/dependabot/24
Fixes CVE-2022-25857
@adangel
Add @mohan-chinnappan-n as a contributor
dba3a76
@adangel
[doc] Update release notes (pmd#4116)
91d8930
@adangel
Merge pull request pmd#4116 from mohan-chinnappan-n:master
cb9a660
[core] Fix missing --file arg in TreeExport CLI example pmd#4116
@OlegAndreych
False-positive UnnecessaryFullyQualifiedName when nested and non-nest…
d468125
…ed classes with the same name and in the same package are used together pmd#4085
@OlegAndreych
Merge remote-tracking branch 'origin/master' into origin_master
71b567b
@OlegAndreych
False-positive UnnecessaryFullyQualifiedName when nested and non-nest…
bb46830
…ed classes with the same name and in the same package are used together pmd#4085

* Regression fix;
@OlegAndreych OlegAndreych closed this Sep 18, 2022
@OlegAndreych OlegAndreych mentioned this pull request Sep 18, 2022
[java] Fix False-positive UnnecessaryFullyQualifiedName when nested and non-nest… #4103 #4128
Merged
3 of 4 tasks
adangel added a commit to adangel/pmd that referenced this pull request Sep 29, 2022
@adangel
Merge pull request pmd#4128 from OlegAndreych:Fix_#4103
5a08ad7
[java] Fix False-positive UnnecessaryFullyQualifiedName when nested and non-nest… pmd#4103 pmd#4128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel requested changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[java] UnnecessaryFullyQualifiedName false positive when nested and non-nested classes with the same name and in the same package are used together

Uh oh!

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

5 participants

@OlegAndreych @adangel @tprouvot @nvuillam @mohan-chinnappan-n
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.