JDK-4979053 : compiler to generate Getter/Setter methods
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-01-15
  • Updated: 2006-11-17
  • Resolved: 2006-11-17
Related Reports
Duplicate :  
Description
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) 
======================================================================

Comments
EVALUATION This is really a request for properties, and 6347784 expresses it better.
17-11-2006