public class WeakBoolean {
privateBoolean myBool;
public WeakBoolean() {
myBool = true;
}
public void inverse() {
myBool = !myBool;
}
public void xor(boolean b) {
myBool ^= b;
}
}
Make sure "Type may be weakened" is On. It shows the warning "Type may be weakened to Object" for myBool.
On applying this quick fix the code becomes not compilable.
Description
Provide a code like:
public class WeakBoolean {
privateBoolean myBool;
public WeakBoolean() {
myBool = true;
}
public void inverse() {
myBool = !myBool;
}
public void xor(boolean b) {
myBool ^= b;
}
}
Make sure "Type may be weakened" is On. It shows the warning "Type may be weakened to Object" for myBool.
On applying this quick fix the code becomes not compilable.