Community
Participate
Working Groups
Created attachment 239501 [details] BP in interface methods interface I2 { default int m1() { int a = 1; return a + 2; } static void m2() { System.out.println("hi"); } } --------------------------------------------- Try to add a breakpoint within the default/static method above. We get the message as shown in the screenshot and the breakpoint is not added.
Created attachment 239730 [details] Allowing Method Breakpoints in interface This patch makes the breakpoints feasible for interface methods. The specific check to not allow the breakpoint on methods have been removed. Methods with code can have all breakpoints - entry/exit and method body. Watchpoints are still not supported.
(In reply to Sarika Sinha from comment #1) > Created attachment 239730 [details] > Allowing Method Breakpoints in interface > > This patch makes the breakpoints feasible for interface methods. The > specific check to not allow the breakpoint on methods have been removed. > Methods with code can have all breakpoints - entry/exit and method body. > Watchpoints are still not supported. The patch works nicely. Two nits: 1. can we get some test coverage for the new breakpoint locations? 2. can we update the failure message for a *normal* interface method? Currently it says 'Selection does not contain a method'. Better might be 'Cannot set a breakpoint on an unimplemented interface method'
Created attachment 239847 [details] Allowing Method Breakpoints in interface with Test Coverage Added test cases and the specific error message for Interface unimplemented method.
Created attachment 239848 [details] Allowing Method Breakpoints in interface with Test Cases
Created attachment 239853 [details] Allowing Method Breakpoints in interface with updated Test Cases Updated testcase scenario to cover bug 427077
Two of the new tests fail: junit.framework.AssertionFailedError: Breakpoint not added at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.assertTrue(Assert.java:22) at junit.framework.Assert.assertFalse(Assert.java:39) at junit.framework.TestCase.assertFalse(TestCase.java:210) at org.eclipse.jdt.debug.tests.breakpoints.AbstractToggleBreakpointsTarget$Listener.getAdded(AbstractToggleBreakpointsTarget.java:69) at org.eclipse.jdt.debug.tests.breakpoints.TestToggleBreakpointsTarget8.testInterfaceDefaultMethodBreakpoint(TestToggleBreakpointsTarget8.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at org.eclipse.jdt.debug.tests.AbstractDebugTest.runBare(AbstractDebugTest.java:2441) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at junit.framework.TestSuite.runTest(TestSuite.java:255) at org.eclipse.jdt.debug.tests.DebugSuite$1.run(DebugSuite.java:55) at java.lang.Thread.run(Thread.java:744) and junit.framework.AssertionFailedError: Should be a method breakpoint at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.assertTrue(Assert.java:22) at junit.framework.TestCase.assertTrue(TestCase.java:192) at org.eclipse.jdt.debug.tests.breakpoints.TestToggleBreakpointsTarget8.testInterfaceStaticMethodBreakpoint(TestToggleBreakpointsTarget8.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at org.eclipse.jdt.debug.tests.AbstractDebugTest.runBare(AbstractDebugTest.java:2441) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at junit.framework.TestSuite.runTest(TestSuite.java:255) at org.eclipse.jdt.debug.tests.DebugSuite$1.run(DebugSuite.java:55) at java.lang.Thread.run(Thread.java:744)
Created attachment 239889 [details] Allowing Method Breakpoints in interface with Test Cases Oops, missed to update the line no after test file update.
Pushed to BETA_JAVA8: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?h=BETA_JAVA8&id=d4649484ee4000714f673b5f272aeb14ed781f7e Thanks Sarika
Verified for Eclipse + Java 8 RC1 using Kepler SR2 + Eclipse Java Development Tools Patch for Java 8 Support (BETA) 1.0.0.v20140220-2054