src/share/classes/com/sun/tools/javac/code/Symtab.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File langtools Sdiff src/share/classes/com/sun/tools/javac/code

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

Print this page




 139     public final Type runtimeExceptionType;
 140     public final Type classNotFoundExceptionType;
 141     public final Type noClassDefFoundErrorType;
 142     public final Type noSuchFieldErrorType;
 143     public final Type assertionErrorType;
 144     public final Type cloneNotSupportedExceptionType;
 145     public final Type annotationType;
 146     public final TypeSymbol enumSym;
 147     public final Type listType;
 148     public final Type collectionsType;
 149     public final Type comparableType;
 150     public final Type arraysType;
 151     public final Type iterableType;
 152     public final Type iteratorType;
 153     public final Type annotationTargetType;
 154     public final Type overrideType;
 155     public final Type retentionType;
 156     public final Type deprecatedType;
 157     public final Type suppressWarningsType;
 158     public final Type inheritedType;

 159     public final Type proprietaryType;
 160     public final Type systemType;
 161     public final Type autoCloseableType;
 162     public final Type trustMeType;
 163     public final Type lambdaMetafactory;
 164     public final Type containedByType;
 165     public final Type containerForType;
 166     public final Type documentedType;
 167     public final Type elementTypeType;
 168 
 169     /** The symbol representing the length field of an array.
 170      */
 171     public final VarSymbol lengthVar;
 172 
 173     /** The null check operator. */
 174     public final OperatorSymbol nullcheck;
 175 
 176     /** The symbol representing the final finalize method on enums */
 177     public final MethodSymbol enumFinalFinalize;
 178 


 343                             new MethodSymbol(PUBLIC | STATIC,
 344                                 n,
 345                                 new MethodType(List.of(type), sym.type,
 346                                     List.<Type>nil(), methodClass),
 347                                 sym);
 348                         sym.members().enter(boxMethod);
 349                         MethodSymbol unboxMethod =
 350                             new MethodSymbol(PUBLIC,
 351                                 type.tsym.name.append(names.Value), // x.intValue()
 352                                 new MethodType(List.<Type>nil(), type,
 353                                     List.<Type>nil(), methodClass),
 354                                 sym);
 355                         sym.members().enter(unboxMethod);
 356                     }
 357                 }
 358             };
 359         }
 360 
 361     }
 362 
















 363     /** Constructor; enters all predefined identifiers and operators
 364      *  into symbol table.
 365      */
 366     protected Symtab(Context context) throws CompletionFailure {
 367         context.put(symtabKey, this);
 368 
 369         names = Names.instance(context);
 370         target = Target.instance(context);
 371 
 372         // Create the unknown type
 373         unknownType = new Type(UNKNOWN, null) {
 374             @Override
 375             public <R, P> R accept(TypeVisitor<R, P> v, P p) {
 376                 return v.visitUnknown(this, p);
 377             }
 378         };
 379 
 380         // create the basic builtin symbols
 381         rootPackage = new PackageSymbol(names.empty, null);
 382         final JavacMessages messages = JavacMessages.instance(context);


 504                              names.close,
 505                              new MethodType(List.<Type>nil(), voidType,
 506                                             List.of(exceptionType), methodClass),
 507                              autoCloseableType.tsym);
 508         trustMeType = enterClass("java.lang.SafeVarargs");
 509         nativeHeaderType = enterClass("java.lang.annotation.Native");
 510         nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
 511         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
 512 
 513         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
 514         synthesizeEmptyInterfaceIfMissing(cloneableType);
 515         synthesizeEmptyInterfaceIfMissing(serializableType);
 516         synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
 517         synthesizeBoxTypeIfMissing(doubleType);
 518         synthesizeBoxTypeIfMissing(floatType);
 519         synthesizeBoxTypeIfMissing(voidType);
 520 
 521         // Enter a synthetic class that is used to mark internal
 522         // proprietary classes in ct.sym.  This class does not have a
 523         // class file.
 524         ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
 525         this.proprietaryType = proprietaryType;
 526         ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
 527         proprietarySymbol.completer = null;
 528         proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
 529         proprietarySymbol.erasure_field = proprietaryType;
 530         proprietarySymbol.members_field = new Scope(proprietarySymbol);
 531         proprietaryType.typarams_field = List.nil();
 532         proprietaryType.allparams_field = List.nil();
 533         proprietaryType.supertype_field = annotationType;
 534         proprietaryType.interfaces_field = List.nil();
 535 
 536         // Enter a class for arrays.
 537         // The class implements java.lang.Cloneable and java.io.Serializable.
 538         // It has a final length field and a clone method.
 539         ClassType arrayClassType = (ClassType)arrayClass.type;
 540         arrayClassType.supertype_field = objectType;
 541         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
 542         arrayClass.members_field = new Scope(arrayClass);
 543         lengthVar = new VarSymbol(
 544             PUBLIC | FINAL,
 545             names.length,
 546             intType,
 547             arrayClass);
 548         arrayClass.members().enter(lengthVar);
 549         arrayCloneMethod = new MethodSymbol(
 550             PUBLIC,
 551             names.clone,
 552             new MethodType(List.<Type>nil(), objectType,
 553                            List.<Type>nil(), methodClass),
 554             arrayClass);




 139     public final Type runtimeExceptionType;
 140     public final Type classNotFoundExceptionType;
 141     public final Type noClassDefFoundErrorType;
 142     public final Type noSuchFieldErrorType;
 143     public final Type assertionErrorType;
 144     public final Type cloneNotSupportedExceptionType;
 145     public final Type annotationType;
 146     public final TypeSymbol enumSym;
 147     public final Type listType;
 148     public final Type collectionsType;
 149     public final Type comparableType;
 150     public final Type arraysType;
 151     public final Type iterableType;
 152     public final Type iteratorType;
 153     public final Type annotationTargetType;
 154     public final Type overrideType;
 155     public final Type retentionType;
 156     public final Type deprecatedType;
 157     public final Type suppressWarningsType;
 158     public final Type inheritedType;
 159     public final Type profileType;
 160     public final Type proprietaryType;
 161     public final Type systemType;
 162     public final Type autoCloseableType;
 163     public final Type trustMeType;
 164     public final Type lambdaMetafactory;
 165     public final Type containedByType;
 166     public final Type containerForType;
 167     public final Type documentedType;
 168     public final Type elementTypeType;
 169 
 170     /** The symbol representing the length field of an array.
 171      */
 172     public final VarSymbol lengthVar;
 173 
 174     /** The null check operator. */
 175     public final OperatorSymbol nullcheck;
 176 
 177     /** The symbol representing the final finalize method on enums */
 178     public final MethodSymbol enumFinalFinalize;
 179 


 344                             new MethodSymbol(PUBLIC | STATIC,
 345                                 n,
 346                                 new MethodType(List.of(type), sym.type,
 347                                     List.<Type>nil(), methodClass),
 348                                 sym);
 349                         sym.members().enter(boxMethod);
 350                         MethodSymbol unboxMethod =
 351                             new MethodSymbol(PUBLIC,
 352                                 type.tsym.name.append(names.Value), // x.intValue()
 353                                 new MethodType(List.<Type>nil(), type,
 354                                     List.<Type>nil(), methodClass),
 355                                 sym);
 356                         sym.members().enter(unboxMethod);
 357                     }
 358                 }
 359             };
 360         }
 361 
 362     }
 363     
 364     // Enter a synthetic class that is used to mark classes in ct.sym.  
 365     // This class does not have a class file.
 366     private Type enterSyntheticAnnotation(String name) {
 367         ClassType type = (ClassType)enterClass(name);
 368         ClassSymbol sym = (ClassSymbol)type.tsym;
 369         sym.completer = null;
 370         sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
 371         sym.erasure_field = type;
 372         sym.members_field = new Scope(sym);
 373         type.typarams_field = List.nil();
 374         type.allparams_field = List.nil();
 375         type.supertype_field = annotationType;
 376         type.interfaces_field = List.nil();
 377         return type;
 378     }
 379 
 380     /** Constructor; enters all predefined identifiers and operators
 381      *  into symbol table.
 382      */
 383     protected Symtab(Context context) throws CompletionFailure {
 384         context.put(symtabKey, this);
 385 
 386         names = Names.instance(context);
 387         target = Target.instance(context);
 388 
 389         // Create the unknown type
 390         unknownType = new Type(UNKNOWN, null) {
 391             @Override
 392             public <R, P> R accept(TypeVisitor<R, P> v, P p) {
 393                 return v.visitUnknown(this, p);
 394             }
 395         };
 396 
 397         // create the basic builtin symbols
 398         rootPackage = new PackageSymbol(names.empty, null);
 399         final JavacMessages messages = JavacMessages.instance(context);


 521                              names.close,
 522                              new MethodType(List.<Type>nil(), voidType,
 523                                             List.of(exceptionType), methodClass),
 524                              autoCloseableType.tsym);
 525         trustMeType = enterClass("java.lang.SafeVarargs");
 526         nativeHeaderType = enterClass("java.lang.annotation.Native");
 527         nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
 528         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
 529 
 530         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
 531         synthesizeEmptyInterfaceIfMissing(cloneableType);
 532         synthesizeEmptyInterfaceIfMissing(serializableType);
 533         synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
 534         synthesizeBoxTypeIfMissing(doubleType);
 535         synthesizeBoxTypeIfMissing(floatType);
 536         synthesizeBoxTypeIfMissing(voidType);
 537 
 538         // Enter a synthetic class that is used to mark internal
 539         // proprietary classes in ct.sym.  This class does not have a
 540         // class file.
 541         proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
 542         
 543         // Enter a synthetic class that is used to provide profile info for
 544         // classes in ct.sym.  This class does not have a class file.
 545         profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
 546         MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
 547         profileType.tsym.members().enter(m);




 548 
 549         // Enter a class for arrays.
 550         // The class implements java.lang.Cloneable and java.io.Serializable.
 551         // It has a final length field and a clone method.
 552         ClassType arrayClassType = (ClassType)arrayClass.type;
 553         arrayClassType.supertype_field = objectType;
 554         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
 555         arrayClass.members_field = new Scope(arrayClass);
 556         lengthVar = new VarSymbol(
 557             PUBLIC | FINAL,
 558             names.length,
 559             intType,
 560             arrayClass);
 561         arrayClass.members().enter(lengthVar);
 562         arrayCloneMethod = new MethodSymbol(
 563             PUBLIC,
 564             names.clone,
 565             new MethodType(List.<Type>nil(), objectType,
 566                            List.<Type>nil(), methodClass),
 567             arrayClass);


src/share/classes/com/sun/tools/javac/code/Symtab.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File