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


Java SignatureWriter.toString方法代码示例

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


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

示例1: translateSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的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

示例2: valueSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
 * This method assumes that return type of the method is
 * <code>com.google.code.jconts.Computation&lt;T&gt;</code>. It extracts the type
 * argument <code>T</code> and returns it signature.
 */
private String valueSignature() {
	final SignatureWriter sign = new SignatureWriter();
	SignatureAdapter adaptor = new SignatureAdapter() {
		public SignatureVisitor visitReturnType() {
			return new SignatureAdapter() {
				@Override
				public SignatureVisitor visitTypeArgument(char wildcard) {
					return sign;
				}

				// FIXME: All other are error!
			};
		};
	};
	new SignatureReader(signature).accept(adaptor);
	return sign.toString();
}
 
开发者ID:idubrov,项目名称:jconts,代码行数:23,代码来源:MethodContext.java

示例3: ContinuationClassGenerator

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
public ContinuationClassGenerator(MethodContext info) {
	this.info = info;
	this.stateDesc = info.stateType.getDescriptor();

	SignatureWriter sign = new SignatureWriter();

	// Name<T> implements Continuation<T>
	sign.visitFormalTypeParameter("T");
	SignatureVisitor v = sign.visitClassBound();
	v.visitClassType(OBJECT_NAME);
	v.visitEnd();
	v = sign.visitSuperclass();
	v.visitClassType(OBJECT_NAME);
	v.visitEnd();
	v = sign.visitInterface();
	v.visitClassType(CONTINUATION_NAME);
	v.visitTypeArgument('=').visitTypeVariable("T");
	v.visitEnd();
	this.signature = sign.toString();
}
 
开发者ID:idubrov,项目名称:jconts,代码行数:21,代码来源:ContinuationClassGenerator.java

示例4: mapSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的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

示例5: mapSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
public String mapSignature(String signature, boolean isType, int api) {
    if (signature != null) {
        SignatureReader reader = new SignatureReader(signature);
        final SignatureWriter writer = new SignatureWriter();
        SignatureVisitor visitor = new BookSignatureVisitor(api, writer, this);
        if (isType) {
            reader.acceptType(visitor);
        } else {
            reader.accept(visitor);
        }
        return writer.toString();
    }
    return null;
}
 
开发者ID:PaperModLoader,项目名称:Book,代码行数:15,代码来源:Mappings.java

示例6: mapSignature

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

示例7: getGenericSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
@Override
public String getGenericSignature() {
    try {
        SignatureWriter signatureWriter = new SignatureWriter();
        boolean generic = false;
        for (TypeDescription.Generic typeVariable : getTypeVariables()) {
            signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
            boolean classBound = true;
            for (TypeDescription.Generic upperBound : typeVariable.getUpperBounds()) {
                upperBound.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(classBound
                        ? signatureWriter.visitClassBound()
                        : signatureWriter.visitInterfaceBound()));
                classBound = false;
            }
            generic = true;
        }
        for (TypeDescription.Generic parameterType : getParameters().asTypeList()) {
            parameterType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitParameterType()));
            generic = generic || !parameterType.getSort().isNonGeneric();
        }
        TypeDescription.Generic returnType = getReturnType();
        returnType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitReturnType()));
        generic = generic || !returnType.getSort().isNonGeneric();
        TypeList.Generic exceptionTypes = getExceptionTypes();
        if (!exceptionTypes.filter(not(ofSort(TypeDefinition.Sort.NON_GENERIC))).isEmpty()) {
            for (TypeDescription.Generic exceptionType : exceptionTypes) {
                exceptionType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitExceptionType()));
                generic = generic || !exceptionType.getSort().isNonGeneric();
            }
        }
        return generic
                ? signatureWriter.toString()
                : NON_GENERIC_SIGNATURE;
    } catch (GenericSignatureFormatError ignored) {
        return NON_GENERIC_SIGNATURE;
    }
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:38,代码来源:MethodDescription.java

