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

CtTypeImpl: isSameParameter may fail in noclasspath mode #1753

Closed
msteinbeck opened this issue Nov 27, 2017 · 1 comment
Closed

CtTypeImpl: isSameParameter may fail in noclasspath mode #1753

msteinbeck opened this issue Nov 27, 2017 · 1 comment

Comments

@msteinbeck
Copy link
Contributor

isSameParameter contains the following lines:

...
} else if (expectedType instanceof CtTypeParameterReference) {
	if (!ctParameterType.isSubtypeOf(factory.Type().createReference(expectedType.getActualClass()))) {
		return false;
	}
} else if (ctParameterType instanceof CtTypeParameterReference) {
	CtTypeParameter declaration = (CtTypeParameter) ctParameterType.getDeclaration();
	if (declaration.getSuperclass() instanceof CtIntersectionTypeReference) {
...		

In no classpath mode, the first else if branch fails if expectedType is not in classpath and the second else if branch fails if ctParameterType is not in classpath.

So far as I can tell, the first else if branch should use getQualifiedName():

...createReference(expectedType.getQualifiedName())

and the second branch should check if declaration is null:

CtTypeParameter declaration = (CtTypeParameter) ctParameterType.getDeclaration();
if (declaration != null && declaration.getSuperclass() instanceof CtIntersectionTypeReference)

What do you think?

msteinbeck pushed a commit to msteinbeck/spoon that referenced this issue Nov 30, 2017
surli added a commit to surli/spoon that referenced this issue Nov 30, 2017
@surli
Copy link
Collaborator

surli commented Dec 1, 2017

Closed by #1767

@surli surli closed this as completed Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants