Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: make private class final with default constructor #2407

Merged
merged 1 commit into from Apr 15, 2023

Conversation

Kevin222004
Copy link
Contributor

minor: make private class final with default constructor

This is part of checkstyle/checkstyle#12737

According to the https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.8.9 The default constructor has the same access modifier as the class.
and according to the check https://checkstyle.org/config_design.html#FinalClass a class that has only private constructors and has no descendant classes is declared as final.

@Kevin222004
Copy link
Contributor Author

I have given information on this changes in description.

can we have your valuable feedback on this changes.

@hazendaz
Copy link
Member

@Kevin222004 I'm taking a look, in future though, there is no reason to open a PR then immediately ask for an update on it. We get emailed on these and it just sends needless emails doing that. Its better to just open it, describe it well and leave it at that. Thanks.

@hazendaz hazendaz self-assigned this Apr 15, 2023
@hazendaz hazendaz merged commit 9570429 into spotbugs:master Apr 15, 2023
4 checks passed
@Kevin222004
Copy link
Contributor Author

@hazendaz we need your feedback on these changes.

@Kevin222004
Copy link
Contributor Author

What do you think should we care about this thing or not

@hazendaz
Copy link
Member

I merged this an hour ago. Please make sure to follow github here and what is happening. My first comment was to assist in not unnecessarily sending spam comments. You have followed that by two more needless spam emails.

To answer your question yes this is valid. Code should be written properly. Many fail to do so on most if not all repos thinking java is too wordy. I personally don't agree with ignoring such code requirements in java and it typically seems silly that even a library such as this doesn't fully follow all coding conventions. Tools like open rewrite would have likely applied the same here, same with Eclipse / Intellij, etc. You changes were otherwise accurate and have been merged.

NazirMuhammadZafarIqbal pushed a commit to NazirMuhammadZafarIqbal/spotbugs that referenced this pull request Jun 7, 2023
hazendaz pushed a commit that referenced this pull request Jun 19, 2023
* Added the messages.xml and findbugs.xml components for my first checker.

* Added the messages.xml and findbugs.xml components for my first checker.
Added Checker as well.

* Added the messages.xml and findbugs.xml components for my first checker.
Added Checker as well.
Added test cases calsses.

* Added the messages.xml and findbugs.xml components for my first checker.
Added Checker as well.
Added test cases calsses.
Added test class (JUnit) as well.

* Added the messages.xml and findbugs.xml components for my first checker.
Added Checker as well.
Added test cases calsses.
Added test class (JUnit) as well.
Edited the Changelog.md.

* Added the messages.xml and findbugs.xml components for my first checker.
Added Checker as well.
Added test cases calsses.
Added test class (JUnit) as well.
Edited the Changelog.md.
Fixed the formatting issues as well.

* Apply 1 suggestion(s) to 1 file(s)

* Apply 1 suggestion(s) to 1 file(s)

* Resolved many comments on merge request.

* Added the license and Javadoc for checker class.

* Don't report for stream methods called on Random

If one of the stream-returning methods (doubles, ints, or longs) is called on
Random or SecureRandom, don't report that the Random was only used once

Fixes #2370

