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

VM crash with a field setter method with a filterArguments

    XMLWordPrintable

Details

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

    Backports

      Description

        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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: