Community
Participate
Working Groups
BETA_JAVA7 class Test{ public static void main(String[] args) throws IOException { try (FileInputStream fis = null) { } } } Select FileInputStream fis = null > refactor> extract local variable is proposed. Choosing it gives some garbage code.
Also the same happens with the "Extract constant" refactoring on class Test{ public static void main(String[] args) throws IOException { try (FileInputStream fis = new FileInputStream("")) { } } } (select the whole of FileInputStream fis = new FileInputStream("") ). IMHO, these 2 refactorings should be disabled.
Confirmed. Deepak, please take a look.
Adding extract method to the list.
Created attachment 200259 [details] proposed fix + tests The patch contains 3 new strings to explain why a refactoring is not enabled. Dani is it possible to add these now ? (The patch also has the fix for Bug 352445)
(In reply to comment #4) > Created attachment 200259 [details] [diff] > proposed fix + tests > > The patch contains 3 new strings to explain why a refactoring is not enabled. > Dani is it possible to add these now ? Yes. > (The patch also has the fix for Bug > 352445) You probably meant "bug 352448". NOTE: You forgot to add the legal blurb to ConstantChecks.java ExtractMethodAnalyzer.java
(In reply to comment #5) > > (The patch also has the fix for Bug > > 352445) > You probably meant "bug 352448". Yes :) (In reply to comment #4) > Created attachment 200259 [details] > proposed fix + tests Committed to BETA_JAVA7 (after addition of the missing legal blurbs).
Verified for Juno M1 with 4.2 build I20110729-0200.
.