Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

type parameter inference and conversions

843793May 2 2003 — edited May 9 2003
In this example:
public class X {
  private static <T> T f(T t) {
    return t;
  }
  public static void main(String[] args) {
    f(5); 
  }
}
Would the call to f be illegal? Or would it be legal and invoke
<Integer>f
and perform a boxing conversion on the method argument?

Basically it is the question regarding the impact of conversions on the inference process. What is the relationship between type parameter inference and method argument conversions? The spec does not say anything, or does it?

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 6 2003
Added on May 2 2003
3 comments
49 views