Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7129034

VM crash with a field setter method with a filterArguments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 8
    • 7, 8
    • core-libs

        The following test program crashes the VM.

        ----

        import java.lang.invoke.*;
        import java.lang.reflect.*;

        public class Test {
            public Test obj;
            public String str;

            public static void main(String[] args) throws Throwable {
                MethodHandles.Lookup l = MethodHandles.publicLookup();
                Field field = Test.class.getField("str");
                MethodHandle mh = l.unreflectSetter(field);
                MethodHandle filter = l.unreflectGetter(Test.class.getField("obj"));
                mh = MethodHandles.filterArguments(mh, 0, filter);
                mh.invokeExact(new Test(), "hello");
            }
        }

        ---

        The test crashes with the problematic frame "Unsafe_setObject". Without the filterArguments, if 'null' is directly passed to invokeExact as first argument, then we get WrongTypeException because null is inferred as Void type. But, when filterArguments and the filter returns null value, then the VM crashes.

              jrose John Rose
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: