Re: [jgroups-users] Getters and setters in 4.0
Questions/problems related to using JGroups <[email protected]>
| Newsgroups | gmane.comp.java.javagroups.general |
|---|---|
| Message-ID | <CAPdvCBQ_E83UGan5uSnsUTovEjXkbX7s4di6q8tQs7V38vNBXw@mail.gmail.com> |
On Thu, Jul 7, 2016 at 11:11 PM, Questions/problems related to using JGroups <[email protected]> wrote: > > > On 07/07/16 19:36, Questions/problems related to using JGroups wrote: > > I think removing get/set is a bad idea for reasons expressed already. > > Furthermore it will reduce the effectiveness of code > > analysis/introspection tools which understand the concept of > > getters/setters that start with get/set. > > Which ones? It's not hard to identify methods which return a field as > getters and methods which take one parameter and set a field as setters. > There's actually code in JGroups which exposes such methods as managed > attributes if @ManagedAttribute is used on a method. > > Example of a somewhat trivial case which I just confirmed on IntelliJ and I think Eclipse is the same. There are code generation tools to implement typical methods. If you want to generate a getter in a class it will list all member variables that don't have one so you can choose which ones to generate getters for. If you don't follow convention it will include all member variables including those which have getters because it assumes getters start with "get". Adding @ManagedAttribute to the non-standard getter did not fix this. Now you can change the template it follows to work with the non-standard convention but then it won't work with standard convention. This is a widely used tool that is designed to understand the code by following standard naming conventions, not by higher order code analysis. While this specific case may not be a big deal for JGroups, my concern is that there may be other tools that will be confused/diminished as well. Tools I have used that I would be concerned about affecting are ProGuard, ThreadSafe, and CodePro. Maybe they only do higher order code analysis and now nothing about naming conventions, I don't know. ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ javagroups-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/javagroups-users