Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 94723

Summary: [inline] Problems invoking on Method with varargs
Product: [Eclipse Project] JDT Reporter: Benjamin Pasero <ENJ>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Brian.Miller, markus.kell.r
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Benjamin Pasero CLA 2005-05-11 10:32:43 EDT
Version: 3.1.0
Build id: I20050509-2010

Steps to reproduce:
1.) Have a Class Foo:

public class Foo {
    void foo() {
        argtest(new ArrayList<Integer>());
    }

    void argtest(ArrayList<? extends Number>... al) {
    }
}

2.) Call Refactor > Inline on "argtest"

Actual Results:

void foo() {
  ArrayList<? extends Number>[] al = { new ArrayList<Integer>() };
}

results in an error: Cannot create a generic array of ArrayList<? extends Number>

Expected Results:
No Compile Error.

Regards,
Ben
Comment 1 Markus Keller CLA 2005-08-08 06:27:16 EDT
Note: the compiler should issue an type safety warning for the call
'argtest(new ArrayList<Integer>())' (see Bug 106325).

The solution would be one of these (both also producing a type safety warning:

a.) ArrayList<? extends Number>[] al= new ArrayList[] {new ArrayList<Integer>()};

b.) ArrayList<? extends Number>[] al=
    (ArrayList<? extends Number>[]) new ArrayList<?>[] {new ArrayList<Integer>()};
Comment 2 Eclipse Genie CLA 2018-11-04 15:19:09 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.