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

Bug 409520

Summary: [1.8][quick fix] "Add unimplemented methods" should not create stubs for default methods
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Martin Mathew <manju656>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, manju656, noopur_gupta
Version: 4.3Flags: daniel_megert: review+
Target Milestone: 4.3.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 403924    
Bug Blocks:    
Attachments:
Description Flags
Patch with testcases. none

Description Markus Keller CLA 2013-05-30 12:58:01 EDT
BETA_JAVA8 and master

The "Add unimplemented methods" quick fix should not create stubs for default methods.

public class MyString implements CharSequence {
}

=> When compiling against a 1.8 JRE, the quick fix also adds stubs for chars() and codePoints(), which are new default methods in CharSequence.

"Source > Override/Implement Methods" already looks good (only selects abstract methods).
Comment 1 Markus Keller CLA 2013-05-30 12:58:58 EDT
Tentatively targeting 4.3.1.
Comment 2 Martin Mathew CLA 2013-06-12 05:26:04 EDT
Created attachment 232274 [details]
Patch with testcases.

With this patch only abstract method stubs will be created during the "Add unimplemented methods" quick fix. Added 2 testcases for this scenario.
Comment 3 Martin Mathew CLA 2013-06-12 05:31:31 EDT
Marking it as dependent on bug 403924 as StubUtility2 has 2 instances where it uses #thrownExceptions.

@Noopur, can you review the patch and give an initial feedback?
Comment 4 Martin Mathew CLA 2013-06-12 06:44:53 EDT
*** Bug 406277 has been marked as a duplicate of this bug. ***
Comment 5 Noopur Gupta CLA 2013-06-13 02:09:04 EDT
(In reply to comment #3) 
> @Noopur, can you review the patch and give an initial feedback?

The patch looks good. It covers both default and static methods of interface, by allowing only abstract methods to be added for implementation.

In the tests, JavaProjectHelper#addRTJar18 should call set18CompilerOptions(IJavaProject) instead of #set17CompilerOptions.
Comment 7 Noopur Gupta CLA 2013-08-05 06:08:50 EDT
Verified in 4.4 using Build id: I20130804-2300 and verified for 4.3.1 using
Build id: M20130731-0800.
Comment 8 Dani Megert CLA 2013-08-08 09:57:40 EDT
Marking as verified as indicated in comment 7.