| Summary: | Stop marking anonymous classes as final when JDK-8161009 is resolved | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Stephan Herrmann <stephan.herrmann> |
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, manoj.palat, sasikanth.bharadwaj |
| Version: | 4.6 | ||
| Target Milestone: | BETA J9 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Stephan Herrmann
(In reply to Stephan Herrmann from comment #0) > In https://bugs.openjdk.java.net/browse/JDK-8161009 Dan surprisingly > proposed to drop a useful line from the spec in favor of long standing > behavior of javac (and ecj). > > When JDK-8161009 is resolved we should then stop internally marking > anonymous classes as final. > > While focus in related JDK-bugs is on not incompatibly changing > serialization, in my understanding this will also affect castability, i.e., > the JLS change will likely imply that this bogus program: > > //--- > class Test231 implements Test231i { > void foo() { > new Object() { > Test231i bar() { > return (Test231i)this; > } > }; > } > } > > interface Test231i { } > //--- > > should be accepted. Currently we correctly report: > > ---------- > 1. ERROR in /tmp/Test231.java (at line 10) > return (Test231i)this; > ^^^^^^^^^^^^^^ > Cannot cast from new Object(){} to Test231i > ---------- > > Also javac rejects this program. > > Let's watch the discussion in JDK-8161009 That bug is marked as resolved in Java 9. javac9 now accepts the above bogus program. bulk move out of 4.8 Let's keep it on the radar for 4.9 - we need to adjust to a spec change made in Java 9. Bulk move out of 4.11 Bulk move out of 4.13 Need to follow the spec change, fix should be simple. *** This bug has been marked as a duplicate of bug 520727 *** |