当前位置: 首页>>代码示例>>Java>>正文


Java SignatureReader类代码示例

本文整理汇总了Java中org.objectweb.asm.signature.SignatureReader的典型用法代码示例。如果您正苦于以下问题:Java SignatureReader类的具体用法?Java SignatureReader怎么用?Java SignatureReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SignatureReader类属于org.objectweb.asm.signature包,在下文中一共展示了SignatureReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitLocalVariable

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
@Override
public void visitLocalVariable(final String name, final String desc,
        final String signature, final Label start, final Label end,
        final int index) {
    buf.setLength(0);
    buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' ');
    appendDescriptor(FIELD_DESCRIPTOR, desc);
    buf.append(' ');
    appendLabel(start);
    buf.append(' ');
    appendLabel(end);
    buf.append(' ').append(index).append('\n');

    if (signature != null) {
        buf.append(tab2);
        appendDescriptor(FIELD_SIGNATURE, signature);

        TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
        SignatureReader r = new SignatureReader(signature);
        r.acceptType(sv);
        buf.append(tab2).append("// declaration: ")
                .append(sv.getDeclaration()).append('\n');
    }
    text.add(buf.toString());
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:26,代码来源:Textifier.java

示例2: visit

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
    Class<? extends ClassFileDescriptor> javaType = getJavaType(access);
    String fullQualifiedName = SignatureHelper.getObjectType(name);
    cachedType = visitorHelper.createType(fullQualifiedName, fileDescriptor, javaType);
    dependentTypeSignatureVisitor = new DependentTypeSignatureVisitor(cachedType, visitorHelper);
    ClassFileDescriptor classFileDescriptor = cachedType.getTypeDescriptor();
    classFileDescriptor.setByteCodeVersion(version);
    if (hasFlag(access, Opcodes.ACC_ABSTRACT) && !hasFlag(access, Opcodes.ACC_INTERFACE)) {
        classFileDescriptor.setAbstract(Boolean.TRUE);
    }
    setModifiers(access, classFileDescriptor);
    if (signature == null) {
        if (superName != null) {
            TypeDescriptor superClassType = visitorHelper.resolveType(SignatureHelper.getObjectType(superName), cachedType).getTypeDescriptor();
            classFileDescriptor.setSuperClass(superClassType);
        }
        for (int i = 0; interfaces != null && i < interfaces.length; i++) {
            TypeDescriptor interfaceType = visitorHelper.resolveType(SignatureHelper.getObjectType(interfaces[i]), cachedType).getTypeDescriptor();
            classFileDescriptor.getInterfaces().add(interfaceType);
        }
    } else {
        new SignatureReader(signature).accept(new ClassSignatureVisitor(cachedType, visitorHelper, dependentTypeSignatureVisitor));
    }
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:26,代码来源:ClassVisitor.java

