I deleted a parameter from a constructor and ran gradle check
inside IntelliJ.
While it was running, I remembered that I have code in the same module that calls the constructor I changed, but I forgot to drop the parameter I deleted. This should have failed to compile — so I was very surprised when gradle check
succeeded.
Sure enough, I opened IntelliJ’s terminal and ran ./gradlew --no-daemon --no-build-cache clean check --rerun-tasks
(doing everything I could think of to ensure everything gets rebuilt), and I got the build failure I was expecting.
So I went back inside IntelliJ and ran gradle check
again, and this time it failed as expected.
Why might gradle check
have succeeded the first time?
Hopefully irrelevant details:
- My code is all Kotlin.
- Nothing about this workflow involved merging in changes from other developers.
- The constructor I changed belongs to a Spring Boot controller.
- The call site that should have failed is in my
AppConfig
class, and I’m not using@Autowired
— I’m explicitly creating the controller instance. In other words — there shouldn’t be any Spring magic going on.