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

Type name collisions with java pacakges #42

Open
JacobMountain opened this issue Dec 30, 2020 · 3 comments
Open

Type name collisions with java pacakges #42

JacobMountain opened this issue Dec 30, 2020 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@JacobMountain
Copy link
Owner

Steps to reproduce
Schema:

schema {
    query: Query
}
type Query {
    character: Character
}
type Character {
    id: Int
    name: String
}

Interface:

package com.example;

import com.jacobmountain.graphql.client.GraphQLClient;
import com.example.dto.Character; // <-- 

@GraphQLClient(
        schema = "Schema.gql"
)
public interface MyClient {

    public Character getCharacter();

}

Generated implementation:

package com.example;

import com.jacobmountain.graphql.client.GraphQLClient;
import java.util.Character; // <-- this is the problem

@GraphQLClient(
        schema = "Schema.gql"
)
public interface MyClient {

    public Character getCharacter() {
        // impl...
    }

}
@JacobMountain JacobMountain added the bug Something isn't working label Dec 30, 2020
@JacobMountain JacobMountain added this to the 1.0.0 milestone Dec 30, 2020
@JacobMountain
Copy link
Owner Author

JacobMountain commented Dec 30, 2020

Worth noting that there is a work-around to fully qualify the import package in the return type. e.g:

package com.example;

import com.jacobmountain.graphql.client.GraphQLClient;

@GraphQLClient(
        schema = "Schema.gql"
)
public interface MyClient {

    public com.example.dto.Character getCharacter();

}

@JacobMountain
Copy link
Owner Author

It seems that not all java types are causing this issue, somehow the only one I've replicated with has been Character.

@JacobMountain
Copy link
Owner Author

The issue appears to be in MethodDetailsVisitor when we visit the interface to gather details executableElement.getReturnType() returns the wrong Character class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant