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

Complex method reference conversion fails unbox case

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8u40
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      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('@'), '@');
          }

      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sadayapalam Srikanth Adayapalam
              Reporter:
              rfield Robert Field
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: