< prev index next >

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

Print this page

209     public final Type inheritedType;
210     public final Type profileType;
211     public final Type proprietaryType;
212     public final Type systemType;
213     public final Type autoCloseableType;
214     public final Type trustMeType;
215     public final Type lambdaMetafactory;
216     public final Type stringConcatFactory;
217     public final Type repeatableType;
218     public final Type documentedType;
219     public final Type elementTypeType;
220     public final Type functionalInterfaceType;
221     public final Type previewFeatureType;
222     public final Type previewFeatureInternalType;
223     public final Type restrictedType;
224     public final Type restrictedInternalType;
225     public final Type typeDescriptorType;
226     public final Type recordType;
227     public final Type switchBootstrapsType;
228     public final Type constantBootstrapsType;
229     public final Type valueBasedType;
230     public final Type valueBasedInternalType;
231     public final Type classDescType;
232     public final Type enumDescType;
233     public final Type ioType;
234 
235     // For serialization lint checking
236     public final Type objectStreamFieldType;
237     public final Type objectInputStreamType;
238     public final Type objectOutputStreamType;
239     public final Type ioExceptionType;
240     public final Type objectStreamExceptionType;
241     // For externalization lint checking
242     public final Type externalizableType;
243     public final Type objectInputType;
244     public final Type objectOutputType;
245 










