Bug 560928 - [typing] smart insert doesn't handle try-with-resources
Summary: [typing] smart insert doesn't handle try-with-resources
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.15   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-09 11:03 EDT by Julian Honnen CLA
Modified: 2024-03-07 01:05 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Honnen CLA 2020-03-09 11:03:26 EDT
Both semicolons and braces within try-with-resources are not inserted at the expected position.

Given
	InputStream in = // ...;
	try (Closeable x = in|)

insert semicolon:
	try (Closeable x = in);
expected:
	try (Closeable x = in;)


insert brace:
	try (Closeable x = in{);
expected:
	try (Closeable x = in) {
Comment 1 Julian Honnen CLA 2020-03-24 12:06:02 EDT
Further complication: The smart-insert operates only on the current line. The following would need more context than that.

    try (Closeable x = in;
         Closeable y = out|)


Similarly the existing for loop handling doesn't work with multiple lines:
    for (int i = 0;
         i < 10|)
->
    for (int i = 0; 
         i < 10);
Comment 2 Eclipse Genie CLA 2022-03-16 14:17:47 EDT
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.
Comment 3 Eclipse Genie CLA 2024-03-07 01:05:39 EST
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.