You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fields CtCatchVariableImpl#type and CtCatchVariableImpl#multiTypes both represents same role CtRole.TYPE - I am OK with that. because both works with same field - type.
But it is actually implemented inconsistently
//set type to xCtCatchVariableImpl.setType(x)
//set type to yCtCatchVariableImpl.setMultiType([y])
//ok, the type is yassertEquals([y], CtCatchVariableImpl.getMultiType())
//what should next line do? This is how it behaves nowassertEquals(x, CtCatchVariableImpl.getType())
//but it should beassertEquals(y, CtCatchVariableImpl.getType())
//set type to a,b,cCtCatchVariableImpl.setMultiType([a,b,c])
//ok, the type is a,b,cassertEquals([a,b,c], CtCatchVariableImpl.getMultiType())
//what should next line do? This is how it behaves nowassertEquals(x, CtCatchVariableImpl.getType())
//but it should probably throw an exception "There are multiple types in catch. Use getMultiType()"
WDYT?
I need to solve this problem before #1582 can be implemented.
The text was updated successfully, but these errors were encountered:
//but it should be
assertEquals(y,CtCatchVariableImpl.getType())
yes, this should be the result
//what should next line do? This is how it behaves now
assertEquals(x,CtCatchVariableImpl.getType())
x is is bug.
however, instead of an exception, which makes client code brittle,
I would prefer to return the first element of the list, or even better
the first common super type of a,b,c
The fields CtCatchVariableImpl#type and CtCatchVariableImpl#multiTypes both represents same role CtRole.TYPE - I am OK with that. because both works with same field - type.
But it is actually implemented inconsistently
WDYT?
I need to solve this problem before #1582 can be implemented.
The text was updated successfully, but these errors were encountered: