src/share/classes/com/sun/tools/javac/code/Symtab.java

changeset 858
96d4226bdd60
parent 857
3aa269645199
child 900
938dda0bec17
equal deleted inserted replaced
857:3aa269645199 858:96d4226bdd60
72 public final Type booleanType = new Type(TypeTags.BOOLEAN, null); 72 public final Type booleanType = new Type(TypeTags.BOOLEAN, null);
73 public final Type botType = new BottomType(); 73 public final Type botType = new BottomType();
74 public final JCNoType voidType = new JCNoType(TypeTags.VOID); 74 public final JCNoType voidType = new JCNoType(TypeTags.VOID);
75 75
76 private final Names names; 76 private final Names names;
77 private final Scope.ScopeCounter scopeCounter;
78 private final ClassReader reader; 77 private final ClassReader reader;
79 private final Target target; 78 private final Target target;
80 79
81 /** A symbol for the root package. 80 /** A symbol for the root package.
82 */ 81 */
341 */ 340 */
342 protected Symtab(Context context) throws CompletionFailure { 341 protected Symtab(Context context) throws CompletionFailure {
343 context.put(symtabKey, this); 342 context.put(symtabKey, this);
344 343
345 names = Names.instance(context); 344 names = Names.instance(context);
346 scopeCounter = Scope.ScopeCounter.instance(context);
347 target = Target.instance(context); 345 target = Target.instance(context);
348 346
349 // Create the unknown type 347 // Create the unknown type
350 unknownType = new Type(TypeTags.UNKNOWN, null); 348 unknownType = new Type(TypeTags.UNKNOWN, null);
351 349
388 // the builtin class of all methods 386 // the builtin class of all methods
389 methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol); 387 methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
390 388
391 // Create class to hold all predefined constants and operations. 389 // Create class to hold all predefined constants and operations.
392 predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage); 390 predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
393 Scope scope = new Scope.ClassScope(predefClass, scopeCounter); 391 Scope scope = new Scope(predefClass);
394 predefClass.members_field = scope; 392 predefClass.members_field = scope;
395 393
396 // Enter symbols for basic types. 394 // Enter symbols for basic types.
397 scope.enter(byteType.tsym); 395 scope.enter(byteType.tsym);
398 scope.enter(shortType.tsym); 396 scope.enter(shortType.tsym);
481 this.proprietaryType = proprietaryType; 479 this.proprietaryType = proprietaryType;
482 ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym; 480 ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
483 proprietarySymbol.completer = null; 481 proprietarySymbol.completer = null;
484 proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; 482 proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
485 proprietarySymbol.erasure_field = proprietaryType; 483 proprietarySymbol.erasure_field = proprietaryType;
486 proprietarySymbol.members_field = new Scope.ClassScope(proprietarySymbol, scopeCounter); 484 proprietarySymbol.members_field = new Scope(proprietarySymbol);
487 proprietaryType.typarams_field = List.nil(); 485 proprietaryType.typarams_field = List.nil();
488 proprietaryType.allparams_field = List.nil(); 486 proprietaryType.allparams_field = List.nil();
489 proprietaryType.supertype_field = annotationType; 487 proprietaryType.supertype_field = annotationType;
490 proprietaryType.interfaces_field = List.nil(); 488 proprietaryType.interfaces_field = List.nil();
491 489
493 // The class implements java.lang.Cloneable and java.io.Serializable. 491 // The class implements java.lang.Cloneable and java.io.Serializable.
494 // It has a final length field and a clone method. 492 // It has a final length field and a clone method.
495 ClassType arrayClassType = (ClassType)arrayClass.type; 493 ClassType arrayClassType = (ClassType)arrayClass.type;
496 arrayClassType.supertype_field = objectType; 494 arrayClassType.supertype_field = objectType;
497 arrayClassType.interfaces_field = List.of(cloneableType, serializableType); 495 arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
498 arrayClass.members_field = new Scope.ClassScope(arrayClass, scopeCounter); 496 arrayClass.members_field = new Scope(arrayClass);
499 lengthVar = new VarSymbol( 497 lengthVar = new VarSymbol(
500 PUBLIC | FINAL, 498 PUBLIC | FINAL,
501 names.length, 499 names.length,
502 intType, 500 intType,
503 arrayClass); 501 arrayClass);

mercurial