* fix(deps): update dependency checkstyle to v7.8.2 (#2373)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.mockito:mockito-core to v5.2.0 (#2376)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.apache.groovy:groovy-all to v4.0.10 (#2377)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.slf4j:slf4j-api to v2.0.7 (#2381)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency net.sf.saxon:saxon-he to v12.1 (#2385)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.github.spotbugs to v5.0.14 (#2386)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.springframework:spring-core to v6.0.7 (#2383)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradle.enterprise to v3.12.5 (#2382)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency joda-time:joda-time to v2.12.4 (#2387)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradle.enterprise to v3.12.6 (#2390)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update asm to v9.5 (#2391)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency joda-time:joda-time to v2.12.5 (#2393)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.apache.groovy:groovy-all to v4.0.11 (#2394)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Issue 543 (#2395)

* Issue-543 Store Java class annotation names to PackageMemberAnnotations

* Issue-543 Store Java class annotation names to PackageMemberAnnotations

* Issue-543 Add AnnotationMatcher for filtering (with test cases)

* Issue-543 Extend SAX handler for AnnotationMatcher and classjas attr

* Issue-543 Fix whitespaces

* Issue-543 Add CHANGELOG entry

* Issue-543 Make compatible with Java 1.8

* Issue-543 Extract code to addJavaAnnotationNames method

* Issue-543 Update filter file xml schema

* Issue-543 Run spotlessApply

* Issue-543 Fix AnnotationMatcherTest

* Issue-543 Fix file header comments

* Issue-543 Use MethodHandles for logger

* Issue 543 Fix documentation

* Issue 543 Combine expressions when getting annotation type

* Issue 543 Rename attribute classjas to classAnnotationNames

* Issue-543 Fix whitespaces

* Issue-543: Fix typo

---------

Co-authored-by: Philipp Sadler <philipp.sadler@gebit.de>

* fix(deps): update dependency jacoco to v0.8.9 (#2398)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.checkerframework:checker-qual to v3.33.0 (#2399)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.mockito:mockito-core to v5.3.0 (#2403)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.springframework:spring-core to v6.0.8 (#2405)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin com.gradle.enterprise to v3.13 (#2404)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* minor: make private class final with default constructor (#2407)

* chore(deps): update plugin org.ajoberstar.grgit to v5.1.0 (#2409)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update dependency org.mockito:mockito-core to v5.3.1 (#2408)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update plugin org.ajoberstar.grgit to v5.2.0 (#2411)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Changed the implementation of testing classes entirely.

* Added Javadoc for testing files.

* Made changes for second time review comments.

* Fixed the CHANGELOG.md and added the solution in the bug reporting message.

* Fixed the extra boolean parameter in helping function for testing.

* Separated the class addClass and addMethod in the bug reporting.

* Fixed the package naming convention.

* Added comments for detector thought process, improved it's efficiency.

* Tried to fix white space issues in findbugs.xml

* Fixed some white space issues causing the pipeline to fail.

* Added the exact source line number in the detector.

* White space correction.

* Fixed new lines in finbugs.xml
Improved commenting in the sawOpCode() method and removed the sourceline remoting as it yeilds wrong results for large results.

* Removed always true evident null check in sawOpCode().

* Fixed source line annotation.
Added another class "COmmandMap". This class is actually one of th etest cases of large repo. I added it to verify the correction of reported exact source line number.

* Made the bug type local variable in JUnit testing class method `createBugInstanceMatcher`.

* Fixed the CHANGELOG.md formatting errors.

* Implemented a null check on variable `met` in another detector `ReflectionIncreaseAccessibility` in `sawOpCode()` method.

* deleted the temporary test case file.
Refactored teh xMethod Variable.

* DOn't see it.

* Implemented the null check on `met` variable in another checker `ReflectionIncreaseAccessibility.java` class.

* Added many good and bad test cases.

* Improved and added new assertions in the Junit testing.

* Improved the implementation of checker. It has changed totally. Now it is very efficient.

* Changed the message reported in consistent with the new implementation of the checker.

* Fixing white spaces.

* Removed teh commented out lines.

* Done!

* Done!

* Implemented new test cases in `FindVulnerableSecurityCheckMethodsTest.java`

* Implemented new test cases in `GoodVulnerableSecurityCheckMethodsTest.java`

* Implemented user defined `SecurityManager` required for some test cases.

* Implemented Junit tests for the newly added test cases.

* Fixed the comments.
Fixed bug reporting message.

* I don't know where these changes came form automatically.

* Removed the commented out lines.
Fixed the private methods with 1 usage only.

* Revert "I don't know where these changes came form automatically."

This reverts commit e8f89d4.

* Reverted the Null Pointer Exception.

* Refactored the name of the testing class as per conventions.

* Refactored the bug type in all the related files.

* Refactored the bug type in all the `CHANGELOG.md`

---------

Co-authored-by: Judit Knoll <judit.knoll@sigmatechnology.com>
Co-authored-by: Mike Dillon <mike@appropriate.io>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Carsten Pfeiffer <cpfeiffer@users.noreply.github.com>
Co-authored-by: Philipp Sadler <philipp.sadler@gebit.de>
Co-authored-by: Kevin222004 <97679350+Kevin222004@users.noreply.github.com>
@hazendaz hazendaz added this to the SpotBugs 4.8.0 milestone Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants