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

compile fail when using generics params #4

Closed
qw623577789 opened this issue Nov 2, 2021 · 1 comment
Closed

compile fail when using generics params #4

qw623577789 opened this issue Nov 2, 2021 · 1 comment

Comments

@qw623577789
Copy link

qw623577789 commented Nov 2, 2021

image

raw code

@Async(logResultTree = true)
public <G> JPromise<G> get(Class<G> format) {
    Long data = JAsync.just(1l).await();
    return JAsync.just(format.cast(data));
}

compiled code

@Async(logResultTree = true)
public <G> JPromise<Void> get(Class<G> format) {
  return JAsync
    .just(1L)
    .thenVoid(
      indyHelper$$0.voidPromiseFunction(
        "get$$tmp$$1",
        java.lang.invoke.MethodType.methodType(
          io.github.vipcxj.jasync.spec.JPromise.class,
          java.lang.Class.class,
          java.lang.Long.class
        ),
        format
      )
    )
    .catchReturn();
}

private io.github.vipcxj.jasync.spec.JPromise<java.lang.Void> get$$tmp$$1(
  final java.lang.Class<G> format,
  final java.lang.Long tmp$$0
)
  throws java.lang.Throwable {
  Long data = tmp$$0;
  return io.github.vipcxj.jasync.spec.JAsync.doReturn(
    JAsync.just(format.cast(data))
  );
}

private static final io.github.vipcxj.jasync.runtime.java8.helpers.IndyHelpers indyHelpers$$0 = new io.github.vipcxj.jasync.runtime.java8.helpers.IndyHelpers(
  java.lang.invoke.MethodHandles.lookup()
);
private final io.github.vipcxj.jasync.runtime.java8.helpers.IndyHelper indyHelper$$0 = new io.github.vipcxj.jasync.runtime.java8.helpers.IndyHelper(
  indyHelpers$$0,
  this
);

loss the generics type in sub function
image

@vipcxj
Copy link
Owner

vipcxj commented Nov 2, 2021

I have just released v0.1.4 that references this issue.

Closing this issue. Please re-open if you think there's still more to do.

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