I’m just thinking whether it would be possible to extend the java compiler with the apt tool or the new mustang api to accept code like the following:
class Foo {
@Getter(value)
int getValue() { .. }
@Setter(value)
void setValue(int value) { .. }
}
Foo foo = new Foo();
foo.value = 1; // translates to foo.setValue(1)
of course fields with the same name should have a higher property:
class Bar extends Foo {
int value;
}
Bar bar = new Bar();
bar.value = 1; // should access the field
Foo foo = bar;
foo.value = 1; // still translates to foo.setValue(1);
what do you think, is this possible?
