< prev index next >

src/java.base/share/classes/jdk/internal/classfile/impl/ClassRemapperImpl.java

Print this page

 40 import jdk.internal.classfile.FieldTransform;
 41 import jdk.internal.classfile.Interfaces;
 42 import jdk.internal.classfile.MethodBuilder;
 43 import jdk.internal.classfile.MethodElement;
 44 import jdk.internal.classfile.MethodModel;
 45 import jdk.internal.classfile.MethodSignature;
 46 import jdk.internal.classfile.MethodTransform;
 47 import jdk.internal.classfile.Signature;
 48 import jdk.internal.classfile.Superclass;
 49 import jdk.internal.classfile.TypeAnnotation;
 50 import jdk.internal.classfile.attribute.AnnotationDefaultAttribute;
 51 import jdk.internal.classfile.attribute.EnclosingMethodAttribute;
 52 import jdk.internal.classfile.attribute.ExceptionsAttribute;
 53 import jdk.internal.classfile.attribute.InnerClassInfo;
 54 import jdk.internal.classfile.attribute.InnerClassesAttribute;
 55 import jdk.internal.classfile.attribute.ModuleAttribute;
 56 import jdk.internal.classfile.attribute.ModuleProvideInfo;
 57 import jdk.internal.classfile.attribute.NestHostAttribute;
 58 import jdk.internal.classfile.attribute.NestMembersAttribute;
 59 import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;

 60 import jdk.internal.classfile.attribute.RecordAttribute;
 61 import jdk.internal.classfile.attribute.RecordComponentInfo;
 62 import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
 63 import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
 64 import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
 65 import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
 66 import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
 67 import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
 68 import jdk.internal.classfile.attribute.SignatureAttribute;
 69 import jdk.internal.classfile.components.ClassRemapper;
 70 import jdk.internal.classfile.constantpool.Utf8Entry;
 71 import jdk.internal.classfile.instruction.ConstantInstruction.LoadConstantInstruction;
 72 import jdk.internal.classfile.instruction.ExceptionCatch;
 73 import jdk.internal.classfile.instruction.FieldInstruction;
 74 import jdk.internal.classfile.instruction.InvokeDynamicInstruction;
 75 import jdk.internal.classfile.instruction.InvokeInstruction;
 76 import jdk.internal.classfile.instruction.LocalVariable;
 77 import jdk.internal.classfile.instruction.LocalVariableType;
 78 import jdk.internal.classfile.instruction.NewMultiArrayInstruction;
 79 import jdk.internal.classfile.instruction.NewObjectInstruction;

125                         .map(this::mapRecordComponent).toList()));
126             case ModuleAttribute ma ->
127                 clb.with(ModuleAttribute.of(ma.moduleName(), ma.moduleFlagsMask(),
128                         ma.moduleVersion().orElse(null),
129                         ma.requires(), ma.exports(), ma.opens(),
130                         ma.uses().stream().map(ce ->
131                                 clb.constantPool().classEntry(map(ce.asSymbol()))).toList(),
132                         ma.provides().stream().map(mp ->
133                                 ModuleProvideInfo.of(map(mp.provides().asSymbol()),
134                                         mp.providesWith().stream().map(pw ->
135                                                 map(pw.asSymbol())).toList())).toList()));
136             case NestHostAttribute nha ->
137                 clb.with(NestHostAttribute.of(map(nha.nestHost().asSymbol())));
138             case NestMembersAttribute nma ->
139                 clb.with(NestMembersAttribute.ofSymbols(nma.nestMembers().stream()
140                         .map(nm -> map(nm.asSymbol())).toList()));
141             case PermittedSubclassesAttribute psa ->
142                 clb.with(PermittedSubclassesAttribute.ofSymbols(
143                         psa.permittedSubclasses().stream().map(ps ->
144                                 map(ps.asSymbol())).toList()));