示例3: parseSignature

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
FieldAnalyzeVisitor parseSignature() {
  final EntryMessage m = log.traceEntry("fieldSignature={}", fieldSignature);
  boolean isStatic = (Opcodes.ACC_STATIC & this.access) > 0;
  SignatureReader signatureReader = new SignatureReader(this.fieldSignature);
  FieldSignatureVisitor visitor;
  if (isStatic) {
    visitor = new FieldSignatureVisitor(this.name, new ArrayList<>(4));
  } else {
    visitor = new FieldSignatureVisitor(this.name, this.classAnalyzeVisitor.classTypeParameters);
  }
  if (this.typeMap != null) {
    visitor.setTypeMap(this.typeMap);
  }

  this.fieldSignatureVisitor = visitor;
  signatureReader.acceptType(fieldSignatureVisitor);
  return log.traceExit(m, this);
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:19,代码来源:FieldAnalyzeVisitor.java

示例4: parseSignature

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
MethodAnalyzeVisitor parseSignature() {
  final EntryMessage entryMessage =
      log.traceEntry("name={} methodSignature={}", this.name, this.methodSignature);
  final boolean isStatic = (Opcodes.ACC_STATIC & this.access) > 0;
  final SignatureReader signatureReader = new SignatureReader(this.methodSignature);
  MethodSignatureVisitor visitor;
  if (isStatic) {
    visitor = new MethodSignatureVisitor(this.name, new ArrayList<>(4));
  } else {
    visitor = new MethodSignatureVisitor(this.name, this.classAnalyzeVisitor.classTypeParameters);
  }
  if (this.typeMap != null) {
    visitor.setTypeMap(this.typeMap);
  }

  signatureReader.accept(visitor);

  this.formalType = visitor.getFormalType();
  this.parameterTypes = visitor.getParameterTypes();
  this.typeParameters = visitor.getTypeParameters();
  this.returnType = visitor.getReturnType();
  log.traceExit(entryMessage);
  return this;
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:25,代码来源:MethodAnalyzeVisitor.java

示例5: visitMethod

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
@Override
public MethodVisitor visitMethod(
    int access, String name, String desc, String signature, String[] exceptions) {

  String target = signature;
  if (target == null) {
    target = desc;
  }
  SignatureReader signatureReader = new SignatureReader(target);
  this.visitor = new MethodSignatureVisitor(name, new ArrayList<>());
  signatureReader.accept(this.visitor);

  System.out.println(name);
  System.out.println(this.visitor.getFormalType());
  System.out.println(this.visitor.getParameterTypes());
  System.out.println(this.visitor.getTypeParameters());
  System.out.println(this.visitor.getReturnType());

  // result.put(name, this.visitor.getFormalType());

  return super.visitMethod(access, name, desc, signature, exceptions);
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:23,代码来源:MethodSignatureVisitorTest.java

示例6: visitField

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    if ("$VALUES".equals(name) && classStack.peek().isEnum()) {
        return null;
    }

    String signatureDesc = signature != null ? signature : desc;
    SignatureReader r = new SignatureReader(signatureDesc);
    CustomTraceSignatureVisitor sv = new CustomTraceSignatureVisitor(Opcodes.ACC_PUBLIC);
    r.accept(sv);

    FieldInfo field = FieldInfo.fieldInfo()
        .name(name)
        .modifiers(access)
        .type(sv.getTypeOrSuperclass())
        .value(value)
        .build();
    classStack.peek().addToFields(field);
    return new FieldProcessor(field);
}
 
开发者ID:aalmiray,项目名称:naum,代码行数:21,代码来源:ClassProcessor.java

示例7: parseSignature

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
private void parseSignature(MethodNode method) {
	if (method.signature == null) {
		return;
	}
	SignatureVisitor visitor = new SignatureVisitor(0, method.visibleParameterAnnotations, method.invisibleParameterAnnotations);
	visitor.setLocalVariableNodes(method.localVariables);
	visitor.setStatic(Util.containsFlag(method.access, Opcodes.ACC_STATIC));
	SignatureReader signatureReader = new SignatureReader(method.signature);
	signatureReader.accept(visitor);

	mGenericExceptions = visitor.getExceptions();
	mArguments.putAll(visitor.getArguments());

	mGenericReturnType = visitor.getReturnType();

	if (visitor.getDeclaration() != null) {
		mGenericArgs = visitor.getDeclaration();
		if (mGenericArgs.indexOf("<") == 0) {
			int gtPosition = mGenericArgs.indexOf(">") + 1;
			mGenericReturnType = mGenericArgs.substring(0, gtPosition) + " " + mGenericReturnType;
			mGenericArgs = mGenericArgs.substring(gtPosition);
		}
	}
}
 
开发者ID:JozefCeluch,项目名称:thesis-disassembler,代码行数:25,代码来源:MethodBlock.java

示例8: MethodInvocationExpression

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
public MethodInvocationExpression(int opCode, String name, String desc, String owner, String callingMethod) {
	super(opCode);
	mName = name;
	SignatureVisitor v = new SignatureVisitor(0, null, null);
	SignatureReader r = new SignatureReader(desc);
	r.accept(v);
	mType = DataType.getTypeFromObject(v.getReturnType());
	mArgTypes = new ArrayList<>();
	for (Type argType: Type.getArgumentTypes(desc)) {
		mArgTypes.add(DataType.getType(argType));
	}
	mArgumentCount = v.getArguments().size();
	mArguments = new ArrayList<>();
	mOwnerClass = DataType.getType(Type.getObjectType(owner));
	mCallingMethod = callingMethod;
}
 
开发者ID:JozefCeluch,项目名称:thesis-disassembler,代码行数:17,代码来源:MethodInvocationExpression.java

示例9: resolve

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
/**
 * Resolve the given type variable in the base class, as it is parameterized
 * by the childClass
 */
public String resolve(ClassNode child, String baseClass, String typeVariable) {
    ArrayList<String> parameterValues = new ArrayList<>();

    while (true) {
        // System.out.println(child.signature);
        // new SignatureReader(child.signature)
        // .accept(new PrintingSignatureVisitor(""));

        SignatureVisitorImpl visitor = new SignatureVisitorImpl(parameterValues);
        if (child.signature != null) {
            new SignatureReader(child.signature).accept(visitor);
            parameterValues = visitor.parameterValuesOut;
        }

        if (child.name.equals(baseClass)) {
            return visitor.parameterMap.get(typeVariable);
        }
        if (child.superName == null)
            break;
        child = getNode(child.superName);
    }
    return null;
}
 
开发者ID:ruediste,项目名称:rise,代码行数:28,代码来源:ClassHierarchyIndex.java

示例10: visitLocalVariable

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
/**
 * @see org.objectweb.asm.MethodVisitor#visitLocalVariable(String, String, String, Label, Label, int)
 */
public void visitLocalVariable(String name, String descriptor, String signature, Label start, Label end,
   int index)
{
   Type type = Type.getType(descriptor);

   if (type != null)
   {
      inspectType(type);
   }

   if (signature != null)
   {
      new SignatureReader(signature).acceptType(new SignatureInspector());
   }
}
 
开发者ID:dheraclio,项目名称:dependometer,代码行数:19,代码来源:ClassFileParser.java

示例11: visitField

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    if (isSynthetic(access))
        return null;
    VariableJson f = new VariableJson();
    f.setName(name);
    f.setType(new TypeJson(Type.getType(desc).getClassName()));
    f.setAccess(access);
    if (signature != null) {
        SignatureReader sr = new SignatureReader(signature);
        TypeSignatureNode sn = new TypeSignatureNode();
        sr.acceptType(sn);
        TypeJson type = new TypeJson();
        sn.accept(type);
        f.setType(type);
    }
    addField(f);
    return new FieldJsonVisitor(f);
}
 
开发者ID:killjoy1221,项目名称:Class2Json,代码行数:20,代码来源:ClassJsonVisitor.java

示例12: test

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
public void test() throws Exception {
    if (line.length() > 2) {
        String signature = line.substring(2);
        SignatureWriter wrt = new SignatureWriter();
        SignatureReader rdr = new SignatureReader(signature);
        switch (line.charAt(0)) {
            case 'C':
            case 'M':
                rdr.accept(wrt);
                break;
            case 'T':
                rdr.acceptType(wrt);
                break;
            default:
                return;
        }
        assertEquals(signature, wrt.toString());
    }
}
 
开发者ID:typetools,项目名称:annotation-tools,代码行数:20,代码来源:SignatureTest.java

示例13: testSignature

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
public void testSignature() {
    TraceSignatureVisitor d = new TraceSignatureVisitor(data.access);
    SignatureReader r = new SignatureReader(data.signature);

    switch (data.type) {
        case 'C':
            r.accept(d);
            assertEquals(data.declaration, d.getDeclaration());
            break;
        case 'F':
            r.acceptType(d);
            assertEquals(data.declaration, d.getDeclaration());
            break;
        case 'M':
            r.accept(d);
            String fullMethodDeclaration = d.getReturnType()
                    + d.getDeclaration()
                    + (d.getExceptions() != null ? d.getExceptions() : "");
            assertEquals(data.declaration, fullMethodDeclaration);
            break;
    }

}
 
开发者ID:typetools,项目名称:annotation-tools,代码行数:24,代码来源:TraceSignatureVisitorTest.java

示例14: translateSignature

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
private String translateSignature(final String signature, boolean type) {
	if (signature == null) {
		return null;
	}
	SignatureReader r = new SignatureReader(signature);
	SignatureWriter w = new SignatureWriter() {
	    public void visitClassType(final String name) {
	    	String n = translator.getClassMirrorTranslation(name);
	    	super.visitClassType(n);
	    }
	};

	if (type) {
		r.acceptType(w);		
	} else {
		r.accept(w);		
	}
	return w.toString();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:NameTranslatorClassVisitor.java

示例15: testSignature

import org.objectweb.asm.signature.SignatureReader; //导入依赖的package包/类
public void testSignature() {
    TraceSignatureVisitor d = new TraceSignatureVisitor(data.access);
    SignatureReader r = new SignatureReader(data.signature);

    switch (data.type) {
    case 'C':
        r.accept(d);
        assertEquals(data.declaration, d.getDeclaration());
        break;
    case 'F':
        r.acceptType(d);
        assertEquals(data.declaration, d.getDeclaration());
        break;
    case 'M':
        r.accept(d);
        String fullMethodDeclaration = d.getReturnType()
                + d.getDeclaration()
                + (d.getExceptions() != null ? d.getExceptions() : "");
        assertEquals(data.declaration, fullMethodDeclaration);
        break;
    }
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:23,代码来源:TraceSignatureVisitorUnitTest.java


注:本文中的org.objectweb.asm.signature.SignatureReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。