Bug 83657

Summary: [1.5] autoboxing parameter
Product: [Eclipse Project] JDT Reporter: Hasko Heinecke <h_heinecke>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Hasko Heinecke CLA 2005-01-25 15:59:52 EST
Using build 200411050810, will check latest integration build tomorrow.

Here's a case where I believe autounboxing should work but doesn't.

  public class TestGeneric<T> {

    public T getSomething(T param) {
      // Note we are passing the parameter through, whatever it's type is
      return param;
    }
  }

  public class TestCaller {
  
    public void someMethod(boolean param) {
      // do nothing
    }

    public void test() {
      TestGeneric<Boolean> tbg = new TestGeneric<Boolean>();
      // The next line doesn't compile
      // because Boolean is not compatible with boolean
      test(tgb.getSomething(true));
    }
}
Comment 1 Hasko Heinecke CLA 2005-01-25 16:02:10 EST
By the way, explicit conversion is a work-around:

  test(tgb.getSomething(true).booleanValue());
Comment 2 Olivier Thomann CLA 2005-01-25 16:12:44 EST
I think your test case is more something like this:

public class X<T> {
    public T getSomething(T param) {
      return param;
    }
}
  
class Y {
    public void someMethod(boolean param) {
      // do nothing
    }

    public void test() {
      X<Boolean> x = new X<Boolean>();
      someMethod(x.getSomething(true));
    }
}

This does compile fine with latest.
Closing as WORKSFORME.