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


Java SignatureReader.accept方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: checkSignature

import org.objectweb.asm.signature.SignatureReader; //导入方法依赖的package包/类
public void checkSignature() {
    SignatureWriter wrt = new SignatureWriter();
    SignatureReader rdr = new SignatureReader(data.signature);
    switch (data.type) {
    case 'C':
        rdr.accept(new CheckSignatureAdapter(
                CheckSignatureAdapter.CLASS_SIGNATURE, wrt));
        break;
    case 'M':
        rdr.accept(new CheckSignatureAdapter(
                CheckSignatureAdapter.METHOD_SIGNATURE, wrt));
        break;
    case 'F':
        rdr.acceptType(new CheckSignatureAdapter(
                CheckSignatureAdapter.TYPE_SIGNATURE, wrt));
        break;
    default:
        return;
    }
    assertEquals(data.signature, wrt.toString());
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:22,代码来源:CheckSignatureAdapterUnitTest.java

示例11: 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:nxmatic,项目名称:objectweb-asm-4.0,代码行数:23,代码来源:TraceSignatureVisitorUnitTest.java

示例12: checkSignature

import org.objectweb.asm.signature.SignatureReader; //导入方法依赖的package包/类
public void checkSignature() {
    SignatureWriter wrt = new SignatureWriter();
    SignatureReader rdr = new SignatureReader(data.signature);
    switch (data.type) {
        case 'C':
            rdr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.CLASS_SIGNATURE,
                    wrt));
            break;
        case 'M':
            rdr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.METHOD_SIGNATURE,
                    wrt));
            break;
        case 'F':
            rdr.acceptType(new CheckSignatureAdapter(CheckSignatureAdapter.TYPE_SIGNATURE,
                    wrt));
            break;
        default:
            return;
    }
    assertEquals(data.signature, wrt.toString());
}
 
开发者ID:nxmatic,项目名称:objectweb-asm-4.0,代码行数:22,代码来源:CheckSignatureAdapterUnitTest.java

示例13: mapSignature

import org.objectweb.asm.signature.SignatureReader; //导入方法依赖的package包/类
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:24,代码来源:Remapper.java

示例14: stripInterface

import org.objectweb.asm.signature.SignatureReader; //导入方法依赖的package包/类
private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs)
{
    final String ifaceName = interfaceName.replace('.', '/');
    boolean found = classNode.interfaces.remove(ifaceName);
    if (found && classNode.signature != null)
    {
        SignatureReader sr = new SignatureReader(classNode.signature);
        final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName);
        sr.accept(signatureWriter);
        classNode.signature = signatureWriter.toString();
        if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed from type signature");
    }
    if (found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed", interfaceName);
    if (!found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s NOT removed - not found", interfaceName);

    if (found && stripRefs)
    {
        if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method signature references", interfaceName);
        for (Iterator<MethodNode> iterator = classNode.methods.iterator(); iterator.hasNext();)
        {
            MethodNode node = iterator.next();
            if (node.desc.contains(ifaceName))
            {
                if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - stripping method containing reference %s", interfaceName, node.name);
                iterator.remove();
            }
        }
        if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - all method signature references stripped", interfaceName);
    }
    else if (found)
    {
        if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s - NOT stripping method signature references", interfaceName);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:35,代码来源:ModAPITransformer.java

示例15: visit

import org.objectweb.asm.signature.SignatureReader; //导入方法依赖的package包/类
@Override
public void visit(
    int api, int access, String name, String signature, String superClass, String[] interfaces) {
  // log.debug("Name:{}", name);
  // call class
  this.access = access;
  final boolean isInterface = (Opcodes.ACC_INTERFACE & access) == Opcodes.ACC_INTERFACE;
  // log.debug("name {} sig {} IF:{}", name, signature, isInterface);

  if (signature != null) {
    // generics
    // log.debug("name {} sig {}", name, signature);
    final SignatureReader signatureReader = new SignatureReader(signature);
    ClassSignatureVisitor classSignatureVisitor =
        new ClassSignatureVisitor(this.className, isInterface);
    signatureReader.accept(classSignatureVisitor);

    this.classTypeParameters = classSignatureVisitor.getTypeParameters();
    this.classIndex = classSignatureVisitor.getClassIndex();
    if (!this.classIndex.getSupers().contains(ClassNameUtils.OBJECT_CLASS)) {
      this.classIndex.addSuper(ClassNameUtils.OBJECT_CLASS);
    }
  } else {
    this.classTypeParameters = new ArrayList<>(4);
    final List<String> supers = new ArrayList<>(4);
    if (superClass != null) {
      final String superClassFQCN = ClassNameUtils.replaceSlash(superClass);
      supers.add(superClassFQCN);
    }
    Arrays.stream(interfaces)
        .forEach(interfaceName -> supers.add(ClassNameUtils.replaceSlash(interfaceName)));
    this.classIndex = new ClassIndex(this.className, new ArrayList<>(4), supers);
    this.classIndex.setInterface(isInterface);
  }
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:36,代码来源:ClassAnalyzeVisitor.java


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