Community
Participate
Working Groups
When working with JDBC, I often have this situation: ------------------------------------------ try (Connection c = getConnection(); Statement s = c.createStatement()) { // ... } ------------------------------------------ Now, sometimes, I want to reuse the connection for several statements. Ideally, I'd love to have a quick fix that is active on the semi-colon (or on any whitespace between the two statements) allowing to split the single try-with-resources statement into two nested ones: ------------------------------------------ try (Connection c = getConnection()) { try (Statement s = c.createStatement()) { // ... } } ------------------------------------------ This should work with any number of statements in the resources block. E.g. this: ------------------------------------------ try (X x1 = getX(); X x2 = getX(); // Quick fix here X x3 = getX(); X x4 = getX()) { // ... } ------------------------------------------ would result in: ------------------------------------------ try (X x1 = getX(); X x2 = getX()) { try (X x3 = getX(); X x4 = getX()) { // ... } } ------------------------------------------ And of course, the individual new try-with-resources statements could be further split if desired. The inverse would be really cool, too, but I imagine it is a bit more tricky to define the rules when it is applicable.
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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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.
I think this makes sense, though nobody currently has plans to work on this.
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.
Have created: https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1220