Changes to interfaces are not recognized

已回答

I’m using IntellI Community Edition (v. 2024.2.2) to work with Java projects and have been finding a problem that interferes with my work.  The situation is as follows:

The code is in two projects, one defines some interfaces, the second contains classes that implement the interfaces. The two projects are in synch – both can be built at the command line using maven and within IntelliJ.

Then, we make a change to the interface project – adding some methods to one of the interfaces and use maven to install the updated artifacts in the local repo.

Next, within the implementation project, we create implementations of the new methods.

At this point, IntelliJ displays “method does not override or implement a method from a supertype.”

I’ve noticed this problem several times over the past year. 

It used to work to invalidate caches within IntelliJ and restart.  That strategy no longer works.  It used to work to update the version of the interface project. This no longer works.

Of course, I can build the implementation project at the command line and run the tests but I would like to debug tests to troubleshoot debugging does not work.

Has anyone else seen this problem?  Do you have a solution?

0

Hello Mitch,

If you update version of the interface project, install it to maven, set new version in implementation project and run “Reload” from Maven Tool Window - will new version be shown in dependencies? Will new methods be resolved?

Also you may open both projects in one IDE window - open one project and import the other one as module (File | New | Module from Existing Sources…). This way IDE may detect module dependencies and sources will be used directly, without uploading to Maven.

0

Thank you very much, Yaroslav, for the suggestions.

I tried both but still see 

method does not override or implement a method from a supertype

0

Mitch,

Please try to set `external.system.substitute.library.dependencies = true` via Help | Edit Custom Properties and restart. Will it help?

Is it possible to reproduce the issue with sample projects that could be provided for investigation on our side? If no, please attach screenshots from “Project Structure | Modules - Dependencies” to check how dependency is added there.

Does new version is shown in dependencies when you update version of the interface project, install it to maven, set new version in implementation project and run “Reload” from Maven Tool Window?

0

Thank you again, Yaroslav!

I created the custom property and restarted and still see the issue.

In a simplified project, no the error does not occur!  As soon as I add a method to an interface and install the update using maven, the other project shows the error that the implementation is missing.

This error has occurred in at least 2 different pairs of projects that follow the same pattern.:

Here is the requested screnshot

0

Mitch,

Am I got it right that nothing is shown for “molwitch-cdk” module? With test project on my side module dependency is shown:

 When projects are opened separately then dependency is shown as maven dependency.

0

请先登录再写评论。