A field is removed from its owning class.
The field name
is removed from the class Person
in the library project.
public class Person {
- public String name;
}
Hereafter, we list the broken uses that are currently detected by Maracas.
The method displayPerson()
—defined in the PeopleInfo
class in a client project—accesses the name
field.
Then, a broken use is reported pointing to the field access expression.
public class PeopleInfo {
public void displayPerson(Person person) {
// Broken use reported here
String personName = person.name;
System.out.println(personName);
}
}
The method addLastname()
—defined in the PeopleInfo
class in a client project—accesses the name
field.
Then, a broken use is reported pointing to the field access expression.
public class PeopleInfo {
public void addLastname(Person person, String lastname) {
// Broken use reported here
person.name += " " + lastname;
}
}