Campbell Ritchie wrote:It is possible that Paths has a private nested class which implements Path; that will never be visible in the public API. You can find out quite a bit simply from the code I showed you to find the class name. I expect it will differ with the implementation. The class might also be in a separate package whose documentation is omitted from the published API. That allows the implementer to change the actual class without having to give notice.
Stephan van Hulst wrote:For instance, you could make an implementation for Unix systems that doesn't allow backslashes as separators, or something completely different (for instance, there are file systems that don't have a hierarchical folder structure at all).
John Dryden wrote:
Rob Spoor wrote:It is. Type inference works based on the context provided when the object is created. Because of all the chained calls the compiler cannot link the untyped call to builder() and the typed call to put.
Bad compiler .
But then, how does the stream api do it? It does nothing other than that.
You could perhaps change builder to take the first entry, that would give the compiler the necessary information.
Prasad Saya wrote:
The above code works without any exception.
John Dryden wrote:Which makes it seem like the entire Builder was untyped when build() was called.