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

review 1: fix CtExecutableReference#isOverriding on anonymous class #1219

Merged
merged 1 commit into from
Mar 14, 2017

Conversation

pvojtechovsky
Copy link
Collaborator

I think that CtExecutableReferenceImpl#isOverriding handles wrong anonymous types.

I think that anonymous classs

public abstract class AbstractTostada implements ITostada {
	@Override
	public ITostada make() {
//following anonymous class extends Tostada (not ITostada!), therefore it overrides Tostada#make and prepare
//---->
		return new Tostada() {
			@Override
			public void prepare() {
				super.prepare();
			}

			@Override
			public ITostada make() {
				return super.make();
			}
		};
	}

	public abstract void prepare();
}

The origin code

	if (getDeclaringType().isAnonymous()) {
		if (!getDeclaringType().getDeclaringType().isSubtypeOf(executable.getDeclaringType())) {
			return false;
		}
	} 

is not understandable for me. So I think it is buggy. May be there was some special case which has to be handled for anonymous classes, which @GerardPaligot wanted to handle, but the code is actually wrong. Any idea what was the origin purpose of that code?

@pvojtechovsky pvojtechovsky changed the title fix CtExecutableReference#isOverriding on anonymous class review 1: fix CtExecutableReference#isOverriding on anonymous class Mar 13, 2017
@monperrus monperrus merged commit 286e6e9 into INRIA:master Mar 14, 2017
@monperrus
Copy link
Collaborator

My analysis and my IDE agree with you :-)

Thanks.

@pvojtechovsky pvojtechovsky deleted the fixIsOverridingOnAnonymType branch March 14, 2017 20:28
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

Successfully merging this pull request may close these issues.

2 participants