210 public final Type inheritedType;
211 public final Type profileType;
212 public final Type proprietaryType;
213 public final Type systemType;
214 public final Type autoCloseableType;
215 public final Type trustMeType;
216 public final Type lambdaMetafactory;
217 public final Type stringConcatFactory;
218 public final Type repeatableType;
219 public final Type documentedType;
220 public final Type elementTypeType;
221 public final Type functionalInterfaceType;
222 public final Type previewFeatureType;
223 public final Type previewFeatureInternalType;
224 public final Type restrictedType;
225 public final Type restrictedInternalType;
226 public final Type typeDescriptorType;
227 public final Type recordType;
228 public final Type switchBootstrapsType;
229 public final Type constantBootstrapsType;
230 public final Type valueBasedType;
231 public final Type valueBasedInternalType;
232 public final Type classDescType;
233 public final Type enumDescType;
234 public final Type ioType;
235
236 // For serialization lint checking
237 public final Type objectStreamFieldType;
238 public final Type objectInputStreamType;
239 public final Type objectOutputStreamType;
240 public final Type ioExceptionType;
241 public final Type objectStreamExceptionType;
242 // For externalization lint checking
243 public final Type externalizableType;
244 public final Type objectInputType;
245 public final Type objectOutputType;
246
247 /** The symbol representing the length field of an array.
248 */
249 public final VarSymbol lengthVar;
250
251 /** The symbol representing the final finalize method on enums */
252 public final MethodSymbol enumFinalFinalize;
253
254 /** The symbol representing the close method on TWR AutoCloseable type */
255 public final MethodSymbol autoCloseableClose;
256
257 /** The predefined type that belongs to a tag.
258 */
259 public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()];
260
261 /** The name of the class that belongs to a basic type tag.
262 */
263 public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()];
264
265 /** A hashtable containing the encountered top-level and member classes,
266 * indexed by flat names. The table does not contain local classes.
522
523 // Enter symbols for basic types.
524 scope.enter(byteType.tsym);
525 scope.enter(shortType.tsym);
526 scope.enter(charType.tsym);
527 scope.enter(intType.tsym);
528 scope.enter(longType.tsym);
529 scope.enter(floatType.tsym);
530 scope.enter(doubleType.tsym);
531 scope.enter(booleanType.tsym);
532 scope.enter(errType.tsym);
533
534 // Enter symbol for the errSymbol
535 scope.enter(errSymbol);
536
537 // Get the initial completer for ModuleSymbols from Modules
538 moduleCompleter = Modules.instance(context).getCompleter();
539
540 // Enter predefined classes. All are assumed to be in the java.base module.
541 objectType = enterClass("java.lang.Object");
542 objectMethodsType = enterClass("java.lang.runtime.ObjectMethods");
543 exactConversionsSupportType = enterClass("java.lang.runtime.ExactConversionsSupport");
544 objectsType = enterClass("java.util.Objects");
545 classType = enterClass("java.lang.Class");
546 stringType = enterClass("java.lang.String");
547 stringBufferType = enterClass("java.lang.StringBuffer");
548 stringBuilderType = enterClass("java.lang.StringBuilder");
549 cloneableType = enterClass("java.lang.Cloneable");
550 throwableType = enterClass("java.lang.Throwable");
551 serializableType = enterClass("java.io.Serializable");
552 serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
553 varHandleType = enterClass("java.lang.invoke.VarHandle");
554 methodHandleType = enterClass("java.lang.invoke.MethodHandle");
555 methodHandlesType = enterClass("java.lang.invoke.MethodHandles");
556 methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
557 methodTypeType = enterClass("java.lang.invoke.MethodType");
558 errorType = enterClass("java.lang.Error");
559 illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
560 interruptedExceptionType = enterClass("java.lang.InterruptedException");
561 exceptionType = enterClass("java.lang.Exception");
562 runtimeExceptionType = enterClass("java.lang.RuntimeException");
563 classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
564 noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
565 noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
566 assertionErrorType = enterClass("java.lang.AssertionError");
567 incompatibleClassChangeErrorType = enterClass("java.lang.IncompatibleClassChangeError");
568 cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
569 matchExceptionType = enterClass("java.lang.MatchException");
570 annotationType = enterClass("java.lang.annotation.Annotation");
598 autoCloseableClose = new MethodSymbol(PUBLIC,
599 names.close,
600 new MethodType(List.nil(), voidType,
601 List.of(exceptionType), methodClass),
602 autoCloseableType.tsym);
603 trustMeType = enterClass("java.lang.SafeVarargs");
604 nativeHeaderType = enterClass("java.lang.annotation.Native");
605 lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
606 stringConcatFactory = enterClass("java.lang.invoke.StringConcatFactory");
607 functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
608 previewFeatureType = enterClass("jdk.internal.javac.PreviewFeature");
609 previewFeatureInternalType = enterSyntheticAnnotation("jdk.internal.PreviewFeature+Annotation");
610 restrictedType = enterClass("jdk.internal.javac.Restricted");
611 restrictedInternalType = enterSyntheticAnnotation("jdk.internal.javac.Restricted+Annotation");
612 typeDescriptorType = enterClass("java.lang.invoke.TypeDescriptor");
613 recordType = enterClass("java.lang.Record");
614 switchBootstrapsType = enterClass("java.lang.runtime.SwitchBootstraps");
615 constantBootstrapsType = enterClass("java.lang.invoke.ConstantBootstraps");
616 valueBasedType = enterClass("jdk.internal.ValueBased");
617 valueBasedInternalType = enterSyntheticAnnotation("jdk.internal.ValueBased+Annotation");
618 classDescType = enterClass("java.lang.constant.ClassDesc");
619 enumDescType = enterClass("java.lang.Enum$EnumDesc");
620 ioType = enterClass("java.io.IO");
621 // For serialization lint checking
622 objectStreamFieldType = enterClass("java.io.ObjectStreamField");
623 objectInputStreamType = enterClass("java.io.ObjectInputStream");
624 objectOutputStreamType = enterClass("java.io.ObjectOutputStream");
625 ioExceptionType = enterClass("java.io.IOException");
626 objectStreamExceptionType = enterClass("java.io.ObjectStreamException");
627 externalizableType = enterClass("java.io.Externalizable");
628 objectInputType = enterClass("java.io.ObjectInput");
629 objectOutputType = enterClass("java.io.ObjectOutput");
630 synthesizeEmptyInterfaceIfMissing(autoCloseableType);
631 synthesizeEmptyInterfaceIfMissing(cloneableType);
632 synthesizeEmptyInterfaceIfMissing(serializableType);
633 synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
634 synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
635 synthesizeEmptyInterfaceIfMissing(stringConcatFactory);
636 synthesizeBoxTypeIfMissing(doubleType);
637 synthesizeBoxTypeIfMissing(floatType);
638 synthesizeBoxTypeIfMissing(voidType);
639
640 // Enter a synthetic class that is used to mark internal
641 // proprietary classes in ct.sym. This class does not have a
642 // class file.
643 proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
644
645 // Enter a synthetic class that is used to provide profile info for
646 // classes in ct.sym. This class does not have a class file.
647 profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
648 MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
649 profileType.tsym.members().enter(m);
650
651 // Enter a class for arrays.
652 // The class implements java.lang.Cloneable and java.io.Serializable.
653 // It has a final length field and a clone method.
654 ClassType arrayClassType = (ClassType)arrayClass.type;
655 arrayClassType.supertype_field = objectType;
656 arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
657 arrayClass.members_field = WriteableScope.create(arrayClass);
658 lengthVar = new VarSymbol(
659 PUBLIC | FINAL,
|
210 public final Type inheritedType;
211 public final Type profileType;
212 public final Type proprietaryType;
213 public final Type systemType;
214 public final Type autoCloseableType;
215 public final Type trustMeType;
216 public final Type lambdaMetafactory;
217 public final Type stringConcatFactory;
218 public final Type repeatableType;
219 public final Type documentedType;
220 public final Type elementTypeType;
221 public final Type functionalInterfaceType;
222 public final Type previewFeatureType;
223 public final Type previewFeatureInternalType;
224 public final Type restrictedType;
225 public final Type restrictedInternalType;
226 public final Type typeDescriptorType;
227 public final Type recordType;
228 public final Type switchBootstrapsType;
229 public final Type constantBootstrapsType;
230 public final Type classDescType;
231 public final Type enumDescType;
232 public final Type ioType;
233
234 // For serialization lint checking
235 public final Type objectStreamFieldType;
236 public final Type objectInputStreamType;
237 public final Type objectOutputStreamType;
238 public final Type ioExceptionType;
239 public final Type objectStreamExceptionType;
240 // For externalization lint checking
241 public final Type externalizableType;
242 public final Type objectInputType;
243 public final Type objectOutputType;
244
245 // valhalla
246 public final Type valueBasedType;
247 public final Type valueBasedInternalType;
248 public final Type migratedValueClassType;
249 public final Type migratedValueClassInternalType;
250 public final Type strictType;
251 /** The symbol representing the finalize method on Object */
252 public final MethodSymbol objectFinalize;
253 public final Type numberType;
254
255 /** The symbol representing the length field of an array.
256 */
257 public final VarSymbol lengthVar;
258
259 /** The symbol representing the final finalize method on enums */
260 public final MethodSymbol enumFinalFinalize;
261
262 /** The symbol representing the close method on TWR AutoCloseable type */
263 public final MethodSymbol autoCloseableClose;
264
265 /** The predefined type that belongs to a tag.
266 */
267 public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()];
268
269 /** The name of the class that belongs to a basic type tag.
270 */
271 public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()];
272
273 /** A hashtable containing the encountered top-level and member classes,
274 * indexed by flat names. The table does not contain local classes.
530
531 // Enter symbols for basic types.
532 scope.enter(byteType.tsym);
533 scope.enter(shortType.tsym);
534 scope.enter(charType.tsym);
535 scope.enter(intType.tsym);
536 scope.enter(longType.tsym);
537 scope.enter(floatType.tsym);
538 scope.enter(doubleType.tsym);
539 scope.enter(booleanType.tsym);
540 scope.enter(errType.tsym);
541
542 // Enter symbol for the errSymbol
543 scope.enter(errSymbol);
544
545 // Get the initial completer for ModuleSymbols from Modules
546 moduleCompleter = Modules.instance(context).getCompleter();
547
548 // Enter predefined classes. All are assumed to be in the java.base module.
549 objectType = enterClass("java.lang.Object");
550 throwableType = enterClass("java.lang.Throwable");
551 objectFinalize = new MethodSymbol(PROTECTED,
552 names.finalize,
553 new MethodType(List.nil(), voidType,
554 List.of(throwableType), methodClass),
555 objectType.tsym);
556 objectMethodsType = enterClass("java.lang.runtime.ObjectMethods");
557 exactConversionsSupportType = enterClass("java.lang.runtime.ExactConversionsSupport");
558 objectsType = enterClass("java.util.Objects");
559 classType = enterClass("java.lang.Class");
560 stringType = enterClass("java.lang.String");
561 stringBufferType = enterClass("java.lang.StringBuffer");
562 stringBuilderType = enterClass("java.lang.StringBuilder");
563 cloneableType = enterClass("java.lang.Cloneable");
564 serializableType = enterClass("java.io.Serializable");
565 serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
566 varHandleType = enterClass("java.lang.invoke.VarHandle");
567 methodHandleType = enterClass("java.lang.invoke.MethodHandle");
568 methodHandlesType = enterClass("java.lang.invoke.MethodHandles");
569 methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
570 methodTypeType = enterClass("java.lang.invoke.MethodType");
571 errorType = enterClass("java.lang.Error");
572 illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
573 interruptedExceptionType = enterClass("java.lang.InterruptedException");
574 exceptionType = enterClass("java.lang.Exception");
575 runtimeExceptionType = enterClass("java.lang.RuntimeException");
576 classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
577 noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
578 noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
579 assertionErrorType = enterClass("java.lang.AssertionError");
580 incompatibleClassChangeErrorType = enterClass("java.lang.IncompatibleClassChangeError");
581 cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
582 matchExceptionType = enterClass("java.lang.MatchException");
583 annotationType = enterClass("java.lang.annotation.Annotation");
611 autoCloseableClose = new MethodSymbol(PUBLIC,
612 names.close,
613 new MethodType(List.nil(), voidType,
614 List.of(exceptionType), methodClass),
615 autoCloseableType.tsym);
616 trustMeType = enterClass("java.lang.SafeVarargs");
617 nativeHeaderType = enterClass("java.lang.annotation.Native");
618 lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
619 stringConcatFactory = enterClass("java.lang.invoke.StringConcatFactory");
620 functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
621 previewFeatureType = enterClass("jdk.internal.javac.PreviewFeature");
622 previewFeatureInternalType = enterSyntheticAnnotation("jdk.internal.PreviewFeature+Annotation");
623 restrictedType = enterClass("jdk.internal.javac.Restricted");
624 restrictedInternalType = enterSyntheticAnnotation("jdk.internal.javac.Restricted+Annotation");
625 typeDescriptorType = enterClass("java.lang.invoke.TypeDescriptor");
626 recordType = enterClass("java.lang.Record");
627 switchBootstrapsType = enterClass("java.lang.runtime.SwitchBootstraps");
628 constantBootstrapsType = enterClass("java.lang.invoke.ConstantBootstraps");
629 valueBasedType = enterClass("jdk.internal.ValueBased");
630 valueBasedInternalType = enterSyntheticAnnotation("jdk.internal.ValueBased+Annotation");
631 strictType = enterSyntheticAnnotation("jdk.internal.vm.annotation.Strict");
632 migratedValueClassType = enterClass("jdk.internal.MigratedValueClass");
633 migratedValueClassInternalType = enterSyntheticAnnotation("jdk.internal.MigratedValueClass+Annotation");
634 classDescType = enterClass("java.lang.constant.ClassDesc");
635 enumDescType = enterClass("java.lang.Enum$EnumDesc");
636 ioType = enterClass("java.io.IO");
637 // For serialization lint checking
638 objectStreamFieldType = enterClass("java.io.ObjectStreamField");
639 objectInputStreamType = enterClass("java.io.ObjectInputStream");
640 objectOutputStreamType = enterClass("java.io.ObjectOutputStream");
641 ioExceptionType = enterClass("java.io.IOException");
642 objectStreamExceptionType = enterClass("java.io.ObjectStreamException");
643 externalizableType = enterClass("java.io.Externalizable");
644 objectInputType = enterClass("java.io.ObjectInput");
645 objectOutputType = enterClass("java.io.ObjectOutput");
646 synthesizeEmptyInterfaceIfMissing(autoCloseableType);
647 synthesizeEmptyInterfaceIfMissing(cloneableType);
648 synthesizeEmptyInterfaceIfMissing(serializableType);
649 synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
650 synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
651 synthesizeEmptyInterfaceIfMissing(stringConcatFactory);
652 synthesizeBoxTypeIfMissing(doubleType);
653 synthesizeBoxTypeIfMissing(floatType);
654 synthesizeBoxTypeIfMissing(voidType);
655
656 numberType = enterClass("java.lang.Number");
657
658 // Enter a synthetic class that is used to mark internal
659 // proprietary classes in ct.sym. This class does not have a
660 // class file.
661 proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
662
663 // Enter a synthetic class that is used to provide profile info for
664 // classes in ct.sym. This class does not have a class file.
665 profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
666 MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
667 profileType.tsym.members().enter(m);
668
669 // Enter a class for arrays.
670 // The class implements java.lang.Cloneable and java.io.Serializable.
671 // It has a final length field and a clone method.
672 ClassType arrayClassType = (ClassType)arrayClass.type;
673 arrayClassType.supertype_field = objectType;
674 arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
675 arrayClass.members_field = WriteableScope.create(arrayClass);
676 lengthVar = new VarSymbol(
677 PUBLIC | FINAL,
|