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

Revert https://github.com/eclipse-jdt/eclipse.jdt.core/pull/630 #1079

Merged
merged 2 commits into from
May 23, 2023

Conversation

srikanth-sankaran
Copy link
Contributor

@srikanth-sankaran srikanth-sankaran commented May 22, 2023

What it does

Revert #630 for the time being as it results in a cascade of issues

Author checklist

@stephan-herrmann
Copy link
Contributor

We have two distinct failures in NullTypeAnnotationTests (multiplied by compliance levels):

  • testGH854
    I'm not much surprised see here, but will have a second look shortly
  • testBug522142_bogusError
    This might indeed indicate that #683 needs #630 - I'm looking into this now

@stephan-herrmann
Copy link
Contributor

stephan-herrmann commented May 23, 2023

Analysis for testBug522142_bogusError, with this example code:

@NonNullByDefault({PARAMETER, RETURN_TYPE, FIELD, TYPE_PARAMETER, TYPE_BOUND, TYPE_ARGUMENT})
	interface Foo<A> {
		interface Bar<A> extends Iterable<Foo<A>> {
	}
}

After Foo has been correctly translated into Foo<@NonNull A> (due to @NNBD), it's the member type Bar<A> where the reference "Foo<A>" is resolved before the type parameter <A> (declared by Bar) has applied the nullness default. Note that @NNBD should apply only to the declaration of A, not to its application.

Yet, the bound check for the PSTR Foo<A> is deferred, for now its resolved type has no nullness information.

"Belatedly", resolveAnnotations on the same PSTR triggers evaluateNullAnnotations for MTB Bar, where Bar's <A> is translated to <@NonNull A>.

connectTypeHierarchy finishes without finding any problem.

Fast-forward to CUS.checkParameterTypes() and into CS.checkParameterizedTypeBounds() for the member Bar: we need to check the PST for Foo<A>, which still has no nullness information. At this point, the type to check against is "Foo<@NonNull A>". This is were we report that "The type 'A' is not a valid substitute for the type parameter '@NonNull A'"

Ergo: yes, this test from #683 requires additional help either from #630 or from #1077. But ... (tbc)

absence of eclipse-jdt#630.

Disable testGH854 to enable running of more test suites
@stephan-herrmann
Copy link
Contributor

Point-fix for NullTypeAnnotationTest.testBug522142_bogusError() in #1079 in absence of #630.

This is the most careful thing I can think of for 4.28. @srikanth-sankaran WDYT?

Disable testGH854 to enable running of more test suites

I think that test is dispensable for now, but I'll take another look as promised.

@stephan-herrmann
Copy link
Contributor

stephan-herrmann commented May 23, 2023

Disable testGH854 to enable running of more test suites

I think that test is dispensable for now, but I'll take another look as promised.

The failure is caused in the exact code location where my first attempt of #1067 introduced a lot of new scaffolding to ensure an auspicious order of event. I think adding such stuff on top of this revert commit would be too much.

EDIT: cherry picking that commit would indeed fix testGH854 but I wouldn't recommend doing so.

@srikanth-sankaran
Copy link
Contributor Author

Point-fix for NullTypeAnnotationTest.testBug522142_bogusError() in #1079 in absence of #630.

This is the most careful thing I can think of for 4.28. @srikanth-sankaran WDYT?

Disable testGH854 to enable running of more test suites

I think that test is dispensable for now, but I'll take another look as promised.

Looking into this ...

Copy link
Contributor

@stephan-herrmann stephan-herrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@srikanth-sankaran
Copy link
Contributor Author

Point-fix for NullTypeAnnotationTest.testBug522142_bogusError() in #1079 in absence of #630.

This is the most careful thing I can think of for 4.28. @srikanth-sankaran WDYT?

Disable testGH854 to enable running of more test suites

I think that test is dispensable for now, but I'll take another look as promised.

Looking into this ...

@stephan-herrmann , your additional point fix on top of (reverse patch + tests) looks OK to me. I agree it could be too much to also squeeze in a fix for testGH854 right now.

@iloveeclipse, we can proceed to merge this - after project lead approval

@iloveeclipse
Copy link
Member

we can proceed to merge this - after project lead approval

Please do! Thank you both!

@srikanth-sankaran srikanth-sankaran merged commit da0a6d8 into eclipse-jdt:master May 23, 2023
@srikanth-sankaran srikanth-sankaran deleted the RevertPR630 branch May 23, 2023 12:36
robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this pull request Jul 18, 2024
* Revert eclipse-jdt#630

* Point-fix for NullTypeAnnotationTest.testBug522142_bogusError() in
absence of eclipse-jdt#630.

Disable testGH854 to enable running of more test suites

---------

Co-authored-by: Stephan Herrmann <stephan.herrmann@berlin.de>
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.

3 participants