| Summary: | Error message: Evaluations must contain either an expression or a block of well-formed statements | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Hung P Le <hungple> | ||||
| Component: | Debug | Assignee: | JDT-Debug-Inbox <jdt-debug-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | darin.eclipse, Michael_Rennie | ||||
| Version: | 3.5 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
The problem is that the class files generated by javac have two local variables with the same name (i$). We end up generating a "snippet method" with arguments that have duplicate names:
void ___run(TestCase.Whatever2 w2, java.util.Iterator i$, TestCase.Whatever1 w1, java.util.Iterator i$, java.util.List<TestCase.Whatever1> list1, java.util.List<TestCase.Whatever2> list2) throws Throwable {
return 1+1;
}
Basically, each iterator is given the name i$, and this results in a compilation error, which we are are surfacing with the noted error message.
The Eclipse Java compiler does not generate these locals. I assume a compiler can implement the "enhanced for" loop differently.
We could just keep track of the parameter / argument names being used in BinaryBasedSourceGenerator and avoid the duplicate problem. Created attachment 136665 [details]
patch
This patch removes locals with duplicate names. Since any reference to such a local would be ambiguous, I don't see that this harms anything. The locals are synthetic, but we can't determine that from JDI.
Sorry, these comments are regarding bug 277187, not this bug. However, I wonder if this is a dup of bug 277187. Can you use javap on the associated class file to see if there are locals with duplicate names? This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build ID: M20090211-1700 Steps To Reproduce: I cannot provide you a simple stand alone test case because it involves with DB2 and Data Studio v2.2. Let me try to describe the problem and hope that you can recreate the problem without DB2 and Data Studio. 1. Start Data Studio v2.2 (Data Studio 2.1 also works) 2. Connect to DB2 v95 3. Create an SQLJ stored procedure (static jdbg stored procdure). The java source should looks like this: package com.hungple.hungple; import java.sql.*; // JDBC classes import sqlj.runtime.*; import sqlj.runtime.ref.*; #sql context SPContext; #sql iterator SQLJ2_Cursor1 ( java.lang.String, java.lang.String ); public class SQLJ2 { public static void sQLJ2(int VAR01, int[] VAR02, ResultSet[] rs1) throws SQLException, Exception { SQLJ2_Cursor1 cursor1 = null; SPContext ctx = null; try { ctx = new SPContext("jdbc:default:connection", false); #sql [ctx] cursor1 = { SELECT PROCSCHEMA, PROCNAME FROM SYSCAT.PROCEDURES }; rs1[0] = cursor1.getResultSet(); // Set return parameter VAR02[0] = VAR02[0]; } catch (SQLException e) { // Close open resources try { if (cursor1 != null) cursor1.close(); if (ctx != null) ctx.close(); } catch (SQLException e2) { /* Ignore */ } throw e; } } } 4. Deploy the SQLJ procedure in debug mode. 5. Right click and select debug 6. In variable view, you can change the value for input parameter 'VAR01' 7. Step over the line 'SQLJ2_Cursor1 cursor1 = null;' 8. Change value for 'VAR01' again. You will see an error message pop up with a message "Evaluations must contain either an expression or a block of well-formed statements". 9. If you add a watch point for 'VAR01', you will also see this error message as well. More information: