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

javax.tools.SimpleJavaFileObject( String ) doesn't process predefined file extenstions

XMLWordPrintable

    • b71
    • generic
    • generic
    • Verified

      class MySJFO extends SimpleJavaFileObject {
              public MySJFO( String name ) { super( name ); }
              public MySJFO( String name, JavaFileObject.Kind kind ) { super( name, kind ); }
              public CharSequence getCharContent(boolean ignoreEncodingErrors)
                                      throws IOException, IllegalStateException, UnsupportedOperationException {
                  return null;
              }
              public InputStream openInputStream()
                                      throws IOException, IllegalStateException, UnsupportedOperationException {
                  return null;
              }
              public OutputStream openOutputStream()
                                      throws IOException, IllegalStateException, UnsupportedOperationException {
                  throw new UnsupportedOperationException();
              }
          }

          new MySJFO( "name.html" ).getKind() returns JavaFileObject.Kind.OTHER
      import java.io.*;
      import javax.tools.*;


      public class SJFOgetKind {

          static class MySJFO extends SimpleJavaFileObject {
              public MySJFO( String name ) { super( name ); }
              public MySJFO( String name, JavaFileObject.Kind kind ) { super( name, kind ); }
              public CharSequence getCharContent(boolean ignoreEncodingErrors)
                                      throws IOException, IllegalStateException, UnsupportedOperationException {
                  return null;
              }
              public InputStream openInputStream()
                                      throws IOException, IllegalStateException, UnsupportedOperationException {
                  return null;
              }
              public OutputStream openOutputStream()
                                      throws IOException, IllegalStateException, UnsupportedOperationException {
                  throw new UnsupportedOperationException();
              }
          }

          public static void main( String[] args ){
              System.out.println( new MySJFO( "name.html" ).getKind() );
          }

      }

            ahe Peter Ahe
            itseytin Igor Tseytin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: