Skip to content

Commit a2af077

Browse files
committed
Show actual Object value when detail formatter has module conflict
This commit cancels detail formatting process of objects whenever the generated expression have module related errors Fixes : #747
1 parent ad20ccf commit a2af077

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ private Expression getCompiledExpression(IJavaObject javaObject, IJavaDebugTarge
466466
.getCompiledExpression(snippet, javaObject);
467467
if (res != null) {
468468
Expression exp = new Expression(res, evaluationEngine);
469+
if (exp.getExpression().hasModuleConflicts()) {
470+
return null;
471+
}
469472
fCacheMap.put(key, exp);
470473
return exp;
471474
}

org.eclipse.jdt.debug/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.jdt.debug; singleton:=true
5-
Bundle-Version: 3.23.100.qualifier
5+
Bundle-Version: 3.24.0.qualifier
66
Bundle-ClassPath: jdimodel.jar
77
Bundle-Activator: org.eclipse.jdt.internal.debug.core.JDIDebugPlugin
88
Bundle-Vendor: %providerName

org.eclipse.jdt.debug/eval/org/eclipse/jdt/debug/eval/ICompiledExpression.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2011 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -62,4 +62,12 @@ public interface ICompiledExpression {
6262
*/
6363
public String[] getErrorMessages();
6464

65+
/**
66+
* Returns whether the expression has any module conflicts or not.
67+
*
68+
* @return whether the expression has any module conflicts or not.
69+
* @since 3.24
70+
*/
71+
public boolean hasModuleConflicts();
72+
6573
}

org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/ASTEvaluationEngine.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2024 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -629,10 +629,12 @@ private ICompiledExpression createExpressionFromAST(String snippet, EvaluationSo
629629
runMethodError = true;
630630
DebugPlugin.log(new Status(IStatus.WARNING, DebugPlugin.getUniqueIdentifier(), "Compile error during code evaluation: " //$NON-NLS-1$
631631
+ problem.getMessage()));
632+
} else if (problemId == IProblem.ConflictingPackageFromModules || problemId == IProblem.ConflictingPackageFromOtherModules) {
633+
errorSequence.setModuleConflict(true);
632634
}
633635
}
634636
}
635-
if (snippetError || runMethodError) {
637+
if (snippetError || runMethodError || errorSequence.hasModuleConflicts()) {
636638
if (runMethodError) {
637639
errorSequence.addError(EvaluationEngineMessages.ASTEvaluationEngine_Evaluations_must_contain_either_an_expression_or_a_block_of_well_formed_statements_1);
638640
}

org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/InstructionSequence.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2015 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -30,11 +30,13 @@ public class InstructionSequence implements ICompiledExpression {
3030
private final List<String> fErrors;
3131
private final String fSnippet;
3232
private CoreException fException;
33+
private boolean fhasModuleErrors;
3334

3435
public InstructionSequence(String snippet) {
3536
fInstructions = new ArrayList<>(10);
3637
fErrors = new ArrayList<>();
3738
fSnippet = snippet;
39+
fhasModuleErrors = false;
3840
}
3941

4042
/**
@@ -147,4 +149,19 @@ public Instruction get(int address) {
147149
public int getEnd() {
148150
return fInstructions.size() - 1;
149151
}
152+
153+
/**
154+
* Sets whether the expression has any module conflicting issues or not.
155+
*/
156+
public void setModuleConflict(boolean moduleConflict) {
157+
fhasModuleErrors = moduleConflict;
158+
}
159+
160+
/**
161+
* @see org.eclipse.jdt.debug.eval.ICompiledExpression#hasModuleConflicts()
162+
*/
163+
@Override
164+
public boolean hasModuleConflicts() {
165+
return fhasModuleErrors;
166+
}
150167
}

0 commit comments

Comments
 (0)