Package org.objectweb.asm

Examples of org.objectweb.asm.ClassVisitor


    public void cacheClosure(BaseBodyCompiler method, String closureMethod, int arity, StaticScope scope, boolean hasMultipleArgsHead, NodeType argsNodeId, ASTInspector inspector) {
        String closureFieldName = scriptCompiler.getNewConstant(ci(BlockBody.class), "closure");

        String closureMethodName = "getClosure_" + closureFieldName;

        ClassVisitor cv = scriptCompiler.getClassVisitor();

        {
            SkinnyMethodAdapter closureGetter = new SkinnyMethodAdapter(
                    cv.visitMethod(Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, closureMethodName,
                            sig(BlockBody.class, ThreadContext.class), null, null));

            closureGetter.aload(0);
            closureGetter.getfield(scriptCompiler.getClassname(), closureFieldName, ci(BlockBody.class));
            closureGetter.dup();
View Full Code Here


    public void cacheClosureOld(BaseBodyCompiler method, String closureMethod) {
        String closureFieldName = scriptCompiler.getNewConstant(ci(CompiledBlockCallback.class), "closure");

        String closureMethodName = "getClosure_" + closureFieldName;

        ClassVisitor cv = scriptCompiler.getClassVisitor();

        {
            SkinnyMethodAdapter closureGetter = new SkinnyMethodAdapter(
                    cv.visitMethod(Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, closureMethodName,
                            sig(CompiledBlockCallback.class, Ruby.class), null, null));

            closureGetter.aload(0);
            closureGetter.getfield(scriptCompiler.getClassname(), closureFieldName, ci(CompiledBlockCallback.class));
            closureGetter.dup();
View Full Code Here

      for (ClassContractHandle h : helpers) {
        MethodNode methodNode = h.getContractMethod();
        DebugUtils.info("instrument", "helper method "
                        + className + "." + methodNode.name
                        + methodNode.desc);
        ClassVisitor visitor = cv;
        List<Long> lineNumbers = h.getLineNumbers();
        if (lineNumbers != null) {
          visitor = new LineNumberingClassAdapter(visitor, lineNumbers);
        }
        methodNode.accept(new ContractFixingClassAdapter(visitor));
View Full Code Here

    /**
     *
     */
    private void detectAnnotations() {
        this.classReader.accept(new ClassVisitor() {

            public void visitSource(String arg0, String arg1) {
                // TODO Auto-generated method stub

            }
View Full Code Here

        ClassReader cr = new ClassReader(sourceStream);
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);

        try {
          // chain class visitors
          ClassVisitor classVisitor = cw;
          ConstantPool cp;
            if (COMPACT_CONSTANTS) {
                cp = new ConstantPool();
                classVisitor = new ClassConstantsCollector(classVisitor, cp);
            }
View Full Code Here

                translator = new NameTranslatorClassVisitor(ccc);
            } else {
              translator = new NameTranslatorClassVisitor(cw);
            }
            ClassWeaver classWeaver = new ClassWeaver(translator, lazy, stripAttributes, target, listener);
            ClassVisitor v;
            if (stripSignatures) {
                v = new SignatureStripper(classWeaver);
            } else {
              v = classWeaver;
            }
View Full Code Here

    //maxs are fine (and faster)
    ClassWriter cWriter = new OSGiFriendlyClassWriter(cReader, AbstractWovenProxyAdapter.IS_AT_LEAST_JAVA_6 ?
            ClassWriter.COMPUTE_FRAMES : ClassWriter.COMPUTE_MAXS, loader);
   
    //Wrap our outer layer to add the original SerialVersionUID if it was previously being defaulted
    ClassVisitor weavingAdapter = new SyntheticSerialVerUIDAdder(
                               new WovenProxyAdapter(cWriter, className, loader));
   
    // If we are Java 1.6 + then we need to skip frames as they will be recomputed
    cReader.accept(weavingAdapter, AbstractWovenProxyAdapter.IS_AT_LEAST_JAVA_6 ? ClassReader.SKIP_FRAMES : 0);
   
View Full Code Here

  public static void main (final String args[]) throws Exception {
    // loads the original class and adapts it
    ClassReader cr = new ClassReader("CommentAttribute");
    ClassWriter cw = new ClassWriter(false);
    ClassVisitor cv = new AddCommentClassAdapter(cw);
    cr.accept(cv, new Attribute[] { new CommentAttribute("") }, false);
    byte[] b = cw.toByteArray();

    // stores the adapted class on disk
    FileOutputStream fos = new FileOutputStream("CommentAttribute.class.new");
View Full Code Here

    // adapts the class on the fly
    try {
      ClassReader cr = new ClassReader(is);
      ClassWriter cw = new ClassWriter(false);
      ClassVisitor cv = new TraceFieldClassAdapter(cw);
      cr.accept(cv, false);
      b = cw.toByteArray();
    } catch (Exception e) {
      throw new ClassNotFoundException(name, e);
    }
View Full Code Here

            reader = Global.getAnalysisCache().getClassAnalysis(FBClassReader.class, classDescriptor);
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Error finding self method calls for " + classDescriptor, e);
            return map;
        }
        reader.accept(new ClassVisitor(FindBugsASM.ASM_VERSION) {

            @Override
            public MethodVisitor visitMethod(final int access, final String name, final String desc, String signature,
                    String[] exceptions) {
                return new MethodVisitor(FindBugsASM.ASM_VERSION) {
View Full Code Here

TOP

Related Classes of org.objectweb.asm.ClassVisitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.