| Summary: | Using role as resource in try-with-resources creates bogus byte code | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] Objectteams | Reporter: | Stephan Herrmann <stephan.herrmann> | ||||
| Component: | OTJ | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 2.0 | ||||||
| Target Milestone: | 2.1 M2 | ||||||
| Hardware: | Other | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 201679 [details]
test & fix
Fixed by simply checking isRole(), and if so, consider the resource
as an interface type using invokeinterface.
Released as r1901,1902 for 2.1 M2. Verified for 2.1 using build 201206040388. |
If a role ResourceRole implements AutoCloseable using this role in a Java7 try-with-resources like this: try (ResourceRole r = new ResourceRole(baseResource)) { int in = r.read100(); System.out.println(String.valueOf(r.chars)); } running the code complains java.lang.IncompatibleClassChangeError: Found interface Team7$ResourceRole, but class was expected