I have a (pedantic) Java question: I want to create an anonymous class in a method and assign a method parameter to a member with the same name. The code below does not work as it assigns the member to itself.
class TestClass {
String id;
}
TestClass createTestClass(final String id) {
return new TestClass() {{
this.id = id; // self assignment of member
}};
}
Beside the obvious method to rename the id parameter, is there any other way to access it? Thx