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

When using ProxyBuilder#withSharedClassLoader(), the proxy classes for the same class will be the same even though different interfaces are specified by implementing() #124

Closed
tmurakami opened this issue Nov 11, 2018 · 2 comments

Comments

@tmurakami
Copy link
Contributor

  • dexmaker 2.19.1
public class ProxyBuilderTest {

    @Test
    public void test() throws IOException {
        Class<?> c1 = ProxyBuilder.forClass(C.class)
                                  .implementing(I1.class)
                                  .withSharedClassLoader()
                                  .buildProxyClass();
        Class<?> c2 = ProxyBuilder.forClass(C.class)
                                  .implementing(I2.class)
                                  .withSharedClassLoader()
                                  .buildProxyClass();
        assertNotSame(c1, c2); // java.lang.AssertionError: expected not same
    }

    static class C {
    }

    interface I1 {
    }

    interface I2 {
    }

}
@moltmann
Copy link
Contributor

yes. We need to consider the interfaces when we generate the file name for the class in Dexmaker#generateFileName

Do you want to add the test and fix?

@tmurakami
Copy link
Contributor Author

I guess the cause of this issue is that ProxyBuilder#getMethodNameForProxyOf() returns the same value.
I wonder if we need to modify DexMaker#generateFileName().

Anyway, I will try sending a PR.

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