示例8: getGenericSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
@Override
public String getGenericSignature() {
    try {
        SignatureWriter signatureWriter = new SignatureWriter();
        boolean generic = false;
        for (Generic typeVariable : getTypeVariables()) {
            signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
            for (Generic upperBound : typeVariable.getUpperBounds()) {
                upperBound.accept(new Generic.Visitor.ForSignatureVisitor(upperBound.asErasure().isInterface()
                        ? signatureWriter.visitInterfaceBound()
                        : signatureWriter.visitClassBound()));
            }
            generic = true;
        }
        Generic superClass = getSuperClass();
        // The object type itself is non generic and implicitly returns a non-generic signature
        if (superClass == null) {
            superClass = TypeDescription.Generic.OBJECT;
        }
        superClass.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitSuperclass()));
        generic = generic || !superClass.getSort().isNonGeneric();
        for (Generic interfaceType : getInterfaces()) {
            interfaceType.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitInterface()));
            generic = generic || !interfaceType.getSort().isNonGeneric();
        }
        return generic
                ? signatureWriter.toString()
                : NON_GENERIC_SIGNATURE;
    } catch (GenericSignatureFormatError ignored) {
        return NON_GENERIC_SIGNATURE;
    }
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:33,代码来源:TypeDescription.java

示例9: fixupSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String fixupSignature(@PropagatesNullable String signature) {
  if (signature == null || compatibilityMode.usesDependencies()) {
    return signature;
  }

  SignatureReader reader = new SignatureReader(signature);
  SignatureWriter writer = new SignatureWriter();

  reader.accept(new SourceAbiCompatibleSignatureVisitor(writer));

  return writer.toString();
}
 
开发者ID:facebook,项目名称:buck,代码行数:13,代码来源:SourceAbiCompatibleVisitor.java

示例10: getSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
 * Returns the type signature of the given element. If none is required by the VM spec, returns
 * null.
 */
@Nullable
public String getSignature(Element element) {
  SignatureWriter writer = new SignatureWriter();
  element.accept(elementVisitorAdapter, writer);
  String result = writer.toString();
  return result.isEmpty() ? null : result;
}
 
开发者ID:facebook,项目名称:buck,代码行数:12,代码来源:SignatureFactory.java

示例11: treatDependencyBoundsAsInterfaces

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
 * We can't tell whether an inferred class is a class, interface, annotation, or enum. This is
 * problematic for expressing generic type bounds, because the bytecode is different depending on
 * whether it is a class or an interface. As it happens, it's safe (from the compiler's
 * perspective) to treat everything as an interface. This method is used to rework the "expected"
 * signature so that we can use the same test data for testing with and without deps.
 */
private String treatDependencyBoundsAsInterfaces(String signature) {
  if (signature == null) {
    return null;
  }

  if (isTestingWithDependencies() || !signature.contains(":Lcom/facebook/foo/Dep")) {
    return signature;
  }

  SignatureWriter writer = new SignatureWriter();
  new SignatureReader(signature).accept(new SourceAbiCompatibleSignatureVisitor(writer));
  return writer.toString();
}
 
开发者ID:facebook,项目名称:buck,代码行数:21,代码来源:SignatureFactoryTest.java

示例12: mapSignature

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

示例13: mapSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String mapSignature(String signature) {
    SignatureReader sr = new SignatureReader(signature);
    SignatureWriter sw = new SignatureWriter();
    sr.accept(new SignatureAdapter(sw));
    return sw.toString();
}
 
开发者ID:yngui,项目名称:jephyr,代码行数:7,代码来源:RemappingClassAdapter.java

示例14: mapTypeSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String mapTypeSignature(String signature) {
    SignatureReader sr = new SignatureReader(signature);
    SignatureWriter sw = new SignatureWriter();
    sr.acceptType(new SignatureAdapter(sw));
    return sw.toString();
}
 
开发者ID:yngui,项目名称:jephyr,代码行数:7,代码来源:RemappingClassAdapter.java

示例15: getSignature

import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
 * Converts the given Type into a JVM signature. 
 * @param type the Type to analyze
 * @return the resulting signature
 */
public static String getSignature(java.lang.reflect.Type type) {
	SignatureWriter sw = new SignatureWriter();
	writeSignature(sw, type);
	return sw.toString();
}
 
开发者ID:timjansen,项目名称:actorsguild,代码行数:11,代码来源:GenericTypeHelper.java


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