-
Notifications
You must be signed in to change notification settings - Fork 22
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
MutableCallSite
does not work?
#205
Comments
Hi, thanks for getting in touch. Can you provide an example demonstrating the problem?
With an example we will be able to identify and fix the problem. |
Sorry, I misunderstood. Maybe not https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/SwitchPoint.html package example;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.SwitchPoint;
public class Main {
public static void main(String[] args) throws Throwable {
MethodHandle MH_strcat = MethodHandles.lookup().findVirtual(String.class, "concat", MethodType.methodType(String.class, String.class));
SwitchPoint spt = new SwitchPoint();
assert(!spt.hasBeenInvalidated());
MethodHandle worker1 = MH_strcat;
MethodHandle worker2 = MethodHandles.permuteArguments(MH_strcat, MH_strcat.type(), 1, 0);
MethodHandle worker = spt.guardWithTest(worker1, worker2);
System.out.println(worker);
}
} |
MethodHandle#invokeExact
does not workjava.lang.invoke.SwitchPoint
does not work
I can't reproduce this problem, can you please try again with a recent nightly build? |
I have another similar problem. (sorry for in succession)
package example;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.MutableCallSite;
public class Main {
public static void main(String[] args) throws Throwable {
MutableCallSite name = new MutableCallSite(MethodType.methodType(String.class));
MethodHandle MH_name = name.dynamicInvoker();
MethodType MT_str1 = MethodType.methodType(String.class);
MethodHandle MH_upcase = MethodHandles.lookup().findVirtual(String.class, "toUpperCase", MT_str1);
MethodHandle worker1 = MethodHandles.filterReturnValue(MH_name, MH_upcase);
name.setTarget(MethodHandles.constant(String.class, "Rocky"));
String x1 = (String) worker1.invokeExact(); // ClassCastException
System.out.println(x1);
}
} |
java.lang.invoke.SwitchPoint
does not workMethodHandle
does not work?
MethodHandle
does not work?MutableCallSite
does not work?
I can confirm this issue. I've added it to our internal bug tracking system and we'll take a look when we can. Is there any practical use case for this? It seems to be a technical corner case, since it never emerged from any of our customers or internal testing. |
I have tried run scala lang compiler in web browser. old version work but new version does not work due to |
No description provided.
The text was updated successfully, but these errors were encountered: