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 ebaa595183..edfce327cd 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 @@ -108,8 +108,8 @@ class EventFilter implements IDebugEventFilter { public DebugEvent[] filterDebugEvents(DebugEvent[] events) { if (events.length == 1) { DebugEvent event = events[0]; - if (event.getSource() instanceof IJavaVariable && event.getKind() == DebugEvent.CHANGE) { - if (((IJavaVariable) event.getSource()).getDebugTarget().equals(getDebugTarget())) { + if (event.getSource() instanceof IJavaVariable jvar && event.getKind() == DebugEvent.CHANGE) { + if (jvar.getDebugTarget().equals(getDebugTarget())) { return null; } } 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 ce77c40304..4ed6996ede 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 @@ -16,6 +16,7 @@ import java.text.MessageFormat; import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; @@ -220,10 +221,17 @@ public int breakpointHit(IJavaThread thread, IJavaBreakpoint breakpoint) { .getTopStackFrame(); IJavaProject project = lineBreakpoint.getJavaProject(frame); if (project == null) { - IMarker marker = breakpoint.getMarker(); // my changes + IMarker marker = breakpoint.getMarker(); if (marker != null) { IResource res = marker.getResource(); - project = JavaCore.create(res.getProject()); + IProject curProject = res.getProject(); + if (curProject != null) { + project = JavaCore.create(curProject); + } else { + fireConditionHasErrors(lineBreakpoint, new Message[] { + new Message(JDIDebugBreakpointMessages.JavaLineBreakpoint_Unable_to_compile_conditional_breakpoint___missing_Java_project_context__1, -1) }); + return SUSPEND; + } } else { fireConditionHasErrors(lineBreakpoint, new Message[] { new Message(JDIDebugBreakpointMessages.JavaLineBreakpoint_Unable_to_compile_conditional_breakpoint___missing_Java_project_context__1, -1) });