Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352448 - [inline][1.7] Inline should not be available for variables used in the resource specification of try-with-resources
Summary: [inline][1.7] Inline should not be available for variables used in the resour...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-19 08:12 EDT by Ayushman Jain CLA
Modified: 2011-08-02 05:45 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-07-19 08:12:52 EDT
BETA_JAVA7

class Test{
public static void main(String[] args) throws IOException {
    try (FileInputStream fis = new FileInputStream("")) {
            FileInputStream fis2 = fis;
        }
}
}

right click on fis> refactor> Inline..

You get

class Test{
public static void main(String[] args) throws IOException {
    try (FileInputStream) {
            FileInputStream fis2 = new FileInputStream("");
        }
}
}

(My use case was:
try (FileInputStream fis = new FileInputStream(""); FileInputStream fis2 = fis) {
...
}
and i was only using fis2 in the the try block, so thought of inlining fis)
Comment 1 Deepak Azad CLA 2011-07-26 07:29:49 EDT
Fix is part of the patch in bug 352445 comment 4.
Comment 2 Raksha Vasisht CLA 2011-08-02 05:05:02 EDT
Verified for Juno M1 with 4.2 build I20110729-0200.