Skip to content

Ambiguous method warning when there does not appear to be any ambiguity #2865

@hakanai

Description

@hakanai

I have two methods with the following signatures:

    SourceItem openFile(String file, Map<?, ?> settings) throws FileNotFoundException;
    void openFile(String file, Consumer<SourceItem> itemConsumer) throws FileNotFoundException;

When I try to call the second one:

factory.open_file('path/to/file') do |item|
  item.text
end

I get a warning:

.../rspec_helpers.rb:93 warning: ambiguous Java methods found, using openFile(java.util.String, java.util.Map)

I don't think there is any real ambiguity here. I can't implement Map using a block, so it should always call openFile(String, Consumer).

Reproduced on 1.7.18, 1.7.19, 9.0.0.0.pre1.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions