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

Correct package resolve in case when import with * #77

Open
spirit93 opened this issue Feb 1, 2019 · 1 comment
Open

Correct package resolve in case when import with * #77

spirit93 opened this issue Feb 1, 2019 · 1 comment

Comments

@spirit93
Copy link

spirit93 commented Feb 1, 2019

Version: javaflow -version
/* @flow /
/
eslint-disable no-use-before-define /
/
Generated by javaflow 1.5.0 */

Example:

package domain.document;

import domain.person.*;

public class Document {
    private long id;
    private Person person;
    
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }
}
package domain.person;

import domain.document.*;

import java.util.Set;

public class Person {
    private long id;
    private Set<Document> documentSet;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Set<Document> getDocumentSet() {
        return documentSet;
    }

    public void setDocumentSet(Set<Document> documentSet) {
        this.documentSet = documentSet;
    }
}

Command for execute: javaflow domain/
Result:

Exception in thread "main" com.github.havardh.javaflow.exceptions.AggregatedException: Verification failed:

Could not find types: {domain.document.Document=[person: domain.document.Person]}
  at com.github.havardh.javaflow.Execution.verify(Execution.java:119)
  at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:372)
  at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419)
  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
  at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
  at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
  at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
  at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
  at com.github.havardh.javaflow.Execution.run(Execution.java:98)
  at com.github.havardh.javaflow.JavaFlow.main(JavaFlow.java:71)
@havardh
Copy link
Owner

havardh commented Feb 3, 2019

@spirit93 I suspect that bug might be in a to naive implementation of the name resolution in CanonicalNameFactory.build where the field name is matched with imported names. I'm however not sure how big the fix to this issue is.

If you have some time feel free to try to solve it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants