Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

The method expect(Object[]) is ambiguous for the type Expect #8

fragnemesis opened this Issue Mar 22, 2013 · 1 comment


None yet
2 participants

fragnemesis commented Mar 22, 2013

I'm seeing that the methods with signatures expect(Object...) conflict with the ones like expect(int, Object...)

I'm seeing this while working in Eclipse. I know that type ambiguity resolution rules for Java are a bit confusing, so I'd recommend for clarity that you not use a varargs Object, instead using specific types for what you support (String... and Pattern...).

I know this loses the ability to put both Pattern and String objects in the same method call, but how often is this actually done? I'd say this is less important that the use of specifying a custom timeout per expect() method call.

I see the same problem when compiling with Java 1.8; i.e., it's not just Eclipse that complains. For example:

PythonBridge.java:37: error: reference to expect is ambiguous
        rc = expect.expect(1, ">>>");
  both method expect(Object...) in Expect and method expect(int,Object...) in Expect match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment