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

Bug 537120

Summary: [10] Extracting methods should infer `var` parameters' type
Product: [Eclipse Project] JDT Reporter: Fred Bricon <fbricon>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, noopur_gupta
Version: 4.8   
Target Milestone: 4.9 M2   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Fred Bricon CLA 2018-07-17 16:01:28 EDT
Given a Java 10 project with 

public static void main(String[] args) {
    var foo = "String";
    System.err.println(foo);
}

extracting "System.err.println(foo);" to a method ultimately produces 

public static void main(String[] args) {
    var foo = "String";
    log(foo);
}

private static void log(var foo) {
    System.err.println(foo);
}


the intermediary wizard allows you to edit the foo parameter name, not the type. 
The type should be inferred as String in this case.
Comment 1 Jay Arthanareeswaran CLA 2018-07-18 01:50:10 EDT
Most likely belongs in the JDT/UI. Will take a look.
Comment 2 Noopur Gupta CLA 2018-07-18 03:39:45 EDT
See bug 535638 comment #1.

*** This bug has been marked as a duplicate of bug 535638 ***