JDK-8003263 : redundant cast build failure after 8003120
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2012-11-12
  • Updated: 2013-02-04
  • Resolved: 2012-11-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b66Fixed
Related Reports
Relates :  
Description
8003120 adds a new line

   InputStream istream = (InputStream)resources.next();

but resources is already of type NamingEnumeration<InputStream>.

Building now shows

../../../src/share/classes/com/sun/naming/internal/ResourceManager.java:563: warning: [cast] redundant cast to InputStream
                        InputStream istream = (InputStream)resources.next();

Comments
verified in b74
2013-02-04

There could be more enhancement, but build failure must be fixed asap. 1. It should attempt to close all resources even an IOException is thrown during close. 2. In fact, it looks like the resources object here is of type InputStreamEnumeration (in com/sun/naming/internal/VersionHelper12.java), with an open-on-nextElement style. This means we can completely remove the while (resources.hasMore()) block.
2012-11-16