View Javadoc

1   /*
2    * Copyright 2003-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.tonicsystems.jarjar;
17  
18  import org.objectweb.asm.AnnotationVisitor;
19  import org.objectweb.asm.ClassVisitor;
20  import org.objectweb.asm.FieldVisitor;
21  import org.objectweb.asm.MethodVisitor;
22  import org.objectweb.asm.Opcodes;
23  
24  /**
25   * An ASM3 EmptyVisitor replacement
26   * @author <a href="mailto:blackdrag@gmx.org">Jochen "blackdrag" Theodorou</a>
27   */
28  public class EmptyClassVisitor extends ClassVisitor {
29  
30      public EmptyClassVisitor() {
31          super(Opcodes.ASM4);
32      }
33      
34      @Override
35      public MethodVisitor visitMethod(int access, String name, String desc,
36              String signature, String[] exceptions) {
37          return new MethodVisitor(Opcodes.ASM4) {};
38      }
39      
40      @Override
41      public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
42          return new AnnotationVisitor(Opcodes.ASM4) {};
43      }
44      
45      @Override
46      public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
47          return new FieldVisitor(Opcodes.ASM4) {};
48      }
49  
50  }