Complex method reference conversion fails unbox case

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • 9
    • Affects Version/s: 8u40
    • Component/s: 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('@'), '@');
          }

      }

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

              Created:
              Updated:
              Resolved: