Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4979053

compiler to generate Getter/Setter methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • specification
    • x86
    • windows_xp

      Name: jl125535 Date: 01/15/2004


      A DESCRIPTION OF THE REQUEST :
      A new keyword to the Java language that marks variables to have Getter/Setter to be automatically generated by the compiler.

      JUSTIFICATION :
      IDEs like eclipse have capability to autmatically generate getters and setters. But they bloat the code and make it harder to read. I wonder why this isn't
      something the compiler could do at compile-time. Why not simply invent a
      new keyword, e.g. "bean". Every bean is known to the compiler to have a
      public Getter/Setter which can be overridden:

      public Test
      {
        // will generate:
        // String getBlah();
        // void setBlah(String s) { this.blah = s; }
        public bean String blah;

        // and can be overridden:

       public void setBlah(String s)
       {
          whatever();
          super.setBlah(s);
        }
      }
      (Incident Review ID: 232174)
      ======================================================================

            abuckley Alex Buckley
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: