Symtab.java revision 2824:e0b35c562008
1/* 2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package com.sun.tools.javac.code; 27 28import java.util.HashMap; 29import java.util.HashSet; 30import java.util.Map; 31import java.util.Set; 32 33import javax.lang.model.element.ElementVisitor; 34import javax.tools.JavaFileObject; 35 36 37import com.sun.tools.javac.code.Scope.WriteableScope; 38import com.sun.tools.javac.code.Symbol.ClassSymbol; 39import com.sun.tools.javac.code.Symbol.Completer; 40import com.sun.tools.javac.code.Symbol.CompletionFailure; 41import com.sun.tools.javac.code.Symbol.MethodSymbol; 42import com.sun.tools.javac.code.Symbol.OperatorSymbol; 43import com.sun.tools.javac.code.Symbol.PackageSymbol; 44import com.sun.tools.javac.code.Symbol.TypeSymbol; 45import com.sun.tools.javac.code.Symbol.VarSymbol; 46import com.sun.tools.javac.code.Type.BottomType; 47import com.sun.tools.javac.code.Type.ClassType; 48import com.sun.tools.javac.code.Type.ErrorType; 49import com.sun.tools.javac.code.Type.JCPrimitiveType; 50import com.sun.tools.javac.code.Type.JCVoidType; 51import com.sun.tools.javac.code.Type.MethodType; 52import com.sun.tools.javac.code.Type.UnknownType; 53import com.sun.tools.javac.jvm.ByteCodes; 54import com.sun.tools.javac.jvm.Target; 55import com.sun.tools.javac.util.Assert; 56import com.sun.tools.javac.util.Context; 57import com.sun.tools.javac.util.Convert; 58import com.sun.tools.javac.util.DefinedBy; 59import com.sun.tools.javac.util.DefinedBy.Api; 60import com.sun.tools.javac.util.JavacMessages; 61import com.sun.tools.javac.util.List; 62import com.sun.tools.javac.util.Log; 63import com.sun.tools.javac.util.Name; 64import com.sun.tools.javac.util.Names; 65 66import static com.sun.tools.javac.code.Flags.*; 67import static com.sun.tools.javac.code.Kinds.Kind.*; 68import static com.sun.tools.javac.jvm.ByteCodes.*; 69import static com.sun.tools.javac.code.TypeTag.*; 70 71/** A class that defines all predefined constants and operators 72 * as well as special classes such as java.lang.Object, which need 73 * to be known to the compiler. All symbols are held in instance 74 * fields. This makes it possible to work in multiple concurrent 75 * projects, which might use different class files for library classes. 76 * 77 * <p><b>This is NOT part of any supported API. 78 * If you write code that depends on this, you do so at your own risk. 79 * This code and its internal interfaces are subject to change or 80 * deletion without notice.</b> 81 */ 82public class Symtab { 83 /** The context key for the symbol table. */ 84 protected static final Context.Key<Symtab> symtabKey = new Context.Key<>(); 85 86 /** Get the symbol table instance. */ 87 public static Symtab instance(Context context) { 88 Symtab instance = context.get(symtabKey); 89 if (instance == null) 90 instance = new Symtab(context); 91 return instance; 92 } 93 94 /** Builtin types. 95 */ 96 public final JCPrimitiveType byteType = new JCPrimitiveType(BYTE, null); 97 public final JCPrimitiveType charType = new JCPrimitiveType(CHAR, null); 98 public final JCPrimitiveType shortType = new JCPrimitiveType(SHORT, null); 99 public final JCPrimitiveType intType = new JCPrimitiveType(INT, null); 100 public final JCPrimitiveType longType = new JCPrimitiveType(LONG, null); 101 public final JCPrimitiveType floatType = new JCPrimitiveType(FLOAT, null); 102 public final JCPrimitiveType doubleType = new JCPrimitiveType(DOUBLE, null); 103 public final JCPrimitiveType booleanType = new JCPrimitiveType(BOOLEAN, null); 104 public final Type botType = new BottomType(); 105 public final JCVoidType voidType = new JCVoidType(); 106 107 private final Names names; 108 private final Completer initialCompleter; 109 private final Target target; 110 111 /** A symbol for the root package. 112 */ 113 public final PackageSymbol rootPackage; 114 115 /** A symbol for the unnamed package. 116 */ 117 public final PackageSymbol unnamedPackage; 118 119 /** A symbol that stands for a missing symbol. 120 */ 121 public final TypeSymbol noSymbol; 122 123 /** The error symbol. 124 */ 125 public final ClassSymbol errSymbol; 126 127 /** The unknown symbol. 128 */ 129 public final ClassSymbol unknownSymbol; 130 131 /** A value for the errType, with a originalType of noType */ 132 public final Type errType; 133 134 /** A value for the unknown type. */ 135 public final Type unknownType; 136 137 /** The builtin type of all arrays. */ 138 public final ClassSymbol arrayClass; 139 public final MethodSymbol arrayCloneMethod; 140 141 /** VGJ: The (singleton) type of all bound types. */ 142 public final ClassSymbol boundClass; 143 144 /** The builtin type of all methods. */ 145 public final ClassSymbol methodClass; 146 147 /** Predefined types. 148 */ 149 public final Type objectType; 150 public final Type classType; 151 public final Type classLoaderType; 152 public final Type stringType; 153 public final Type stringBufferType; 154 public final Type stringBuilderType; 155 public final Type cloneableType; 156 public final Type serializableType; 157 public final Type serializedLambdaType; 158 public final Type methodHandleType; 159 public final Type methodHandleLookupType; 160 public final Type methodTypeType; 161 public final Type nativeHeaderType; 162 public final Type throwableType; 163 public final Type errorType; 164 public final Type interruptedExceptionType; 165 public final Type illegalArgumentExceptionType; 166 public final Type exceptionType; 167 public final Type runtimeExceptionType; 168 public final Type classNotFoundExceptionType; 169 public final Type noClassDefFoundErrorType; 170 public final Type noSuchFieldErrorType; 171 public final Type assertionErrorType; 172 public final Type cloneNotSupportedExceptionType; 173 public final Type annotationType; 174 public final TypeSymbol enumSym; 175 public final Type listType; 176 public final Type collectionsType; 177 public final Type comparableType; 178 public final Type comparatorType; 179 public final Type arraysType; 180 public final Type iterableType; 181 public final Type iteratorType; 182 public final Type annotationTargetType; 183 public final Type overrideType; 184 public final Type retentionType; 185 public final Type deprecatedType; 186 public final Type suppressWarningsType; 187 public final Type inheritedType; 188 public final Type profileType; 189 public final Type proprietaryType; 190 public final Type systemType; 191 public final Type autoCloseableType; 192 public final Type trustMeType; 193 public final Type lambdaMetafactory; 194 public final Type repeatableType; 195 public final Type documentedType; 196 public final Type elementTypeType; 197 public final Type functionalInterfaceType; 198 199 /** The symbol representing the length field of an array. 200 */ 201 public final VarSymbol lengthVar; 202 203 /** The symbol representing the final finalize method on enums */ 204 public final MethodSymbol enumFinalFinalize; 205 206 /** The symbol representing the close method on TWR AutoCloseable type */ 207 public final MethodSymbol autoCloseableClose; 208 209 /** The predefined type that belongs to a tag. 210 */ 211 public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()]; 212 213 /** The name of the class that belongs to a basix type tag. 214 */ 215 public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()]; 216 217 /** A hashtable containing the encountered top-level and member classes, 218 * indexed by flat names. The table does not contain local classes. 219 * It should be updated from the outside to reflect classes defined 220 * by compiled source files. 221 */ 222 public final Map<Name, ClassSymbol> classes = new HashMap<>(); 223 224 /** A hashtable containing the encountered packages. 225 * the table should be updated from outside to reflect packages defined 226 * by compiled source files. 227 */ 228 public final Map<Name, PackageSymbol> packages = new HashMap<>(); 229 230 public void initType(Type type, ClassSymbol c) { 231 type.tsym = c; 232 typeOfTag[type.getTag().ordinal()] = type; 233 } 234 235 public void initType(Type type, String name) { 236 initType( 237 type, 238 new ClassSymbol( 239 PUBLIC, names.fromString(name), type, rootPackage)); 240 } 241 242 public void initType(Type type, String name, String bname) { 243 initType(type, name); 244 boxedName[type.getTag().ordinal()] = names.fromString("java.lang." + bname); 245 } 246 247 /** The class symbol that owns all predefined symbols. 248 */ 249 public final ClassSymbol predefClass; 250 251 /** Enter a class into symbol table. 252 * @param s The name of the class. 253 */ 254 private Type enterClass(String s) { 255 return enterClass(names.fromString(s)).type; 256 } 257 258 public void synthesizeEmptyInterfaceIfMissing(final Type type) { 259 final Completer completer = type.tsym.completer; 260 if (completer != null) { 261 type.tsym.completer = new Completer() { 262 public void complete(Symbol sym) throws CompletionFailure { 263 try { 264 completer.complete(sym); 265 } catch (CompletionFailure e) { 266 sym.flags_field |= (PUBLIC | INTERFACE); 267 ((ClassType) sym.type).supertype_field = objectType; 268 } 269 } 270 }; 271 } 272 } 273 274 public void synthesizeBoxTypeIfMissing(final Type type) { 275 ClassSymbol sym = enterClass(boxedName[type.getTag().ordinal()]); 276 final Completer completer = sym.completer; 277 if (completer != null) { 278 sym.completer = new Completer() { 279 public void complete(Symbol sym) throws CompletionFailure { 280 try { 281 completer.complete(sym); 282 } catch (CompletionFailure e) { 283 sym.flags_field |= PUBLIC; 284 ((ClassType) sym.type).supertype_field = objectType; 285 MethodSymbol boxMethod = 286 new MethodSymbol(PUBLIC | STATIC, names.valueOf, 287 new MethodType(List.of(type), sym.type, 288 List.<Type>nil(), methodClass), 289 sym); 290 sym.members().enter(boxMethod); 291 MethodSymbol unboxMethod = 292 new MethodSymbol(PUBLIC, 293 type.tsym.name.append(names.Value), // x.intValue() 294 new MethodType(List.<Type>nil(), type, 295 List.<Type>nil(), methodClass), 296 sym); 297 sym.members().enter(unboxMethod); 298 } 299 } 300 }; 301 } 302 303 } 304 305 // Enter a synthetic class that is used to mark classes in ct.sym. 306 // This class does not have a class file. 307 private Type enterSyntheticAnnotation(String name) { 308 ClassType type = (ClassType)enterClass(name); 309 ClassSymbol sym = (ClassSymbol)type.tsym; 310 sym.completer = null; 311 sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; 312 sym.erasure_field = type; 313 sym.members_field = WriteableScope.create(sym); 314 type.typarams_field = List.nil(); 315 type.allparams_field = List.nil(); 316 type.supertype_field = annotationType; 317 type.interfaces_field = List.nil(); 318 return type; 319 } 320 321 /** Constructor; enters all predefined identifiers and operators 322 * into symbol table. 323 */ 324 protected Symtab(Context context) throws CompletionFailure { 325 context.put(symtabKey, this); 326 327 names = Names.instance(context); 328 target = Target.instance(context); 329 330 // Create the unknown type 331 unknownType = new UnknownType(); 332 333 // create the basic builtin symbols 334 rootPackage = new PackageSymbol(names.empty, null); 335 packages.put(names.empty, rootPackage); 336 final JavacMessages messages = JavacMessages.instance(context); 337 unnamedPackage = new PackageSymbol(names.empty, rootPackage) { 338 public String toString() { 339 return messages.getLocalizedString("compiler.misc.unnamed.package"); 340 } 341 }; 342 noSymbol = new TypeSymbol(NIL, 0, names.empty, Type.noType, rootPackage) { 343 @DefinedBy(Api.LANGUAGE_MODEL) 344 public <R, P> R accept(ElementVisitor<R, P> v, P p) { 345 return v.visitUnknown(this, p); 346 } 347 }; 348 349 // create the error symbols 350 errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage); 351 errType = new ErrorType(errSymbol, Type.noType); 352 353 unknownSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.fromString("<any?>"), null, rootPackage); 354 unknownSymbol.members_field = new Scope.ErrorScope(unknownSymbol); 355 unknownSymbol.type = unknownType; 356 357 // initialize builtin types 358 initType(byteType, "byte", "Byte"); 359 initType(shortType, "short", "Short"); 360 initType(charType, "char", "Character"); 361 initType(intType, "int", "Integer"); 362 initType(longType, "long", "Long"); 363 initType(floatType, "float", "Float"); 364 initType(doubleType, "double", "Double"); 365 initType(booleanType, "boolean", "Boolean"); 366 initType(voidType, "void", "Void"); 367 initType(botType, "<nulltype>"); 368 initType(errType, errSymbol); 369 initType(unknownType, unknownSymbol); 370 371 // the builtin class of all arrays 372 arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol); 373 374 // VGJ 375 boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol); 376 boundClass.members_field = new Scope.ErrorScope(boundClass); 377 378 // the builtin class of all methods 379 methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol); 380 methodClass.members_field = new Scope.ErrorScope(boundClass); 381 382 // Create class to hold all predefined constants and operations. 383 predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage); 384 WriteableScope scope = WriteableScope.create(predefClass); 385 predefClass.members_field = scope; 386 387 // Get the initial completer for Symbols from the ClassFinder 388 initialCompleter = ClassFinder.instance(context).getCompleter(); 389 rootPackage.completer = initialCompleter; 390 unnamedPackage.completer = initialCompleter; 391 392 // Enter symbols for basic types. 393 scope.enter(byteType.tsym); 394 scope.enter(shortType.tsym); 395 scope.enter(charType.tsym); 396 scope.enter(intType.tsym); 397 scope.enter(longType.tsym); 398 scope.enter(floatType.tsym); 399 scope.enter(doubleType.tsym); 400 scope.enter(booleanType.tsym); 401 scope.enter(errType.tsym); 402 403 // Enter symbol for the errSymbol 404 scope.enter(errSymbol); 405 406 classes.put(predefClass.fullname, predefClass); 407 408 // Enter predefined classes. 409 objectType = enterClass("java.lang.Object"); 410 classType = enterClass("java.lang.Class"); 411 stringType = enterClass("java.lang.String"); 412 stringBufferType = enterClass("java.lang.StringBuffer"); 413 stringBuilderType = enterClass("java.lang.StringBuilder"); 414 cloneableType = enterClass("java.lang.Cloneable"); 415 throwableType = enterClass("java.lang.Throwable"); 416 serializableType = enterClass("java.io.Serializable"); 417 serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda"); 418 methodHandleType = enterClass("java.lang.invoke.MethodHandle"); 419 methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup"); 420 methodTypeType = enterClass("java.lang.invoke.MethodType"); 421 errorType = enterClass("java.lang.Error"); 422 illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); 423 interruptedExceptionType = enterClass("java.lang.InterruptedException"); 424 exceptionType = enterClass("java.lang.Exception"); 425 runtimeExceptionType = enterClass("java.lang.RuntimeException"); 426 classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); 427 noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError"); 428 noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError"); 429 assertionErrorType = enterClass("java.lang.AssertionError"); 430 cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException"); 431 annotationType = enterClass("java.lang.annotation.Annotation"); 432 classLoaderType = enterClass("java.lang.ClassLoader"); 433 enumSym = enterClass(names.java_lang_Enum); 434 enumFinalFinalize = 435 new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL, 436 names.finalize, 437 new MethodType(List.<Type>nil(), voidType, 438 List.<Type>nil(), methodClass), 439 enumSym); 440 listType = enterClass("java.util.List"); 441 collectionsType = enterClass("java.util.Collections"); 442 comparableType = enterClass("java.lang.Comparable"); 443 comparatorType = enterClass("java.util.Comparator"); 444 arraysType = enterClass("java.util.Arrays"); 445 iterableType = enterClass("java.lang.Iterable"); 446 iteratorType = enterClass("java.util.Iterator"); 447 annotationTargetType = enterClass("java.lang.annotation.Target"); 448 overrideType = enterClass("java.lang.Override"); 449 retentionType = enterClass("java.lang.annotation.Retention"); 450 deprecatedType = enterClass("java.lang.Deprecated"); 451 suppressWarningsType = enterClass("java.lang.SuppressWarnings"); 452 inheritedType = enterClass("java.lang.annotation.Inherited"); 453 repeatableType = enterClass("java.lang.annotation.Repeatable"); 454 documentedType = enterClass("java.lang.annotation.Documented"); 455 elementTypeType = enterClass("java.lang.annotation.ElementType"); 456 systemType = enterClass("java.lang.System"); 457 autoCloseableType = enterClass("java.lang.AutoCloseable"); 458 autoCloseableClose = new MethodSymbol(PUBLIC, 459 names.close, 460 new MethodType(List.<Type>nil(), voidType, 461 List.of(exceptionType), methodClass), 462 autoCloseableType.tsym); 463 trustMeType = enterClass("java.lang.SafeVarargs"); 464 nativeHeaderType = enterClass("java.lang.annotation.Native"); 465 lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory"); 466 functionalInterfaceType = enterClass("java.lang.FunctionalInterface"); 467 468 synthesizeEmptyInterfaceIfMissing(autoCloseableType); 469 synthesizeEmptyInterfaceIfMissing(cloneableType); 470 synthesizeEmptyInterfaceIfMissing(serializableType); 471 synthesizeEmptyInterfaceIfMissing(lambdaMetafactory); 472 synthesizeEmptyInterfaceIfMissing(serializedLambdaType); 473 synthesizeBoxTypeIfMissing(doubleType); 474 synthesizeBoxTypeIfMissing(floatType); 475 synthesizeBoxTypeIfMissing(voidType); 476 477 // Enter a synthetic class that is used to mark internal 478 // proprietary classes in ct.sym. This class does not have a 479 // class file. 480 proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation"); 481 482 // Enter a synthetic class that is used to provide profile info for 483 // classes in ct.sym. This class does not have a class file. 484 profileType = enterSyntheticAnnotation("jdk.Profile+Annotation"); 485 MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym); 486 profileType.tsym.members().enter(m); 487 488 // Enter a class for arrays. 489 // The class implements java.lang.Cloneable and java.io.Serializable. 490 // It has a final length field and a clone method. 491 ClassType arrayClassType = (ClassType)arrayClass.type; 492 arrayClassType.supertype_field = objectType; 493 arrayClassType.interfaces_field = List.of(cloneableType, serializableType); 494 arrayClass.members_field = WriteableScope.create(arrayClass); 495 lengthVar = new VarSymbol( 496 PUBLIC | FINAL, 497 names.length, 498 intType, 499 arrayClass); 500 arrayClass.members().enter(lengthVar); 501 arrayCloneMethod = new MethodSymbol( 502 PUBLIC, 503 names.clone, 504 new MethodType(List.<Type>nil(), objectType, 505 List.<Type>nil(), methodClass), 506 arrayClass); 507 arrayClass.members().enter(arrayCloneMethod); 508 } 509 510 /** Define a new class given its name and owner. 511 */ 512 public ClassSymbol defineClass(Name name, Symbol owner) { 513 ClassSymbol c = new ClassSymbol(0, name, owner); 514 if (owner.kind == PCK) 515 Assert.checkNull(classes.get(c.flatname), c); 516 c.completer = initialCompleter; 517 return c; 518 } 519 520 /** Create a new toplevel or member class symbol with given name 521 * and owner and enter in `classes' unless already there. 522 */ 523 public ClassSymbol enterClass(Name name, TypeSymbol owner) { 524 Name flatname = TypeSymbol.formFlatName(name, owner); 525 ClassSymbol c = classes.get(flatname); 526 if (c == null) { 527 c = defineClass(name, owner); 528 classes.put(flatname, c); 529 } else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) { 530 // reassign fields of classes that might have been loaded with 531 // their flat names. 532 c.owner.members().remove(c); 533 c.name = name; 534 c.owner = owner; 535 c.fullname = ClassSymbol.formFullName(name, owner); 536 } 537 return c; 538 } 539 540 /** 541 * Creates a new toplevel class symbol with given flat name and 542 * given class (or source) file. 543 * 544 * @param flatName a fully qualified binary class name 545 * @param classFile the class file or compilation unit defining 546 * the class (may be {@code null}) 547 * @return a newly created class symbol 548 * @throws AssertionError if the class symbol already exists 549 */ 550 public ClassSymbol enterClass(Name flatName, JavaFileObject classFile) { 551 ClassSymbol cs = classes.get(flatName); 552 if (cs != null) { 553 String msg = Log.format("%s: completer = %s; class file = %s; source file = %s", 554 cs.fullname, 555 cs.completer, 556 cs.classfile, 557 cs.sourcefile); 558 throw new AssertionError(msg); 559 } 560 Name packageName = Convert.packagePart(flatName); 561 PackageSymbol owner = packageName.isEmpty() 562 ? unnamedPackage 563 : enterPackage(packageName); 564 cs = defineClass(Convert.shortName(flatName), owner); 565 cs.classfile = classFile; 566 classes.put(flatName, cs); 567 return cs; 568 } 569 570 /** Create a new member or toplevel class symbol with given flat name 571 * and enter in `classes' unless already there. 572 */ 573 public ClassSymbol enterClass(Name flatname) { 574 ClassSymbol c = classes.get(flatname); 575 if (c == null) 576 return enterClass(flatname, (JavaFileObject)null); 577 else 578 return c; 579 } 580 581 /** Check to see if a package exists, given its fully qualified name. 582 */ 583 public boolean packageExists(Name fullname) { 584 return enterPackage(fullname).exists(); 585 } 586 587 /** Make a package, given its fully qualified name. 588 */ 589 public PackageSymbol enterPackage(Name fullname) { 590 PackageSymbol p = packages.get(fullname); 591 if (p == null) { 592 Assert.check(!fullname.isEmpty(), "rootPackage missing!"); 593 p = new PackageSymbol( 594 Convert.shortName(fullname), 595 enterPackage(Convert.packagePart(fullname))); 596 p.completer = initialCompleter; 597 packages.put(fullname, p); 598 } 599 return p; 600 } 601 602 /** Make a package, given its unqualified name and enclosing package. 603 */ 604 public PackageSymbol enterPackage(Name name, PackageSymbol owner) { 605 return enterPackage(TypeSymbol.formFullName(name, owner)); 606 } 607} 608