-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditional breakpoint in java.io.File class fix + code review changes
- Loading branch information
Showing
6 changed files
with
205 additions
and
199 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
org.eclipse.jdt.debug.tests/testprograms/FileConditionSnippet2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 IBM Corporation. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
import java.io.File; | ||
|
||
public class FileConditionSnippet2 { | ||
public static void main(String[] ecs) { | ||
int i = 0; | ||
File parent = new File("parent"); | ||
File file = new File(parent,"test"); | ||
System.out.println("COMPLETED"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...ts/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithFileClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* IBM Corporation -- initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.jdt.debug.tests.breakpoints; | ||
|
||
import org.eclipse.jdt.core.IJavaProject; | ||
import org.eclipse.jdt.debug.core.IJavaLineBreakpoint; | ||
import org.eclipse.jdt.debug.core.IJavaThread; | ||
import org.eclipse.jdt.debug.tests.AbstractDebugTest; | ||
|
||
public class ConditionalBreakpointsWithFileClass extends AbstractDebugTest { | ||
|
||
|
||
public ConditionalBreakpointsWithFileClass(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
protected IJavaProject getProjectContext() { | ||
return get14Project(); | ||
} | ||
|
||
public void testFileConditionalBreakpointforFalse() throws Exception { | ||
String typeName = "FileConditionSnippet2"; | ||
IJavaLineBreakpoint bp3 = createLineBreakpoint(20, typeName); | ||
IJavaLineBreakpoint bp2 = createConditionalLineBreakpoint(364, "java.io.File", "false", true); | ||
IJavaThread mainThread = null; | ||
try { | ||
Thread.sleep(10); | ||
mainThread = launchToBreakpoint(typeName); | ||
int hitLine = 0; | ||
assertTrue("Thread should be suspended", mainThread.isSuspended()); | ||
hitLine = mainThread.getStackFrames()[0].getLineNumber(); | ||
assertEquals("Didn't suspend at the expected line", 20, hitLine); | ||
|
||
bp2.delete(); | ||
bp3.delete(); | ||
} finally { | ||
terminateAndRemove(mainThread); | ||
removeAllBreakpoints(); | ||
} | ||
} | ||
|
||
public void testFileConditionalBreakpointforTrue() throws Exception { | ||
String typeName = "FileConditionSnippet2"; | ||
IJavaLineBreakpoint bp3 = createLineBreakpoint(20, typeName); | ||
IJavaThread mainThread = null; | ||
|
||
try { | ||
Thread.sleep(10); | ||
mainThread = launchToBreakpoint(typeName); | ||
mainThread.getTopStackFrame().stepInto(); | ||
IJavaLineBreakpoint bp2 = createConditionalLineBreakpoint(364, "java.io.File", "true", true); | ||
int hitLine = 0; | ||
mainThread.resume(); | ||
Thread.sleep(1000); | ||
assertTrue("Thread should be suspended", mainThread.isSuspended()); | ||
hitLine = mainThread.getStackFrames()[0].getLineNumber(); | ||
assertEquals("Didn't suspend at the expected line", 364, hitLine); | ||
|
||
bp2.delete(); | ||
bp3.delete(); | ||
} finally { | ||
terminateAndRemove(mainThread); | ||
removeAllBreakpoints(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.