| Summary: | [1.7] Hot code replace fails when modifying resource declaration in try with resources | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ayushman Jain <amj87.iitr> |
| Component: | Debug | Assignee: | JDT-Debug-Inbox <jdt-debug-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Michael_Rennie |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Closing as worksforme. This is a VM limitation of hot code replace, you cannot pop the main entry point off the stack and re-enter it. Any code you try to hot swap in the main method will fail - this limitation is not unique to 1.7. |
BETA_JAVA7 class Test { FileInputStream fisField = null; public static void main(String[] args) { try (FileInputStream fis = fisField) { fis.available(); } catch (Exception e) { } } } Debug as>Java application. Step through the code and when the resource has been initialized, change "FileInputStream fis = fisField" to "FileInputStream fis = new FileInputStream("")" and save. Hot code replace fails -> Obsolete methods in the stack. Expected: Debugger should jump to start of main. This also happens if one edits the statements inside the try block. (Try commenting out fis.available()) I'm using IBM JRE 7