diff --git a/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF index d091a30d65..a6398191f7 100644 --- a/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jdt.debug.tests; singleton:=true -Bundle-Version: 3.12.500.qualifier +Bundle-Version: 3.12.600.qualifier Bundle-ClassPath: javadebugtests.jar Bundle-Activator: org.eclipse.jdt.debug.testplugin.JavaTestPlugin Bundle-Vendor: %providerName diff --git a/org.eclipse.jdt.debug.tests/pom.xml b/org.eclipse.jdt.debug.tests/pom.xml index 6fd71e5434..bfedb46d53 100644 --- a/org.eclipse.jdt.debug.tests/pom.xml +++ b/org.eclipse.jdt.debug.tests/pom.xml @@ -18,7 +18,7 @@ org.eclipse.jdt org.eclipse.jdt.debug.tests - 3.12.500-SNAPSHOT + 3.12.600-SNAPSHOT eclipse-test-plugin ${project.artifactId} diff --git a/org.eclipse.jdt.debug.tests/testprograms/FileConditionSnippet2.java b/org.eclipse.jdt.debug.tests/testprograms/FileConditionSnippet2.java index 216291136a..6099906d3c 100644 --- a/org.eclipse.jdt.debug.tests/testprograms/FileConditionSnippet2.java +++ b/org.eclipse.jdt.debug.tests/testprograms/FileConditionSnippet2.java @@ -6,8 +6,6 @@ public static void main(String[] ecs) { File parent = new File("parent"); File file = new File(parent,"test"); System.out.println("COMPLETED"); + System.out.println("COMPLETED"); } - -} - -///////////////////////////////////////// +} \ No newline at end of file diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java index 7e5f9661e8..b9474b5f00 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java @@ -184,7 +184,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation public static final String BOUND_JRE_PROJECT_NAME = "BoundJRE"; public static final String CLONE_SUFFIX = "Clone"; - final String[] LAUNCH_CONFIG_NAMES_1_4 = { "java.io.File", "FileConditionSnippet2", "LargeSourceFile", "LotsOfFields", + final String[] LAUNCH_CONFIG_NAMES_1_4 = { "LargeSourceFile", "LotsOfFields", "Breakpoints", "InstanceVariablesTests", "LocalVariablesTests", "LocalVariableTests2", "StaticVariablesTests", @@ -204,7 +204,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation "StepResult2", "StepResult3", "StepUncaught", "TriggerPoint_01", "BulkThreadCreationTest", "MethodExitAndException", "Bug534319earlyStart", "Bug534319lateStart", "Bug534319singleThread", "Bug534319startBetwen", "MethodCall", "Bug538303", "Bug540243", "OutSync", "OutSync2", "ConsoleOutputUmlaut", "ErrorRecurrence", "ModelPresentationTests", "Bug565982", - "SuspendVMConditionalBreakpointsTestSnippet" }; + "SuspendVMConditionalBreakpointsTestSnippet", "FileConditionSnippet2" }; /** * the default timeout @@ -1539,14 +1539,13 @@ protected IJavaThread launchToLineBreakpoint(String mainTypeName, ILineBreakpoin */ protected IJavaThread launchToLineBreakpoint(ILaunchConfiguration config, ILineBreakpoint bp, boolean register) throws Exception { DebugEventWaiter waiter= new DebugElementKindEventDetailWaiter(DebugEvent.SUSPEND, IJavaThread.class, DebugEvent.BREAKPOINT); - waiter.setTimeout(30000); + waiter.setTimeout(DEFAULT_TIMEOUT); waiter.setEnableUIEventLoopProcessing(enableUIEventLoopProcessingInWaiter()); Object suspendee= launchAndWait(config, waiter, register); assertTrue("suspendee was not an IJavaThread", suspendee instanceof IJavaThread); //$NON-NLS-1$ IJavaThread thread = (IJavaThread) suspendee; IBreakpoint hit = getBreakpoint(thread); - assertNotNull("suspended, but not by breakpoint", hit); //$NON-NLS-1$ assertEquals("hit un-registered breakpoint", bp, hit); //$NON-NLS-1$ assertTrue("suspended, but not by line breakpoint", hit instanceof ILineBreakpoint); //$NON-NLS-1$ @@ -1554,7 +1553,6 @@ protected IJavaThread launchToLineBreakpoint(ILaunchConfiguration config, ILineB int lineNumber = breakpoint.getLineNumber(); int stackLine = thread.getTopStackFrame().getLineNumber(); assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine); //$NON-NLS-1$ - return thread; } diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java index c9615813f3..81282945e0 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java @@ -26,6 +26,7 @@ import org.eclipse.jdt.debug.tests.breakpoints.BreakpointWorkingSetTests; import org.eclipse.jdt.debug.tests.breakpoints.ConditionalBreakpointsInJava8Tests; import org.eclipse.jdt.debug.tests.breakpoints.ConditionalBreakpointsTests; +import org.eclipse.jdt.debug.tests.breakpoints.ConditionalBreakpointsWithFileClass; import org.eclipse.jdt.debug.tests.breakpoints.ConditionalBreakpointsWithGenerics; import org.eclipse.jdt.debug.tests.breakpoints.DeferredBreakpointTests; import org.eclipse.jdt.debug.tests.breakpoints.ExceptionBreakpointTests; @@ -392,6 +393,7 @@ public AutomatedSuite() { addTest(new TestSuite(TestToggleBreakpointsTarget.class)); addTest(new TestSuite(TriggerPointBreakpointsTests.class)); addTest(new TestSuite(JavaThreadEventHandlerTests.class)); + addTest(new TestSuite(ConditionalBreakpointsWithFileClass.class)); if (JavaProjectHelper.isJava8Compatible()) { addTest(new TestSuite(TestToggleBreakpointsTarget8.class)); diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithFileClass.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithFileClass.java index fbef39c4a6..180c1fa437 100644 --- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithFileClass.java +++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithFileClass.java @@ -1,54 +1,61 @@ 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); } - public void testFileConditionalBreakpointForTrue() throws Exception { - String typeName = "FileConditionSnippet2"; - IJavaLineBreakpoint bp = createLineBreakpoint(7, typeName); - createConditionalLineBreakpoint(374, "java.io.File", "child.equals(\"test\")", true); + @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 { - mainThread = launchToLineBreakpoint(typeName, bp); - mainThread.resume(); - Thread.sleep(100); + Thread.sleep(10); + mainThread = launchToBreakpoint(typeName); int hitLine = 0; - if (mainThread.isSuspended()) { - hitLine = mainThread.getStackFrames()[0].getLineNumber(); - } - assertTrue("Should hit", (hitLine == 374) && (mainThread.isSuspended() == true)); + assertTrue("Thread should be suspended", mainThread.isSuspended()); + hitLine = mainThread.getStackFrames()[0].getLineNumber(); + assertEquals("JENKINS FILE CLASS TESTING", 8, hitLine); + + bp2.delete(); + bp3.delete(); } finally { - bp.delete(); terminateAndRemove(mainThread); removeAllBreakpoints(); } } - public void testFileConditionalBreakpointForFalse() throws Exception { + public void testFileConditionalBreakpointforTrue() throws Exception { String typeName = "FileConditionSnippet2"; - IJavaLineBreakpoint bp = createLineBreakpoint(7, typeName); - createConditionalLineBreakpoint(374, "java.io.File", "child.equals(\"test2\")", true); - + IJavaLineBreakpoint bp3 = createLineBreakpoint(8, typeName); + IJavaLineBreakpoint bp2 = createConditionalLineBreakpoint(364, "java.io.File", "true", true); IJavaThread mainThread = null; + try { - mainThread = launchToLineBreakpoint(typeName, bp); - mainThread.resume(); - Thread.sleep(100); + Thread.sleep(10); + mainThread = launchToBreakpoint(typeName); int hitLine = 0; - if (mainThread.isSuspended()) { - hitLine = mainThread.getStackFrames()[0].getLineNumber(); - } - assertFalse("Should hit", (hitLine == 374) && (mainThread.isSuspended() == true)); + assertTrue("Thread should be suspended", mainThread.isSuspended()); + hitLine = mainThread.getStackFrames()[0].getLineNumber(); + assertEquals("JENKINS FILE CLASS TESTING", 364, hitLine); + + bp2.delete(); + bp3.delete(); } finally { - bp.delete(); terminateAndRemove(mainThread); removeAllBreakpoints(); } diff --git a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF index b6a0a4d69d..bba45960b3 100644 --- a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jdt.debug; singleton:=true -Bundle-Version: 3.21.500.qualifier +Bundle-Version: 3.21.600.qualifier Bundle-ClassPath: jdimodel.jar Bundle-Activator: org.eclipse.jdt.internal.debug.core.JDIDebugPlugin Bundle-Vendor: %providerName diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java index fbf79245aa..2221840905 100644 --- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java +++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2022 IBM Corporation and others. + * Copyright (c) 2000, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -687,10 +687,12 @@ private ICompiledExpression createExpressionFromAST(String snippet, || problemId == IProblem.NotVisibleConstructor || problemId == IProblem.NotVisibleField || problemId == IProblem.NotVisibleType - || problemId == IProblem.UnexpectedStaticModifierForMethod || problemId == IProblem.AmbiguousType) { + || problemId == IProblem.UnexpectedStaticModifierForMethod || problemId == IProblem.AmbiguousType + || problemId == IProblem.UninitializedBlankFinalField + || problemId == IProblem.ParsingErrorDeleteTokens || problemId == IProblem.ParsingErrorInsertToComplete) { continue; - } + } if (problem.isError()) { if (codeSnippetStart <= errorOffset && errorOffset <= codeSnippetEnd) { @@ -699,7 +701,8 @@ private ICompiledExpression createExpressionFromAST(String snippet, } else if (runMethodStart <= errorOffset && errorOffset <= runMethodEnd) { runMethodError = true; - DebugPlugin.log(new Status(IStatus.WARNING, DebugPlugin.getUniqueIdentifier(), "Compile error during code evaluation: " //$NON-NLS-1$ + DebugPlugin.log(new Status(IStatus.WARNING, DebugPlugin.getUniqueIdentifier(), "Compile error during code evaluation: Problem Id -> " //$NON-NLS-1$ + + problemId + problem.getMessage())); } } diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ConditionalBreakpointHandler.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ConditionalBreakpointHandler.java index 91656805d6..0143d80926 100644 --- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ConditionalBreakpointHandler.java +++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ConditionalBreakpointHandler.java @@ -15,6 +15,8 @@ import java.text.MessageFormat; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -23,6 +25,7 @@ import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IValue; import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.dom.Message; import org.eclipse.jdt.debug.core.IJavaBreakpoint; import org.eclipse.jdt.debug.core.IJavaBreakpointListener; @@ -217,12 +220,15 @@ public int breakpointHit(IJavaThread thread, IJavaBreakpoint breakpoint) { .getTopStackFrame(); IJavaProject project = lineBreakpoint.getJavaProject(frame); if (project == null) { - fireConditionHasErrors( - lineBreakpoint, - new Message[] { new Message( - JDIDebugBreakpointMessages.JavaLineBreakpoint_Unable_to_compile_conditional_breakpoint___missing_Java_project_context__1, - -1) }); - return SUSPEND; + IMarker marker = breakpoint.getMarker(); // my changes + if (marker != null) { + IResource res = marker.getResource(); + project = JavaCore.create(res.getProject()); + } else { + fireConditionHasErrors(lineBreakpoint, new Message[] { + new Message(JDIDebugBreakpointMessages.JavaLineBreakpoint_Unable_to_compile_conditional_breakpoint___missing_Java_project_context__1, -1) }); + return SUSPEND; + } } IJavaDebugTarget target = (IJavaDebugTarget) thread .getDebugTarget();