145             case RuntimeVisibleAnnotationsAttribute aa ->
146                 clb.with(RuntimeVisibleAnnotationsAttribute.of(
147                         mapAnnotations(aa.annotations())));
148             case RuntimeInvisibleAnnotationsAttribute aa ->
149                 clb.with(RuntimeInvisibleAnnotationsAttribute.of(
150                         mapAnnotations(aa.annotations())));
151             case RuntimeVisibleTypeAnnotationsAttribute aa ->
152                 clb.with(RuntimeVisibleTypeAnnotationsAttribute.of(
153                         mapTypeAnnotations(aa.annotations())));
154             case RuntimeInvisibleTypeAnnotationsAttribute aa ->
155                 clb.with(RuntimeInvisibleTypeAnnotationsAttribute.of(
156                         mapTypeAnnotations(aa.annotations())));
157             default ->
158                 clb.with(cle);
159         }
160     }
161 
162     @Override
163     public FieldTransform asFieldTransform() {
164         return (FieldBuilder fb, FieldElement fe) -> {

 40 import jdk.internal.classfile.FieldTransform;
 41 import jdk.internal.classfile.Interfaces;
 42 import jdk.internal.classfile.MethodBuilder;
 43 import jdk.internal.classfile.MethodElement;
 44 import jdk.internal.classfile.MethodModel;
 45 import jdk.internal.classfile.MethodSignature;
 46 import jdk.internal.classfile.MethodTransform;
 47 import jdk.internal.classfile.Signature;
 48 import jdk.internal.classfile.Superclass;
 49 import jdk.internal.classfile.TypeAnnotation;
 50 import jdk.internal.classfile.attribute.AnnotationDefaultAttribute;
 51 import jdk.internal.classfile.attribute.EnclosingMethodAttribute;
 52 import jdk.internal.classfile.attribute.ExceptionsAttribute;
 53 import jdk.internal.classfile.attribute.InnerClassInfo;
 54 import jdk.internal.classfile.attribute.InnerClassesAttribute;
 55 import jdk.internal.classfile.attribute.ModuleAttribute;
 56 import jdk.internal.classfile.attribute.ModuleProvideInfo;
 57 import jdk.internal.classfile.attribute.NestHostAttribute;
 58 import jdk.internal.classfile.attribute.NestMembersAttribute;
 59 import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;
 60 import jdk.internal.classfile.attribute.PreloadAttribute;
 61 import jdk.internal.classfile.attribute.RecordAttribute;
 62 import jdk.internal.classfile.attribute.RecordComponentInfo;
 63 import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
 64 import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
 65 import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
 66 import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
 67 import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
 68 import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
 69 import jdk.internal.classfile.attribute.SignatureAttribute;
 70 import jdk.internal.classfile.components.ClassRemapper;
 71 import jdk.internal.classfile.constantpool.Utf8Entry;
 72 import jdk.internal.classfile.instruction.ConstantInstruction.LoadConstantInstruction;
 73 import jdk.internal.classfile.instruction.ExceptionCatch;
 74 import jdk.internal.classfile.instruction.FieldInstruction;
 75 import jdk.internal.classfile.instruction.InvokeDynamicInstruction;
 76 import jdk.internal.classfile.instruction.InvokeInstruction;
 77 import jdk.internal.classfile.instruction.LocalVariable;
 78 import jdk.internal.classfile.instruction.LocalVariableType;
 79 import jdk.internal.classfile.instruction.NewMultiArrayInstruction;
 80 import jdk.internal.classfile.instruction.NewObjectInstruction;

126                         .map(this::mapRecordComponent).toList()));
127             case ModuleAttribute ma ->
128                 clb.with(ModuleAttribute.of(ma.moduleName(), ma.moduleFlagsMask(),
129                         ma.moduleVersion().orElse(null),
130                         ma.requires(), ma.exports(), ma.opens(),
131                         ma.uses().stream().map(ce ->
132                                 clb.constantPool().classEntry(map(ce.asSymbol()))).toList(),
133                         ma.provides().stream().map(mp ->
134                                 ModuleProvideInfo.of(map(mp.provides().asSymbol()),
135                                         mp.providesWith().stream().map(pw ->
136                                                 map(pw.asSymbol())).toList())).toList()));
137             case NestHostAttribute nha ->
138                 clb.with(NestHostAttribute.of(map(nha.nestHost().asSymbol())));
139             case NestMembersAttribute nma ->
140                 clb.with(NestMembersAttribute.ofSymbols(nma.nestMembers().stream()
141                         .map(nm -> map(nm.asSymbol())).toList()));
142             case PermittedSubclassesAttribute psa ->
143                 clb.with(PermittedSubclassesAttribute.ofSymbols(
144                         psa.permittedSubclasses().stream().map(ps ->
145                                 map(ps.asSymbol())).toList()));
146             case PreloadAttribute pa ->
147                 clb.with(PreloadAttribute.ofSymbols(
148                         pa.preloads().stream().map(pc ->
149                                 map(pc.asSymbol())).toList()));
150             case RuntimeVisibleAnnotationsAttribute aa ->
151                 clb.with(RuntimeVisibleAnnotationsAttribute.of(
152                         mapAnnotations(aa.annotations())));
153             case RuntimeInvisibleAnnotationsAttribute aa ->
154                 clb.with(RuntimeInvisibleAnnotationsAttribute.of(
155                         mapAnnotations(aa.annotations())));
156             case RuntimeVisibleTypeAnnotationsAttribute aa ->
157                 clb.with(RuntimeVisibleTypeAnnotationsAttribute.of(
158                         mapTypeAnnotations(aa.annotations())));
159             case RuntimeInvisibleTypeAnnotationsAttribute aa ->
160                 clb.with(RuntimeInvisibleTypeAnnotationsAttribute.of(
161                         mapTypeAnnotations(aa.annotations())));
162             default ->
163                 clb.with(cle);
164         }
165     }
166 
167     @Override
168     public FieldTransform asFieldTransform() {
169         return (FieldBuilder fb, FieldElement fe) -> {
< prev index next >