Enum.valueOf() call fails with ambiguous method error

Issue #282 resolved
Jesper Öqvist
created an issue

ExtendJ 8.1.0-39-g9f0c2f1 Java SE 5

// Test using the Enum.valueOf(String) method on a standard library type.
import java.net.Proxy;
public class Test {
  public static void main(String[] args) {
    System.out.println(Proxy.Type.valueOf("HTTP"));
  }
}

Expected result: should compile.

Actual result: fails with this error:

    [junit] [FAIL] runTest[enum/valueof_02p](tests.extendj.TestJava7)
    [junit] Compilation failed when expected to pass:
    [junit] tests/enum/valueof_02p/Test.java:5: error: no method named println(Unknown) in java.io.PrintStream matches. However, there is a method println(boolean)
    [junit] tests/enum/valueof_02p/Test.java:5: error: several most specific methods for valueOf("HTTP")
    [junit]     valueOf(java.lang.String) in java.net.Proxy.Type
    [junit]     valueOf(java.lang.String) in java.net.Proxy.Type

Comments (2)

  1. Log in to comment