246     /** The symbol representing the length field of an array.
247      */
248     public final VarSymbol lengthVar;
249 
250     /** The symbol representing the final finalize method on enums */
251     public final MethodSymbol enumFinalFinalize;
252 
253     /** The symbol representing the close method on TWR AutoCloseable type */
254     public final MethodSymbol autoCloseableClose;
255 
256     /** The predefined type that belongs to a tag.
257      */
258     public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()];
259 
260     /** The name of the class that belongs to a basic type tag.
261      */
262     public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()];
263 
264     /** A hashtable containing the encountered top-level and member classes,
265      *  indexed by flat names. The table does not contain local classes.

518 
519         // Enter symbols for basic types.
520         scope.enter(byteType.tsym);
521         scope.enter(shortType.tsym);
522         scope.enter(charType.tsym);
523         scope.enter(intType.tsym);
524         scope.enter(longType.tsym);
525         scope.enter(floatType.tsym);
526         scope.enter(doubleType.tsym);
527         scope.enter(booleanType.tsym);
528         scope.enter(errType.tsym);
529 
530         // Enter symbol for the errSymbol
531         scope.enter(errSymbol);
532 
533         // Get the initial completer for ModuleSymbols from Modules
534         moduleCompleter = Modules.instance(context).getCompleter();
535 
536         // Enter predefined classes. All are assumed to be in the java.base module.
537         objectType = enterClass("java.lang.Object");






538         objectMethodsType = enterClass("java.lang.runtime.ObjectMethods");
539         exactConversionsSupportType = enterClass("java.lang.runtime.ExactConversionsSupport");
540         objectsType = enterClass("java.util.Objects");
541         classType = enterClass("java.lang.Class");
542         stringType = enterClass("java.lang.String");
543         stringBufferType = enterClass("java.lang.StringBuffer");
544         stringBuilderType = enterClass("java.lang.StringBuilder");
545         cloneableType = enterClass("java.lang.Cloneable");
546         throwableType = enterClass("java.lang.Throwable");
547         serializableType = enterClass("java.io.Serializable");
548         serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
549         varHandleType = enterClass("java.lang.invoke.VarHandle");
550         methodHandleType = enterClass("java.lang.invoke.MethodHandle");
551         methodHandlesType = enterClass("java.lang.invoke.MethodHandles");
552         methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
553         methodTypeType = enterClass("java.lang.invoke.MethodType");
554         errorType = enterClass("java.lang.Error");
555         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
556         interruptedExceptionType = enterClass("java.lang.InterruptedException");
557         exceptionType = enterClass("java.lang.Exception");
558         runtimeExceptionType = enterClass("java.lang.RuntimeException");
559         classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
560         noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
561         noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
562         assertionErrorType = enterClass("java.lang.AssertionError");
563         incompatibleClassChangeErrorType = enterClass("java.lang.IncompatibleClassChangeError");
564         cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
565         matchExceptionType = enterClass("java.lang.MatchException");
566         annotationType = enterClass("java.lang.annotation.Annotation");

594         autoCloseableClose = new MethodSymbol(PUBLIC,
595                              names.close,
596                              new MethodType(List.nil(), voidType,
597                                             List.of(exceptionType), methodClass),
598                              autoCloseableType.tsym);
599         trustMeType = enterClass("java.lang.SafeVarargs");
600         nativeHeaderType = enterClass("java.lang.annotation.Native");
601         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
602         stringConcatFactory = enterClass("java.lang.invoke.StringConcatFactory");
603         functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
604         previewFeatureType = enterClass("jdk.internal.javac.PreviewFeature");
605         previewFeatureInternalType = enterSyntheticAnnotation("jdk.internal.PreviewFeature+Annotation");
606         restrictedType = enterClass("jdk.internal.javac.Restricted");
607         restrictedInternalType = enterSyntheticAnnotation("jdk.internal.javac.Restricted+Annotation");
608         typeDescriptorType = enterClass("java.lang.invoke.TypeDescriptor");
609         recordType = enterClass("java.lang.Record");
610         switchBootstrapsType = enterClass("java.lang.runtime.SwitchBootstraps");
611         constantBootstrapsType = enterClass("java.lang.invoke.ConstantBootstraps");
612         valueBasedType = enterClass("jdk.internal.ValueBased");
613         valueBasedInternalType = enterSyntheticAnnotation("jdk.internal.ValueBased+Annotation");



614         classDescType = enterClass("java.lang.constant.ClassDesc");
615         enumDescType = enterClass("java.lang.Enum$EnumDesc");
616         ioType = enterClass("java.io.IO");
617         // For serialization lint checking
618         objectStreamFieldType = enterClass("java.io.ObjectStreamField");
619         objectInputStreamType = enterClass("java.io.ObjectInputStream");
620         objectOutputStreamType = enterClass("java.io.ObjectOutputStream");
621         ioExceptionType = enterClass("java.io.IOException");
622         objectStreamExceptionType = enterClass("java.io.ObjectStreamException");
623         externalizableType = enterClass("java.io.Externalizable");
624         objectInputType  = enterClass("java.io.ObjectInput");
625         objectOutputType = enterClass("java.io.ObjectOutput");
626         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
627         synthesizeEmptyInterfaceIfMissing(cloneableType);
628         synthesizeEmptyInterfaceIfMissing(serializableType);
629         synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
630         synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
631         synthesizeEmptyInterfaceIfMissing(stringConcatFactory);
632         synthesizeBoxTypeIfMissing(doubleType);
633         synthesizeBoxTypeIfMissing(floatType);
634         synthesizeBoxTypeIfMissing(voidType);
635 


636         // Enter a synthetic class that is used to mark internal
637         // proprietary classes in ct.sym.  This class does not have a
638         // class file.
639         proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
640 
641         // Enter a synthetic class that is used to provide profile info for
642         // classes in ct.sym.  This class does not have a class file.
643         profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
644         MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
645         profileType.tsym.members().enter(m);
646 
647         // Enter a class for arrays.
648         // The class implements java.lang.Cloneable and java.io.Serializable.
649         // It has a final length field and a clone method.
650         ClassType arrayClassType = (ClassType)arrayClass.type;
651         arrayClassType.supertype_field = objectType;
652         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
653         arrayClass.members_field = WriteableScope.create(arrayClass);
654         lengthVar = new VarSymbol(
655             PUBLIC | FINAL,

209     public final Type inheritedType;
210     public final Type profileType;
211     public final Type proprietaryType;
212     public final Type systemType;
213     public final Type autoCloseableType;
214     public final Type trustMeType;
215     public final Type lambdaMetafactory;
216     public final Type stringConcatFactory;
217     public final Type repeatableType;
218     public final Type documentedType;
219     public final Type elementTypeType;
220     public final Type functionalInterfaceType;
221     public final Type previewFeatureType;
222     public final Type previewFeatureInternalType;
223     public final Type restrictedType;
224     public final Type restrictedInternalType;
225     public final Type typeDescriptorType;
226     public final Type recordType;
227     public final Type switchBootstrapsType;
228     public final Type constantBootstrapsType;


229     public final Type classDescType;
230     public final Type enumDescType;
231     public final Type ioType;
232 
233     // For serialization lint checking
234     public final Type objectStreamFieldType;
235     public final Type objectInputStreamType;
236     public final Type objectOutputStreamType;
237     public final Type ioExceptionType;
238     public final Type objectStreamExceptionType;
239     // For externalization lint checking
240     public final Type externalizableType;
241     public final Type objectInputType;
242     public final Type objectOutputType;
243 
244     // valhalla
245     public final Type valueBasedType;
246     public final Type valueBasedInternalType;
247     public final Type migratedValueClassType;
248     public final Type migratedValueClassInternalType;
249     public final Type strictType;
250     /** The symbol representing the finalize method on Object */
251     public final MethodSymbol objectFinalize;
252     public final Type numberType;
253 
254     /** The symbol representing the length field of an array.
255      */
256     public final VarSymbol lengthVar;
257 
258     /** The symbol representing the final finalize method on enums */
259     public final MethodSymbol enumFinalFinalize;
260 
261     /** The symbol representing the close method on TWR AutoCloseable type */
262     public final MethodSymbol autoCloseableClose;
263 
264     /** The predefined type that belongs to a tag.
265      */
266     public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()];
267 
268     /** The name of the class that belongs to a basic type tag.
269      */
270     public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()];
271 
272     /** A hashtable containing the encountered top-level and member classes,
273      *  indexed by flat names. The table does not contain local classes.

526 
527         // Enter symbols for basic types.
528         scope.enter(byteType.tsym);
529         scope.enter(shortType.tsym);
530         scope.enter(charType.tsym);
531         scope.enter(intType.tsym);
532         scope.enter(longType.tsym);
533         scope.enter(floatType.tsym);
534         scope.enter(doubleType.tsym);
535         scope.enter(booleanType.tsym);
536         scope.enter(errType.tsym);
537 
538         // Enter symbol for the errSymbol
539         scope.enter(errSymbol);
540 
541         // Get the initial completer for ModuleSymbols from Modules
542         moduleCompleter = Modules.instance(context).getCompleter();
543 
544         // Enter predefined classes. All are assumed to be in the java.base module.
545         objectType = enterClass("java.lang.Object");
546         throwableType = enterClass("java.lang.Throwable");
547         objectFinalize = new MethodSymbol(PROTECTED,
548                 names.finalize,
549                 new MethodType(List.nil(), voidType,
550                         List.of(throwableType), methodClass),
551                 objectType.tsym);
552         objectMethodsType = enterClass("java.lang.runtime.ObjectMethods");
553         exactConversionsSupportType = enterClass("java.lang.runtime.ExactConversionsSupport");
554         objectsType = enterClass("java.util.Objects");
555         classType = enterClass("java.lang.Class");
556         stringType = enterClass("java.lang.String");
557         stringBufferType = enterClass("java.lang.StringBuffer");
558         stringBuilderType = enterClass("java.lang.StringBuilder");
559         cloneableType = enterClass("java.lang.Cloneable");

560         serializableType = enterClass("java.io.Serializable");
561         serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
562         varHandleType = enterClass("java.lang.invoke.VarHandle");
563         methodHandleType = enterClass("java.lang.invoke.MethodHandle");
564         methodHandlesType = enterClass("java.lang.invoke.MethodHandles");
565         methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
566         methodTypeType = enterClass("java.lang.invoke.MethodType");
567         errorType = enterClass("java.lang.Error");
568         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
569         interruptedExceptionType = enterClass("java.lang.InterruptedException");
570         exceptionType = enterClass("java.lang.Exception");
571         runtimeExceptionType = enterClass("java.lang.RuntimeException");
572         classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
573         noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
574         noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
575         assertionErrorType = enterClass("java.lang.AssertionError");
576         incompatibleClassChangeErrorType = enterClass("java.lang.IncompatibleClassChangeError");
577         cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
578         matchExceptionType = enterClass("java.lang.MatchException");
579         annotationType = enterClass("java.lang.annotation.Annotation");

607         autoCloseableClose = new MethodSymbol(PUBLIC,
608                              names.close,
609                              new MethodType(List.nil(), voidType,
610                                             List.of(exceptionType), methodClass),
611                              autoCloseableType.tsym);
612         trustMeType = enterClass("java.lang.SafeVarargs");
613         nativeHeaderType = enterClass("java.lang.annotation.Native");
614         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
615         stringConcatFactory = enterClass("java.lang.invoke.StringConcatFactory");
616         functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
617         previewFeatureType = enterClass("jdk.internal.javac.PreviewFeature");
618         previewFeatureInternalType = enterSyntheticAnnotation("jdk.internal.PreviewFeature+Annotation");
619         restrictedType = enterClass("jdk.internal.javac.Restricted");
620         restrictedInternalType = enterSyntheticAnnotation("jdk.internal.javac.Restricted+Annotation");
621         typeDescriptorType = enterClass("java.lang.invoke.TypeDescriptor");
622         recordType = enterClass("java.lang.Record");
623         switchBootstrapsType = enterClass("java.lang.runtime.SwitchBootstraps");
624         constantBootstrapsType = enterClass("java.lang.invoke.ConstantBootstraps");
625         valueBasedType = enterClass("jdk.internal.ValueBased");
626         valueBasedInternalType = enterSyntheticAnnotation("jdk.internal.ValueBased+Annotation");
627         strictType = enterSyntheticAnnotation("jdk.internal.vm.annotation.Strict");
628         migratedValueClassType = enterClass("jdk.internal.MigratedValueClass");
629         migratedValueClassInternalType = enterSyntheticAnnotation("jdk.internal.MigratedValueClass+Annotation");
630         classDescType = enterClass("java.lang.constant.ClassDesc");
631         enumDescType = enterClass("java.lang.Enum$EnumDesc");
632         ioType = enterClass("java.io.IO");
633         // For serialization lint checking
634         objectStreamFieldType = enterClass("java.io.ObjectStreamField");
635         objectInputStreamType = enterClass("java.io.ObjectInputStream");
636         objectOutputStreamType = enterClass("java.io.ObjectOutputStream");
637         ioExceptionType = enterClass("java.io.IOException");
638         objectStreamExceptionType = enterClass("java.io.ObjectStreamException");
639         externalizableType = enterClass("java.io.Externalizable");
640         objectInputType  = enterClass("java.io.ObjectInput");
641         objectOutputType = enterClass("java.io.ObjectOutput");
642         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
643         synthesizeEmptyInterfaceIfMissing(cloneableType);
644         synthesizeEmptyInterfaceIfMissing(serializableType);
645         synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
646         synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
647         synthesizeEmptyInterfaceIfMissing(stringConcatFactory);
648         synthesizeBoxTypeIfMissing(doubleType);
649         synthesizeBoxTypeIfMissing(floatType);
650         synthesizeBoxTypeIfMissing(voidType);
651 
652         numberType = enterClass("java.lang.Number");
653 
654         // Enter a synthetic class that is used to mark internal
655         // proprietary classes in ct.sym.  This class does not have a
656         // class file.
657         proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
658 
659         // Enter a synthetic class that is used to provide profile info for
660         // classes in ct.sym.  This class does not have a class file.
661         profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
662         MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
663         profileType.tsym.members().enter(m);
664 
665         // Enter a class for arrays.
666         // The class implements java.lang.Cloneable and java.io.Serializable.
667         // It has a final length field and a clone method.
668         ClassType arrayClassType = (ClassType)arrayClass.type;
669         arrayClassType.supertype_field = objectType;
670         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
671         arrayClass.members_field = WriteableScope.create(arrayClass);
672         lengthVar = new VarSymbol(
673             PUBLIC | FINAL,
< prev index next >