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

scanning of related jar files creates redundant Interface nodes #34

Open
torstenwerner opened this issue May 7, 2016 · 3 comments
Open
Assignees
Labels
type:question A question asked by a user who needs help

Comments

@torstenwerner
Copy link

Hi,

I'll attach a sample project with 2 jar files. 1 jar contains an interface SampleApi and the 2nd jar contains a class SampleImpl that implements this interface. I'll get 2 separate nodes with name SampleApi after scanning with jqassistant. One node is correctly labeled Interface but it is not connected to the SampleImpl node. The other node is not labeled Interface but is connected to the SampleImpl node.

I would expect to get just a single node SampleApi with label Interface and which is connected to the SampleImpl node.

sample sources and binaries: twojars.zip

Torsten

@DirkMahler
Copy link
Member

DirkMahler commented May 7, 2016

The behavior is by intention: if you're scanning two different versions of the same library it would be a problem if only one node per class name would be created. Therefore class resolution per default is scoped to the artifact which is scanned, i.e. you get the following patterns:

// API Jar
(apiJar:Artifact:Jar)-[:CONTAINS]->(interface:Type:Interface)

// Impl Jar
(implJar:Artifact:Jar)-[:CONTAINS]->(class:Class),
(class)-[:IMPLEMENTS]->(requiredInterface:Type),
(implJar)-[:REQUIRES]->(requiredInterface)

Both nodes "interface" and "requiredInterface" provide a property "fqn" with the same value but only "interface" contains all information about the scanned interface (i.e. annotations, declared methods, fields, etc.)

You can execute a concept to resolve the disconnected graphs:

jqassistant.sh analyse -concepts classpath:Resolve

(dependening on the size of your database it might be necessary to increase the heap setting, e.g. JQASSISTANT_OPTS=-Xmx4096M)

Now the following pattern should work:

(apiJar:Artifact:Jar)-[:CONTAINS]->(interface:Type:Interface),
(implJar:Artifact:Jar)-[:CONTAINS]->(class:Class),
(class)-[i:IMPLEMENTS]->(interface)

Note:

  • the relation "i" has a property "resolved:true", the required interface node (see first snippet) still exists.
  • there has already been the suggestion that while scanning there should be a parameter which controls resolution of referenced classes.

@DirkMahler DirkMahler self-assigned this May 7, 2016
@torstenwerner
Copy link
Author

Thanks for the quick reply! The actual task is analyze with z. I probably should re-read the documentation. I think the issue can be closed.

@DirkMahler
Copy link
Member

I'd like to keep he ticket open as the documentation is not really clear about this and other users also ran into the same situation.

@obfischer obfischer transferred this issue from jQAssistant/jqassistant Feb 26, 2020
@obfischer obfischer added the type:question A question asked by a user who needs help label Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question A question asked by a user who needs help
Projects
None yet
Development

No branches or pull requests

3 participants