You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example has no anonymous class (all classes have a name) and all uncallable methods pinpointed are callable (which doesn't mean I need to call them - they were generated by the compiler)
MyEnum.valueOf(String)
MyEnum.values()
MyRecord.from()
MyRecord.to()
The text was updated successfully, but these errors were encountered:
…sed methods of method-local enumerations and records
During compilation, enumerations and records are turned into Java classes with some auto-generated methods. Some of these methods are called by the code but some of them not. However, this is not a programming error or bad practice, these methods must not be considered as dead code because their generation cannot be prevented. Therefore no bug report `UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS` must be issued to such classes even if they are defined inside a method. See issue ([spotbugs#2120](spotbugs#2120))
…sed methods of method-local enumerations and records (#2170)
* Fix for detector `UncallableMethodOfAnonymousClass` to not report unused methods of method-local enumerations and records
During compilation, enumerations and records are turned into Java classes with some auto-generated methods. Some of these methods are called by the code but some of them not. However, this is not a programming error or bad practice, these methods must not be considered as dead code because their generation cannot be prevented. Therefore no bug report `UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS` must be issued to such classes even if they are defined inside a method. See issue ([#2120](#2120))
* Fix the test case
* Solution changed to only disregard auto-generated methods of enums and records
Co-authored-by: Kengo TODA <skypencil@gmail.com>
For the following example, I get several warnings "Uncallable method ... defined in anonymous class".
The example has no anonymous class (all classes have a name) and all uncallable methods pinpointed are callable (which doesn't mean I need to call them - they were generated by the compiler)
The text was updated successfully, but these errors were encountered: