Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subclass will not be rendered mutable when superclass is definitely not immutable #5

Open
Grundlefleck opened this issue Dec 5, 2012 · 2 comments
Assignees

Comments

@Grundlefleck
Copy link
Contributor

Original author: Grundlefleck@gmail.com (December 23, 2009 00:38:41)

Given the following classes:

{{{
public class MutableSupertype {
public int mutableField;

public MutableSupertype(int num) {
    this.mutableField = num;
}

}

final class ImmutableSubtypeOfMutableSupertype extends MutableSupertype {
private final int immutableField = 2;
public ImmutableSubtypeOfMutableSupertype(int immutableField) {
super(immutableField);
}
}

}}}

The class ImmutableSubtypeOfMutableSupertype will be reported as definitely
immutable. This is incorrect because the mutability of MutableSupertype is
inherited, ie the value for mutableField can be changed in instances of
the subclass.

The mutability status of the superclass should be inherited.

Original issue: http://code.google.com/p/mutability-detector/issues/detail?id=4

@ghost ghost assigned Grundlefleck Dec 5, 2012
@Grundlefleck
Copy link
Contributor Author

From Grundlefleck@gmail.com on December 23, 2009 01:13:15
Fixed in r11, subclasses will inherit mutable status.

@Grundlefleck
Copy link
Contributor Author

From Grundlefleck@gmail.com on July 04, 2010 19:30:06
Reopening this issue as a simple lookup of the superclass is not sophisticated enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant