Bug 571230 - Added support for evaluating block statements
Summary: Added support for evaluating block statements
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.17   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.19 RC1   Edit
Assignee: Gayan Perera CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: 571220
  Show dependency tree
 
Reported: 2021-02-16 11:41 EST by Gayan Perera CLA
Modified: 2021-02-20 06:59 EST (History)
2 users (show)

See Also:
sarika.sinha: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2021-02-16 11:41:58 EST
When trying to evaluate the following code

for(int i = 0; i < 10; i++) {
	System.getProperties().put(i, i+1);	
}

it gives you the following error

	Evaluation failed. Reason(s):
		Syntax error, insert ";" to complete BlockStatements

This was working in Eclipse 2020-06.
Comment 1 Andrey Loskutov CLA 2021-02-16 11:50:32 EST
Gayan, what is the first release where it does NOT work?
Comment 2 Gayan Perera CLA 2021-02-16 12:06:18 EST
Not sure Andrey, i had a 2020-06 in my work laptop and it worked there.
Comment 3 Gayan Perera CLA 2021-02-16 12:13:56 EST
Its caused by Bug549952
Comment 4 Sarika Sinha CLA 2021-02-16 13:35:22 EST
@Gayan,
As this is a regression, Will you be able to work on this for 4.19 RC1?
Comment 5 Gayan Perera CLA 2021-02-16 14:23:13 EST
Working on a solution right now.
Comment 6 Gayan Perera CLA 2021-02-16 17:47:27 EST
I'm working on a AST based solution where we can rewrite the snippet with return statement based on if its needed or not. I see it less error prone and easy to fix by anyone who doesn't have much knowledge on source scanner. And we don't need to duplicate parser/scanner logics at different places as well.

What do you think @Sarika ?
Comment 7 Sarika Sinha CLA 2021-02-16 23:15:19 EST
That will be great!
Comment 8 Gayan Perera CLA 2021-02-17 16:50:26 EST
@Sarika i found a regression while running the full eval suite which is introduced by Bug567801. Its a one line fix, shall i fix with this issue or open a separate bug ?
Comment 9 Andrey Loskutov CLA 2021-02-17 16:54:30 EST
(In reply to Gayan Perera from comment #8)
> @Sarika i found a regression while running the full eval suite which is
> introduced by Bug567801. Its a one line fix, shall i fix with this issue or
> open a separate bug ?

Ideally separated one.
Comment 10 Eclipse Genie CLA 2021-02-17 17:13:37 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/176435
Comment 11 Gayan Perera CLA 2021-02-17 17:19:41 EST
Reported https://bugs.eclipse.org/bugs/show_bug.cgi?id=571271
Comment 13 Sarika Sinha CLA 2021-02-20 06:59:56 EST
Good for RC1.

Thanks Gayan!