本文整理汇总了Java中org.apache.bcel.classfile.Signature类的典型用法代码示例。如果您正苦于以下问题:Java Signature类的具体用法?Java Signature怎么用?Java Signature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Signature类属于org.apache.bcel.classfile包,在下文中一共展示了Signature类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSignature
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
/**
* 获得范型中的类型
*
* @param obj
* @return
*/
public static String getSignature(FieldOrMethod obj) {
for (Attribute attribute : obj.getAttributes()) {
if (attribute instanceof Signature) {
return ((Signature) attribute).getSignature();
}
}
return obj.getSignature();
}
开发者ID:jdepend,项目名称:cooper,代码行数:15,代码来源:SignatureUtil.java
示例2: classHasParameter
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
public static boolean classHasParameter(JavaClass obj) {
for (Attribute a : obj.getAttributes())
if (a instanceof Signature) {
String sig = ((Signature) a).getSignature();
return sig.charAt(0) == '<';
}
return false;
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:9,代码来源:UnreadFields.java
示例3: visit
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
@Override
public void visit(Signature obj) {
String sig = obj.getSignature();
for (String s : BAD_SIGNATURES)
if (sig.indexOf(s) >= 0) {
if (visitingField())
bugReporter.reportBug(new BugInstance(this, "DMI_COLLECTION_OF_URLS", HIGH_PRIORITY).addClass(this)
.addVisitedField(this));
else if (visitingMethod())
bugReporter.reportBug(new BugInstance(this, "DMI_COLLECTION_OF_URLS", HIGH_PRIORITY).addClassAndMethod(this));
else
bugReporter.reportBug(new BugInstance(this, "DMI_COLLECTION_OF_URLS", HIGH_PRIORITY).addClass(this).addClass(
this));
}
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:16,代码来源:URLProblems.java
示例4: getGenericSignatureIterator
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
/**
* @param target
* the method whose signature is to be parsed
* @return an iterator over the parameters of the generic signature of
* method. Returns null if the generic signature cannot be parsed
*/
public static @CheckForNull
Iterator<String> getGenericSignatureIterator(Method target) {
try {
GenericSignatureParser parser = null;
String genericSignature = null;
for (Attribute a : target.getAttributes()) {
if (a instanceof Signature) {
Signature sig = (Signature) a;
if (genericSignature != null) {
if (!genericSignature.equals(sig.getSignature())) {
if (false) {
System.out.println("Inconsistent signatures: ");
System.out.println(genericSignature);
System.out.println(sig.getSignature());
}
return null; // we've seen two inconsistent
// signatures
}
continue;
}
genericSignature = sig.getSignature();
if (compareSignatures(target.getSignature(), genericSignature))
parser = new GenericSignatureParser(genericSignature);
}
}
Iterator<String> iter = parser == null ? null : parser.parameterSignatureIterator();
return iter;
} catch (RuntimeException e) {
} // degrade gracefully
return null;
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:40,代码来源:GenericSignatureParser.java
示例5: getClassOfGenericArgument
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
private JavaClass getClassOfGenericArgument(final Field field) throws ClassNotFoundException {
final Signature signature = getSignature(field);
JavaClass argumentClass = null;
if (signature != null) {
argumentClass = repository.loadClass(getClassNameOfGenericArgument(signature));
}
return argumentClass;
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:9,代码来源:FunctionBlockClass.java
示例6: getSignature
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
private Signature getSignature(final Field field) {
for (final Attribute attribute : field.getAttributes()) {
if (attribute instanceof Signature) {
return (Signature) attribute;
}
}
return null;
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:9,代码来源:FunctionBlockClass.java
示例7: getClassNameOfGenericArgument
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
private static String getClassNameOfGenericArgument(final Signature signature) {
final Matcher matcher = GENERIC_ARGUMENT_PATTERN.matcher(signature.getSignature());
matcher.find();
String className = matcher.group(1);
if (className != null) {
className = className.replaceAll("/", ".");
}
return className;
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:10,代码来源:FunctionBlockClass.java
示例8: visit
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
public void visit(Signature obj) {
visit((Attribute) obj);
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:BetterVisitor.java
示例9: visitSignature
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
public void visitSignature(Signature obj) {
visit(obj);
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:BetterVisitor.java
示例10: visit
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
@Override
public void visit(Signature obj) {
if (!isApplicationClass)
return;
String sig = obj.getSignature();
String className = findHashedClassInSignature(sig);
if (className == null)
return;
if (className.startsWith("java.lang"))
return;
JavaClass type = null;
try {
type = Repository.lookupClass(className);
} catch (ClassNotFoundException e) {
AnalysisContext.reportMissingClass(e);
}
if (type == null)
return;
int priority = NORMAL_PRIORITY;
if (sig.indexOf("Hash") >= 0)
priority--;
if (type.isAbstract() || type.isInterface())
priority++;
if (!AnalysisContext.currentAnalysisContext()/* .getSubtypes() */.isApplicationClass(type))
priority++;
BugInstance bug = null;
if (visitingField())
bug = new BugInstance(this, "HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS", priority).addClass(this)
.addVisitedField(this).addTypeOfNamedClass(className).describe(TypeAnnotation.UNHASHABLE_ROLE);
else if (visitingMethod())
bug = new BugInstance(this, "HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS", priority).addClassAndMethod(this)
.addTypeOfNamedClass(className).describe(TypeAnnotation.UNHASHABLE_ROLE);
else
bug = new BugInstance(this, "HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS", priority).addClass(this)
.addClass(this).addTypeOfNamedClass(className).describe(TypeAnnotation.UNHASHABLE_ROLE);
potentialBugs.put(className, bug);
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:43,代码来源:FindHEmismatch.java
示例11: visitSignature
import org.apache.bcel.classfile.Signature; //导入依赖的package包/类
public void visitSignature(Signature obj) {
tostring = toString(obj);
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:4,代码来源:StringRepresentation.java
注:本文中的org.apache.bcel.classfile.Signature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论