This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | FileUtil.getMimeType(fo, acceptableTypes) cannot be overridden | ||
---|---|---|---|
Product: | platform | Reporter: | Jaroslav Tulach <jtulach> |
Component: | Filesystems | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | apireviews, issues, jglick, jtulach |
Priority: | P3 | ||
Version: | 7.0 | ||
Hardware: | Other | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 199641 | ||
Attachments: | FileObject.getMIMEType(String...) |
Description
Jaroslav Tulach
2011-06-23 06:50:01 UTC
Created attachment 109661 [details]
FileObject.getMIMEType(String...)
[JG01] Do not introduce an overload of a method differing from the original only in the addition of varargs; it is ambiguous in sources. Use String[] withinMIMETypes instead. With only one known caller, convenience is not a concern anyway. (If it is necessary to support varargs for callers, use getMIMEType(String mimeType1, String... otherMimeTypes).) [JG02] Should there be a AbstractFileSystem.Info2 with String mimeType(String, String[])? Re. JG02 - maybe added when needed. Not necessary for remotefs. Re. JG01 - what is the problem? I think the addition is binary (of course) as well as source compatible. JG01 - with the proposed change, a call fo.getMIMEType() is visually ambiguous between the current zero-arg method, and the equivalent of fo.getMIMEType(new String[0]). It seems the compiler resolves that to the zero-arg method but why risk confusion? I don't think we risk a confusion, rather opposite, in current state the behavior is natural: fo.getMIMEType() finds the best mime type possible while fo.getMIMEType("text/only") obviously calls the vararg method and checks for the enumerated mimetypes only (usually). Unless more voices disagree, I'd prefer to keep it as proposed. I'll integrate tomorrow. ergonomics#9bb138371f33 Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/9bb138371f33 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #199642: Adding FileObject.getMIMEType(String...) |