Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6416679

Elements.getTypeElement(String s) does expect binary name as a parameter

XMLWordPrintable

      The spec says:
      ----
      TypeElement getTypeElement(String name)

          Returns a type element given its *fully qualified name*.

          Parameters:
              name - fully qualified type name
          Returns:
              the named type element, or null if it cannot be found
      ----

      However, the example below shows that *fully qualified name* is refused, but the binary name expected:
      ---
      package test;

      public class S_TE0015 {
          public class Inner {}
      }
      ---

      // This fails with "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for test.S_TE0015.Inner not found"
      // getTypeElement("test.S_TE0015.Inner");

      // But this works...
      getTypeElement("test.S_TE0015$Inner");
      ---

      During the discussion with Peter, Joe and Scott it was found out that this is not a simple issue. Perhaps, a spec clarification is needed. Filing this bug for tracking.

            sseligmasunw Scott Seligman (Inactive)
            ashusher Alexander Shusherov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: