Community
Participate
Working Groups
Build ID: M20080911-1700 LocalEvaluationEngine reports an error when a stack frame contains local variables of primitive types. The error message is: "<primitive type> cannot be resolved to a type". It is reported to the LocalEvaluationEngine through the acceptProblem method. I have attached a class which can be used to reproduce the problem. It is an action to be contributed to the DisplayView. It does the same thing as DisplayAction (actually it extends it), but it uses LocalEvaluationEngine instead of AST EE (Yes, I know it's missing engine.dispose() but I don't have time to fix it) Now, everything works normally except when performing an evaluation against the stack frame which contains the described local variables.
Created attachment 127974 [details] Same as DisplayAction but uses LocalEE
The issue appears to be with the implementation of IEvaluationContext on jdt.core. It is not accepting "int" or "I" as a type name. Jerome, what should be used to specify primitive type names when using this API on IEvaluationContext? evaluateCodeSnippet(String, String[], String[], int[], IType, boolean, boolean, ICodeSnippetRequestor, IProgressMonitor)
In theory, "int" should work. However looking at the code, it appears that it tries to resolve it as a regular type name. I think this bug should be moved to JDT/Core.
Thanks Jerome. Moving to JCore.
Ayushman, please investigate.
Created attachment 147587 [details] patch This was blocking progress on bug 289798 (just an experiment), but I did come up with the this patch that solved my problem. Needs some JCore eyes.
Created attachment 147588 [details] alternative fix @Darin What do you think of this one. The problem is simply that even primitives are being wrapped into a QualifiedTypeReference- which causes a problem at the time of resolution of bindings. So all we need to do is wrap primitives into SingleTypeReference.
Looks fine - I just didn't konw enough about the compiler to know if a SingleTypeReference applies to all types names without a '.', or just primitive type names.
Darin, do you need the fix today ? Ayushman, I would like a regression test to be available. I tried to reproduce the pb on my side. I tried to define a scrapbook page, but I keep getting problem about the class file version being not supported.
(In reply to comment #9) > Darin, do you need the fix today ? No rush, I don't need a fix today. I can run with the patch in HEAD. I'm just experimenting with using JDT's evaluation context for non-scrapbook evaluations.
Released for 3.6M3. Ayushman, please provide the steps you used to reproduce the issue.
Created attachment 147794 [details] plugin project to reproduce bug Here's the plugin project that was used to reproduce the issue. The verifier can use this to comfirm that the bug is no longer reproduced. The plugin contributes an action to the extension point org.eclipse.ui.editorActions. Steps to reproduce: 1) Import the project into your workspace. 2) Check out org.eclipse.jdt.debug.ui into the workspace 3) Make sure the errors/warnings setting for forbidden reference(access rules)/discouraged reference(access rules) is set to either warn or ignore. 4) Run as eclipse application. Open the display view. Right clicking on the display view will show a new action "My Own Action"(although inactive). 5) Create a sample program, and put a breakpoint after some local declarations and assignment statements containing primitive types. Debug your code, and when the breakpoint is hit, type some expression in the display view. Selecting the expression and clicking on My Own Action should activate the evaluation which was earlier causing an exception. If everything is ok, you would now no longer get an exception.
PS: Please mark out "patch" as obsolete.
Verified.