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

Complex method reference conversion fails unbox case

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 8u40
    • tools
    • generic
    • generic

      Modifying this test to make the method private fails --

      import org.testng.annotations.Test;

      import static org.testng.Assert.assertEquals;

      /**
       * @author Robert Field
       */

      @Test
      public class MethodReferenceTestTypeConversion {

          class MethodReferenceTestTypeConversion_E<T> {
              private T xI(T t) { return t; }
          }

          interface ISi { int m(Short a); }

          interface ICc { char m(Character a); }

          public void testUnboxObjectToNumberWiden() {
              ISi q = (new MethodReferenceTestTypeConversion_E<Short>())::xI;
              assertEquals(q.m((short)77), (short)77);
          }

          public void testUnboxObjectToChar() {
              ICc q = (new MethodReferenceTestTypeConversion_E<Character>())::xI;
              assertEquals(q.m('@'), '@');
          }

      }

            sadayapalam Srikanth Adayapalam (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: