src/share/classes/com/sun/tools/apt/mirror/apt/FilerImpl.java

Print this page




  28 
  29 import java.io.*;
  30 import java.util.Collection;
  31 import java.util.EnumMap;
  32 import java.util.HashSet;
  33 import java.util.Set;
  34 
  35 import com.sun.mirror.apt.Filer;
  36 import com.sun.tools.apt.mirror.declaration.DeclarationMaker;
  37 import com.sun.tools.javac.util.Context;
  38 import com.sun.tools.javac.util.Options;
  39 import com.sun.tools.javac.util.Position;
  40 import com.sun.tools.apt.util.Bark;
  41 
  42 import static com.sun.mirror.apt.Filer.Location.*;
  43 
  44 
  45 /**
  46  * Implementation of Filer.
  47  */
  48 
  49 public class FilerImpl implements Filer {
  50     /*
  51      * The Filer class must maintain a number of constraints.  First,
  52      * multiple attempts to open the same path within the same
  53      * invocation of apt results in an IOException being thrown.  For
  54      * example, trying to open the same source file twice:
  55      *
  56      * createSourceFile("foo.Bar")
  57      * ...
  58      * createSourceFile("foo.Bar")
  59      *
  60      * is disallowed as is opening a text file that happens to have
  61      * the same name as a source file:
  62      *
  63      * createSourceFile("foo.Bar")
  64      * ...
  65      * createTextFile(SOURCE_TREE, "foo", new File("Bar"), null)
  66      *
  67      * Additionally, creating a source file that corresponds to an
  68      * already created class file (or vice versa) generates at least a




  28 
  29 import java.io.*;
  30 import java.util.Collection;
  31 import java.util.EnumMap;
  32 import java.util.HashSet;
  33 import java.util.Set;
  34 
  35 import com.sun.mirror.apt.Filer;
  36 import com.sun.tools.apt.mirror.declaration.DeclarationMaker;
  37 import com.sun.tools.javac.util.Context;
  38 import com.sun.tools.javac.util.Options;
  39 import com.sun.tools.javac.util.Position;
  40 import com.sun.tools.apt.util.Bark;
  41 
  42 import static com.sun.mirror.apt.Filer.Location.*;
  43 
  44 
  45 /**
  46  * Implementation of Filer.
  47  */
  48 @SuppressWarnings("deprecation")
  49 public class FilerImpl implements Filer {
  50     /*
  51      * The Filer class must maintain a number of constraints.  First,
  52      * multiple attempts to open the same path within the same
  53      * invocation of apt results in an IOException being thrown.  For
  54      * example, trying to open the same source file twice:
  55      *
  56      * createSourceFile("foo.Bar")
  57      * ...
  58      * createSourceFile("foo.Bar")
  59      *
  60      * is disallowed as is opening a text file that happens to have
  61      * the same name as a source file:
  62      *
  63      * createSourceFile("foo.Bar")
  64      * ...
  65      * createTextFile(SOURCE_TREE, "foo", new File("Bar"), null)
  66      *
  67      * Additionally, creating a source file that corresponds to an
  68      * already created class file (or vice versa) generates at least a