I have two objects with the same type, then I'm trying to see if they're are equal, but it seems they're not, and I really don't understand why this is happening, I took a picture from the screen where you guys can see what I'm trying to say:
here (with high resolution).
The image is to show you guys what is really happening even debbuging.
Here's the code and the classes :
private boolean checkForExpr(Type lowerExprType, Type upperExprType) {
boolean result = false;
if (lowerExprType == Type.undefinedType || upperExprType == Type.undefinedType){
return false;
}else{
result = (lowerExprType == upperExprType);
}
return result;
}
Type class
abstract public class Type {
public Type( String name ) {
this.name = name;
}
public static Type booleanType = new BooleanType();
public static Type integerType = new IntegerType();
public static Type charType = new CharType();
public static Type undefinedType = new UndefinedType();
public String getName() {
return name;
}
abstract public String getCname();
private String name;
}
IntegerType class
public class IntegerType extends Type {
public IntegerType() {
super("integer");
}
public String getCname() {
return "int";
}
}