Beispiel #1
0
 public override void VisitUse(string service)
 {
     CheckVisitEndNotCalled();
     CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, service, "service");
     usedServices.CheckNameNotAlreadyDeclared(service);
     base.VisitUse(service);
 }
Beispiel #2
0
 public override void VisitMainClass(string mainClass)
 {
     // Modules can only appear in V9 or more classes.
     CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, mainClass, "module main class"
                                          );
     base.VisitMainClass(mainClass);
 }
Beispiel #3
0
 public override AnnotationVisitor VisitAnnotation(string descriptor, bool visible
                                                   )
 {
     CheckVisitEndNotCalled();
     // Annotations can only appear in V1_5 or more classes.
     CheckMethodAdapter.CheckDescriptor(OpcodesConstants.V1_5, descriptor, false);
     return(new CheckAnnotationAdapter(base.VisitAnnotation(descriptor, visible)));
 }
 public override void VisitEnum(string name, string descriptor, string value)
 {
     CheckVisitEndNotCalled();
     CheckName(name);
     // Annotations can only appear in V1_5 or more classes.
     CheckMethodAdapter.CheckDescriptor(OpcodesConstants.V1_5, descriptor, false);
     if (value == null)
     {
         throw new ArgumentException("Invalid enum value");
     }
     base.VisitEnum(name, descriptor, value);
 }
Beispiel #5
0
        public override AnnotationVisitor VisitTypeAnnotation(int typeRef, TypePath typePath
                                                              , string descriptor, bool visible)
        {
            CheckVisitEndNotCalled();
            var sort = new TypeReference(typeRef).GetSort();

            if (sort != TypeReference.Field)
            {
                throw new ArgumentException("Invalid type reference sort 0x" + sort.ToString("x8"));
            }
            CheckClassAdapter.CheckTypeRef(typeRef);
            CheckMethodAdapter.CheckDescriptor(OpcodesConstants.V1_5, descriptor, false);
            return(new CheckAnnotationAdapter(base.VisitTypeAnnotation(typeRef, typePath, descriptor
                                                                       , visible)));
        }
Beispiel #6
0
 public override void VisitProvide(string service, params string[] providers)
 {
     CheckVisitEndNotCalled();
     CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, service, "service");
     providedServices.CheckNameNotAlreadyDeclared(service);
     if (providers == null || providers.Length == 0)
     {
         throw new ArgumentException("Providers cannot be null or empty");
     }
     foreach (var provider in providers)
     {
         CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, provider, "provider");
     }
     base.VisitProvide(service, providers);
 }
Beispiel #7
0
 public override void VisitExport(string packaze, AccessFlags access, params string[] modules
                                  )
 {
     CheckVisitEndNotCalled();
     CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, packaze, "package name"
                                          );
     exportedPackages.CheckNameNotAlreadyDeclared(packaze);
     CheckClassAdapter.CheckAccess(access, AccessFlags.Synthetic | AccessFlags
                                   .Mandated);
     if (modules != null)
     {
         foreach (var module in modules)
         {
             CheckClassAdapter.CheckFullyQualifiedName(OpcodesConstants.V9, module, "module export to"
                                                       );
         }
     }
     base.VisitExport(packaze, access, modules);
 }
Beispiel #8
0
 public override void VisitOpen(string packaze, AccessFlags access, params string[] modules
                                )
 {
     CheckVisitEndNotCalled();
     if (isOpen)
     {
         throw new NotSupportedException("An open module can not use open directive");
     }
     CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, packaze, "package name"
                                          );
     openedPackages.CheckNameNotAlreadyDeclared(packaze);
     CheckClassAdapter.CheckAccess(access, AccessFlags.Synthetic | AccessFlags
                                   .Mandated);
     if (modules != null)
     {
         foreach (var module in modules)
         {
             CheckClassAdapter.CheckFullyQualifiedName(OpcodesConstants.V9, module, "module open to"
                                                       );
         }
     }
     base.VisitOpen(packaze, access, modules);
 }
Beispiel #9
0
 public override void VisitPackage(string packaze)
 {
     CheckMethodAdapter.CheckInternalName(OpcodesConstants.V9, packaze, "module package"
                                          );
     base.VisitPackage(packaze);
 }