Question about dependencies

I have a project that includes several modules. I have worked hard to prevent recursive dependencies but I have one that just boggles my mind. I have a module that compiles fine in both ant and using IDEA's make. However, if I don't include a self-referencing dependency for the module in module settings, IDEA's intellisense gets all confused and marks all imports to classes within the module as being unreachable. Once I add a dependency on itself all the red underlines go away.

Does anyone have any idea's why this is happening? I have attached the project and module files

Chris White
Senior Software Engineer
Lightspace Corp.



Attachment(s):
LP-2.0.iml
LMS.iml
LMS.ipr
ContentManager.iml
LightsoftSDK.iml
9 comments
Comment actions Permalink

Hello Christopher,

I have reproduced this problem. It happens due to several conditions. One
of them is that your LMS module has dependency to LMS project library, which
consists of compiled classes of LMS module. Do you really need such library?
Try, please, to remove it and check what's happen.

I have a project that includes several modules. I have worked hard to
prevent recursive dependencies but I have one that just boggles my
mind. I have a module that compiles fine in both ant and using IDEA's
make. However, if I don't include a self-referencing dependency for
the module in module settings, IDEA's intellisense gets all confused
and marks all imports to classes within the module as being
unreachable. Once I add a dependency on itself all the red underlines
go away.

Does anyone have any idea's why this is happening? I have attached the
project and module files

Chris White
Senior Software Engineer
Lightspace Corp.

Alexander.


0
Comment actions Permalink

Alexander,

Thank you for your reply. Please don't take this as cheek but I tried very
hard in outlining my original problem to explicitly specify that I MUST
include a reference to the LMS Project Library in the LMS Module dependency
list. In other words, removing the LMS Project Library from the LMS Module
dependency list causes the problem I am seeking help with so unfortunately
the solution you provide does not actually solve my problem, rather causes
it to manifest.

I am suspicious of the cache. For some reason it seems to ignore all classes
belonging to the LMS module and only look at the dependencies. So if I add a
dependency on an already compiled LMS jar, intellisense is able to find the
classes it previously could not (albiet out of sync with any changes I have
made) and the red underlines go away. Removing the dependency causes the
reverse behavior.

I hope this helps,

Chris White
Lightspace Corp.

"Alexander Chernikov" <Alexander.Chernikov@jetbrains.com> wrote in message
news:c8a88cb489ca8ca06f47b8e90b1@news.intellij.net...

Hello Christopher,

>

I have reproduced this problem. It happens due to several conditions. One
of them is that your LMS module has dependency to LMS project library,
which consists of compiled classes of LMS module. Do you really need such
library? Try, please, to remove it and check what's happen.

>
>> I have a project that includes several modules. I have worked hard to
>> prevent recursive dependencies but I have one that just boggles my
>> mind. I have a module that compiles fine in both ant and using IDEA's
>> make. However, if I don't include a self-referencing dependency for
>> the module in module settings, IDEA's intellisense gets all confused
>> and marks all imports to classes within the module as being
>> unreachable. Once I add a dependency on itself all the red underlines
>> go away.
>>
>> Does anyone have any idea's why this is happening? I have attached the
>> project and module files
>>
>> Chris White
>> Senior Software Engineer
>> Lightspace Corp.

Alexander.

>


0
Comment actions Permalink

Hello Christopher,

Module dependency list. In other words, removing the LMS Project
Library from the LMS Module dependency list causes the problem I am
seeking help with so unfortunately the solution you provide does not
actually solve my problem, rather causes it to manifest.


The point is that when I remove such library, the problem goes away. Mysteriously,
this works the opposite way for you.

One thing in your story that makes me prick up my ears is the "red underlines".
When I get the error in the case I have described it looks so: referred class
name is red, has no underline, error message is "Cannot resolve symbol ClassName".
Package name in import statement is the same: red color, no underline, message
"Cannot resolve symbol". Is it the same in case you get the error?

(Red underlines on editor tab are not interesting, this is common appearance
for all errors.)

Alexander.


0
Comment actions Permalink

The red lines are relevant, even in the editor tab, in this case since I am
often seeing this with classes that actually compile and run correctly. It
seems in these cases only the Intellisense is out of sync, hence the red
lines.

Perhaps I have a fundamental misunderstanding as to how java/IDEA manages
dependencies. No one else seems to have these problems yet I have had them
off and on since I started using IDEA 3 years ago. It has been very
frustrating and I will admit that several times I have considered switching
to Netbeans or Eclipse as I have not seen this problem with either of those
IDEs. The fact is, in all other areas, I have been extremely pleased with
IDEA and even with this (to me) very major issue with dependencies, I feel
that IDEA is way ahead of every other IDE I have used, for any language.

Regardless, I would highly appreciate it if you could try to think of any
reason why, in the case of multi-module projects, I would need to include a
self-referent Project Library before a project will compile?

One other question I have which may be relevant is this... In the Module
Settings/Paths tab, what does the checkbox "exclude output paths" do? What
is it excluding them from and why?

