-
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
9 changed files
with
117 additions
and
16 deletions.
There are no files selected for viewing
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
10 changes: 10 additions & 0 deletions
10
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,10 @@ | ||
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
77 changes: 77 additions & 0 deletions
77
...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,77 @@ | ||
/******************************************************************************* | ||
* 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(8, 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("JENKINS FILE CLASS TESTING", 8, hitLine); | ||
|
||
bp2.delete(); | ||
bp3.delete(); | ||
} finally { | ||
terminateAndRemove(mainThread); | ||
removeAllBreakpoints(); | ||
} | ||
} | ||
|
||
public void testFileConditionalBreakpointforTrue() throws Exception { | ||
String typeName = "FileConditionSnippet2"; | ||
IJavaLineBreakpoint bp3 = createLineBreakpoint(8, typeName); | ||
IJavaLineBreakpoint bp2 = createConditionalLineBreakpoint(364, "java.io.File", "true", 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("JENKINS FILE CLASS TESTING", 364, hitLine); | ||
|
||
bp2.delete(); | ||
bp3.delete(); | ||
} finally { | ||
terminateAndRemove(mainThread); | ||
removeAllBreakpoints(); | ||
} | ||
} | ||
|
||
} |
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
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