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

Inconsistency of CtCatchVariable#type and #multiTypes #1593

Closed
pvojtechovsky opened this issue Oct 12, 2017 · 2 comments
Closed

Inconsistency of CtCatchVariable#type and #multiTypes #1593

pvojtechovsky opened this issue Oct 12, 2017 · 2 comments

Comments

@pvojtechovsky
Copy link
Collaborator

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 x
CtCatchVariableImpl.setType(x)
//set type to y
CtCatchVariableImpl.setMultiType([y])
//ok, the type is y
assertEquals([y], CtCatchVariableImpl.getMultiType())
//what should next line do? This is how it behaves now
assertEquals(x, CtCatchVariableImpl.getType())
//but it should be
assertEquals(y, CtCatchVariableImpl.getType())
//set type to a,b,c
CtCatchVariableImpl.setMultiType([a,b,c])
//ok, the type is a,b,c
assertEquals([a,b,c], CtCatchVariableImpl.getMultiType())
//what should next line do? This is how it behaves now
assertEquals(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.

@monperrus
Copy link
Collaborator

monperrus commented Oct 12, 2017 via email

@monperrus
Copy link
Collaborator

closed per #1668

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

2 participants