Thanks in advance,

Christopher White

"Alexander Chernikov" <Alexander.Chernikov@jetbrains.com> wrote in message
news:c8a88cb48b868ca0d581e0c41fe@news.intellij.net...

Hello Christopher,

>
>> Module dependency list. In other words, removing the LMS Project
>> Library from the LMS Module dependency list causes the problem I am
>> seeking help with so unfortunately the solution you provide does not
>> actually solve my problem, rather causes it to manifest.
>

The point is that when I remove such library, the problem goes away.
Mysteriously, this works the opposite way for you.

>

One thing in your story that makes me prick up my ears is the "red
underlines". When I get the error in the case I have described it looks
so: referred class name is red, has no underline, error message is "Cannot
resolve symbol ClassName". Package name in import statement is the same:
red color, no underline, message "Cannot resolve symbol". Is it the same
in case you get the error?

>

(Red underlines on editor tab are not interesting, this is common
appearance for all errors.)

>

Alexander.

>


0
Comment actions Permalink

One other question. Should it make a difference if a path within a source
directory is named biz.lightspace.content vs. biz/lightspace/content? IDEA
seems to recognize when I do this and insert the appropriate package prefix
into the source root entry. However, I find that when I try to simplify the
pathing in this way I see the problem of intellisense/compiler getting
confused more often than when I use full paths.

Thanks in advance,

Christopher White

"Alexander Chernikov" <Alexander.Chernikov@jetbrains.com> wrote in message
news:c8a88cb48b868ca0d581e0c41fe@news.intellij.net...

Hello Christopher,

>
>> Module dependency list. In other words, removing the LMS Project
>> Library from the LMS Module dependency list causes the problem I am
>> seeking help with so unfortunately the solution you provide does not
>> actually solve my problem, rather causes it to manifest.
>

The point is that when I remove such library, the problem goes away.
Mysteriously, this works the opposite way for you.

>

One thing in your story that makes me prick up my ears is the "red
underlines". When I get the error in the case I have described it looks
so: referred class name is red, has no underline, error message is "Cannot
resolve symbol ClassName". Package name in import statement is the same:
red color, no underline, message "Cannot resolve symbol". Is it the same
in case you get the error?

>

(Red underlines on editor tab are not interesting, this is common
appearance for all errors.)

>

Alexander.

>


0
Comment actions Permalink

Does every project (or every multi-module project, or every somewhat-project)
have this problem on your side? If so, could you create the simplest project,
where the problem occurs, and attach the zip including all files, completely?
This way I could take a look on it and maybe see what happens.

Alexander.


0
Comment actions Permalink

I wish it was that easy. The problem on my side is that since I don't know
what causes it, it's very difficult to reproduce except by accident. When it
happens it's always a situation where I'm blocked until I fix the problem
and fixing it usually means adding the self reference as before mentioned.

Is it possible that this could be caused by a circular reference or circular
dependency?

"Alexander Chernikov" <Alexander.Chernikov@jetbrains.com> wrote in message
news:c8a88cb48c158ca0f9f0e2b15ea@news.intellij.net...

Does every project (or every multi-module project, or every
somewhat-project) have this problem on your side? If so, could you create
the simplest project, where the problem occurs, and attach the zip
including all files, completely? This way I could take a look on it and
maybe see what happens.

>

Alexander.

>


0
Comment actions Permalink

There is no known issues about circular dependencies, which would cause such
errors.

The project you have sent the first time could help. But it refers to some
modules and libraries, which definition is unknown, since not all referred
modules were sent. When reproducing the issue I have modified the project
to exclude missing modules. This could make the difference in behavior me
and you observe. Would be nice to get a project with all modules defined,
which shows the same error. With only 2 source files, of course. I understand
that preparing such project could take time. But otherwise we can spend more
time just guessing, what's happening on your side, and with what data.

Alexander.


0
Comment actions Permalink

Ok, I think I have figured out most of the issues with respect to the
dependencies. Some problems were related to copies of jar files which were
exported and conflicted with dependencies of other modules.

The big thing I realized is that I should be including the entire codebase
in the project rather than just a few relevant modules. I'm not sure why I
didn't realize this before but once all of our code was in IDEA 95% of my
issues went away. The remaining ones became much clearer due to the work
needed to get all of the code into modules.

Thanks for the help,

Chris White

"Alexander Chernikov" <Alexander.Chernikov@jetbrains.com> wrote in message
news:c8a88cb48cf98ca1494adc32560@news.intellij.net...

There is no known issues about circular dependencies, which would cause
such errors.

>

The project you have sent the first time could help. But it refers to some
modules and libraries, which definition is unknown, since not all referred
modules were sent. When reproducing the issue I have modified the project
to exclude missing modules. This could make the difference in behavior me
and you observe. Would be nice to get a project with all modules defined,
which shows the same error. With only 2 source files, of course. I
understand that preparing such project could take time. But otherwise we
can spend more time just guessing, what's happening on your side, and with
what data.

>

Alexander.

>


0

Please sign in to leave a comment.