Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320192

Summary: LocalEvaluationEngine never generates ClassFile for actual snippet
Product: [Eclipse Project] JDT Reporter: Eric Bodden <eric>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Eric Bodden CLA 2010-07-18 11:50:54 EDT
Build Identifier: I20100608-0911

Eclipse currently contains two eveluation engines: LocalEvaluationEngine and ASTEvaluationEngine. Both use CodeSnippetToCuMapper to generate a "__run" method that contains the snippet to be evaluated.

The problem is that this __run method always has return type "void". For ASTEvaluationEngine this is not a problem. When parsing the AST, the resulting typing error (void methods cannot return a value) is simply ignored. (see ASTEvaluationEngine.createExpressionFromAST(..), line 410)


For LocalEvaluationEngine, however, this typing error seems fatal. Due to the error, no ClassFile gets ever generated for the snippet. I wonder whether I am missing something or if LocalEvaluationEngine ever worked?

Can somebody clarify this? Thanks!

Reproducible: Always

Steps to Reproduce:
n/a
Comment 1 Darin Wright CLA 2010-07-19 09:40:35 EDT
The local evaluation uses JDT Core evaluation APIs to create and deploy class files locally. @see org.eclipse.jdt.core.eval.IEvaluationContext
Comment 2 Eric Bodden CLA 2010-07-19 13:22:38 EDT
(In reply to comment #1)
> The local evaluation uses JDT Core evaluation APIs to create and deploy class
> files locally. @see org.eclipse.jdt.core.eval.IEvaluationContext

Hi Darin.

Thanks for your comment. I am afraid I don't quite understand. Are you saying that (a) this is a not a bug for JDT/debug but rather for JDT/core or are you saying that (b) this is not a bug at all?

I did not find the comments in IEvaluationContext to be helpful because they do not address the issue that I described. (no class file generated)
Comment 3 Darin Wright CLA 2010-07-19 13:26:01 EDT
This is not a bug. Class files are created/compiled and deployed locally. The API used is:

org.eclipse.jdt.core.eval.IEvaluationContext.evaluateCodeSnippet(String, String[], String[], int[], IType, boolean, boolean, ICodeSnippetRequestor, IProgressMonitor)

The ICodeSnippetRequestor passed into the evaluation is called back with the class files that get deployed:

org.eclipse.jdt.core.eval.ICodeSnippetRequestor.acceptClassFiles(byte[][], String[][], String)