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

SimpleJavaFileObject.toString() generates URI with some extra message

    XMLWordPrintable

Details

    • b03
    • generic
    • generic
    • Verified

    Description

      SimpleJavaFileObject.toString() generates URI with some extra message

      <testcase>
      import java.io.File;
      import java.net.URI;
      import javax.tools.*;
      import static javax.tools.StandardLocation.*;
      import static javax.tools.JavaFileObject.Kind.*;

      class JFO extends SimpleJavaFileObject {
              public JFO(URI uri, Kind kind) {
                  super(uri,kind);
              }
      }

      public class Foo {
          public static void main(String... arg) throws Exception {
              JavaCompilerTool javac = ToolProvider.getSystemJavaCompilerTool();
              JavaFileManager jfm = javac.getStandardFileManager(null);
              JavaFileObject jfo = jfm.getJavaFileForInput(CLASS_PATH,"Foo",SOURCE);
              System.out.println("From JavaFileManager ->" + jfo.toString());
              SimpleJavaFileObject sjfo = new JFO(jfo.toUri(), SOURCE);
              System.out.println("From SimpleJavaFileObject ->" + sjfo.toString());
          }
      }
      </testcase>
      <output>
      From JavaFileManager -> .\Foo.java
      From SimpleJavaFileObject -> file:/Y:/MustangTestDev/tools/jsr199/JavaFileObject/JFOTest05/./Foo.java from JFO
      </output>

      1) In the output of SimpleJavaFileObject.toString() extra message 'from JFO' is not required.
      2) There is inconsistency in the toString() message of JavaFileObject of StandardJavaFileManager and SimpleJavaFileObject.toString(). SimpleJavaFileObject generate more of URI.

      <java-version>
      bash-3.00$ java -version
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b88)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b88, mixed mode)
      </java-vesrion>

      Attachments

        Issue Links

          Activity

            People

              ahe Peter Ahe
              savadhansunw Seetharama Avadhanam (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: