equal
deleted
inserted
replaced
26 package java.lang.reflect; |
26 package java.lang.reflect; |
27 |
27 |
28 import java.lang.annotation.*; |
28 import java.lang.annotation.*; |
29 import java.util.Map; |
29 import java.util.Map; |
30 import java.util.Objects; |
30 import java.util.Objects; |
|
31 |
|
32 import jdk.internal.misc.SharedSecrets; |
31 import sun.reflect.annotation.AnnotationParser; |
33 import sun.reflect.annotation.AnnotationParser; |
32 import sun.reflect.annotation.AnnotationSupport; |
34 import sun.reflect.annotation.AnnotationSupport; |
33 import sun.reflect.annotation.TypeAnnotationParser; |
35 import sun.reflect.annotation.TypeAnnotationParser; |
34 import sun.reflect.annotation.TypeAnnotation; |
36 import sun.reflect.annotation.TypeAnnotation; |
35 import sun.reflect.generics.repository.ConstructorRepository; |
37 import sun.reflect.generics.repository.ConstructorRepository; |
77 } |
79 } |
78 |
80 |
79 Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) { |
81 Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) { |
80 return AnnotationParser.parseParameterAnnotations( |
82 return AnnotationParser.parseParameterAnnotations( |
81 parameterAnnotations, |
83 parameterAnnotations, |
82 sun.misc.SharedSecrets.getJavaLangAccess(). |
84 SharedSecrets.getJavaLangAccess(). |
83 getConstantPool(getDeclaringClass()), |
85 getConstantPool(getDeclaringClass()), |
84 getDeclaringClass()); |
86 getDeclaringClass()); |
85 } |
87 } |
86 |
88 |
87 void separateWithCommas(Class<?>[] types, StringBuilder sb) { |
89 void separateWithCommas(Class<?>[] types, StringBuilder sb) { |
599 if (root != null) { |
601 if (root != null) { |
600 declAnnos = root.declaredAnnotations(); |
602 declAnnos = root.declaredAnnotations(); |
601 } else { |
603 } else { |
602 declAnnos = AnnotationParser.parseAnnotations( |
604 declAnnos = AnnotationParser.parseAnnotations( |
603 getAnnotationBytes(), |
605 getAnnotationBytes(), |
604 sun.misc.SharedSecrets.getJavaLangAccess(). |
606 SharedSecrets.getJavaLangAccess(). |
605 getConstantPool(getDeclaringClass()), |
607 getConstantPool(getDeclaringClass()), |
606 getDeclaringClass() |
608 getDeclaringClass() |
607 ); |
609 ); |
608 } |
610 } |
609 declaredAnnotations = declAnnos; |
611 declaredAnnotations = declAnnos; |
636 * specify the return type of the method/constructor represented by this |
638 * specify the return type of the method/constructor represented by this |
637 * Executable. |
639 * Executable. |
638 */ |
640 */ |
639 AnnotatedType getAnnotatedReturnType0(Type returnType) { |
641 AnnotatedType getAnnotatedReturnType0(Type returnType) { |
640 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(), |
642 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(), |
641 sun.misc.SharedSecrets.getJavaLangAccess(). |
643 SharedSecrets.getJavaLangAccess(). |
642 getConstantPool(getDeclaringClass()), |
644 getConstantPool(getDeclaringClass()), |
643 this, |
645 this, |
644 getDeclaringClass(), |
646 getDeclaringClass(), |
645 returnType, |
647 returnType, |
646 TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN); |
648 TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN); |
670 */ |
672 */ |
671 public AnnotatedType getAnnotatedReceiverType() { |
673 public AnnotatedType getAnnotatedReceiverType() { |
672 if (Modifier.isStatic(this.getModifiers())) |
674 if (Modifier.isStatic(this.getModifiers())) |
673 return null; |
675 return null; |
674 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(), |
676 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(), |
675 sun.misc.SharedSecrets.getJavaLangAccess(). |
677 SharedSecrets.getJavaLangAccess(). |
676 getConstantPool(getDeclaringClass()), |
678 getConstantPool(getDeclaringClass()), |
677 this, |
679 this, |
678 getDeclaringClass(), |
680 getDeclaringClass(), |
679 getDeclaringClass(), |
681 getDeclaringClass(), |
680 TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER); |
682 TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER); |
694 * formal parameters of the method or constructor represented by this |
696 * formal parameters of the method or constructor represented by this |
695 * {@code Executable} |
697 * {@code Executable} |
696 */ |
698 */ |
697 public AnnotatedType[] getAnnotatedParameterTypes() { |
699 public AnnotatedType[] getAnnotatedParameterTypes() { |
698 return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(), |
700 return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(), |
699 sun.misc.SharedSecrets.getJavaLangAccess(). |
701 SharedSecrets.getJavaLangAccess(). |
700 getConstantPool(getDeclaringClass()), |
702 getConstantPool(getDeclaringClass()), |
701 this, |
703 this, |
702 getDeclaringClass(), |
704 getDeclaringClass(), |
703 getAllGenericParameterTypes(), |
705 getAllGenericParameterTypes(), |
704 TypeAnnotation.TypeAnnotationTarget.METHOD_FORMAL_PARAMETER); |
706 TypeAnnotation.TypeAnnotationTarget.METHOD_FORMAL_PARAMETER); |
718 * exceptions of the method or constructor represented by this {@code |
720 * exceptions of the method or constructor represented by this {@code |
719 * Executable} |
721 * Executable} |
720 */ |
722 */ |
721 public AnnotatedType[] getAnnotatedExceptionTypes() { |
723 public AnnotatedType[] getAnnotatedExceptionTypes() { |
722 return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(), |
724 return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(), |
723 sun.misc.SharedSecrets.getJavaLangAccess(). |
725 SharedSecrets.getJavaLangAccess(). |
724 getConstantPool(getDeclaringClass()), |
726 getConstantPool(getDeclaringClass()), |
725 this, |
727 this, |
726 getDeclaringClass(), |
728 getDeclaringClass(), |
727 getGenericExceptionTypes(), |
729 getGenericExceptionTypes(), |
728 TypeAnnotation.TypeAnnotationTarget.THROWS); |
730 TypeAnnotation.TypeAnnotationTarget.THROWS); |