langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
changeset 22442 8fd30fc4e3a3
parent 22163 3651128c74eb
child 23795 62509b72088e
equal deleted inserted replaced
22441:05b907a2f359 22442:8fd30fc4e3a3
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   982                 annotationComputer.scan(pkgSym, annotationsPresent);
   982                 annotationComputer.scan(pkgSym, annotationsPresent);
   983         }
   983         }
   984 
   984 
   985         /** Enter a set of generated class files. */
   985         /** Enter a set of generated class files. */
   986         private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
   986         private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
   987             ClassReader reader = ClassReader.instance(context);
   987             Symtab symtab = Symtab.instance(context);
   988             Names names = Names.instance(context);
   988             Names names = Names.instance(context);
   989             List<ClassSymbol> list = List.nil();
   989             List<ClassSymbol> list = List.nil();
   990 
   990 
   991             for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
   991             for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
   992                 Name name = names.fromString(entry.getKey());
   992                 Name name = names.fromString(entry.getKey());
   994                 if (file.getKind() != JavaFileObject.Kind.CLASS)
   994                 if (file.getKind() != JavaFileObject.Kind.CLASS)
   995                     throw new AssertionError(file);
   995                     throw new AssertionError(file);
   996                 ClassSymbol cs;
   996                 ClassSymbol cs;
   997                 if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
   997                 if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
   998                     Name packageName = Convert.packagePart(name);
   998                     Name packageName = Convert.packagePart(name);
   999                     PackageSymbol p = reader.enterPackage(packageName);
   999                     PackageSymbol p = symtab.enterPackage(packageName);
  1000                     if (p.package_info == null)
  1000                     if (p.package_info == null)
  1001                         p.package_info = reader.enterClass(Convert.shortName(name), p);
  1001                         p.package_info = symtab.enterClass(Convert.shortName(name), p);
  1002                     cs = p.package_info;
  1002                     cs = p.package_info;
  1003                     if (cs.classfile == null)
  1003                     if (cs.classfile == null)
  1004                         cs.classfile = file;
  1004                         cs.classfile = file;
  1005                 } else
  1005                 } else
  1006                     cs = reader.enterClass(name, file);
  1006                     cs = symtab.enterClass(name, file);
  1007                 list = list.prepend(cs);
  1007                 list = list.prepend(cs);
  1008             }
  1008             }
  1009             return list.reverse();
  1009             return list.reverse();
  1010         }
  1010         }
  1011 
  1011