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

Incremental java compiler does not detect changes to classes used in type parameters in some cases #20478

Closed
big-guy opened this issue Apr 15, 2022 · 1 comment · Fixed by #20499
Assignees
Labels
a:bug in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures
Milestone

Comments

@big-guy
Copy link
Member

big-guy commented Apr 15, 2022

Expected Behavior

Gradle build should fail when Java compilation should fail.

Current Behavior

Gradle build succeeds when Java compilation should fail.

Context

Given these classes:

interface Super <T> { 
	T getResult();
}

interface Sub extends Super<Deleted> { }

interface Deleted {}

If I delete Deleted, Sub should be recompiled (and fail compilation). I found this in the gradle/gradle codebase when deleting some classes.

The build fails if Sub has a reference to T or I disable incremental compilation.

A similar thing happens in a slightly simpler example:

interface Sub<T extends Deleted> { }

interface Deleted {}

It looks like we ignore the type parameters in some cases.

Steps to Reproduce

I reproduced the failure in a test:
#20479

Your Environment

This happens everywhere.

I tested 5.0, 6.0, 7.0 and 7.3/7.4/7.5. I think this has never worked.

@big-guy big-guy added a:bug to-triage in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures and removed to-triage labels Apr 15, 2022
@big-guy big-guy changed the title Incremental java compiler does not detect deleted classes used in type parameters in some cases Incremental java compiler does not detect changes to classes used in type parameters in some cases Apr 15, 2022
@big-guy
Copy link
Member Author

big-guy commented Apr 15, 2022

I poked around some more and there are more cases where this does the wrong thing:

interface Super<T extends Bar> { 
	T getResult();
}

interface Sub extends Super<Foo> { }

interface Bar {}
interface Foo extends Bar {}

If you change Foo so that it no longer extends Bar, Sub should be recompiled, but it isn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants