Java 类org.objectweb.asm.commons.EmptyVisitor 实例源码
项目:development
文件:CyclicReferencesTestTest.java
private void assertFiledTypes(final Class<?> type, String... expected)
throws IOException {
final ClassReader reader = new ClassReader(type.getName());
final Set<String> actual = new HashSet<String>();
reader.accept(new EmptyVisitor() {
@Override
public FieldVisitor visitField(int access, String name,
String desc, String signature, Object value) {
if ((access & Opcodes.ACC_SYNTHETIC) == 0) {
if (signature == null) {
signature = desc;
}
cyclicRefsTest.getTypesFromSignature(signature, actual);
}
return null;
}
}, 0);
assertEquals(new HashSet<String>(Arrays.asList(expected)), actual);
}
项目:jconts
文件:AsyncMethodsAnalyzer.java
@Override
public MethodVisitor visitMethod(final int access, final String methodName,
final String methodDesc, final String signature,
final String[] exceptions) {
return new EmptyVisitor() {
@Override
public AnnotationVisitor visitAnnotation(String desc,
boolean visible) {
// FIXME: Validate return type!
boolean isAsync = desc.equals(Constants.IS_ASYNC_ANNOTATION_DESC);
boolean isCoroutine = desc.equals(Constants.IS_COROUTINE_ANNOTATION_DESC);
if (isAsync || isCoroutine) {
if (methods == null) {
methods = new HashMap<String, MethodContext>();
}
methods.put(MethodContext.keyOf(methodName, methodDesc),
new MethodContext(owner, ownerSource, access,
methodName, methodDesc, signature,
exceptions, isCoroutine));
}
return null;
}
};
}
项目:annotation-tools
文件:ClassAnnotationSceneWriter.java
/**
* {@inheritDoc}
* @see org.objectweb.asm.ClassAdapter#visitAnnotation(java.lang.String, boolean)
*/
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
existingClassAnnotations.add(desc);
// If annotation exists in scene, and in overwrite mode,
// return empty visitor, since annotation from scene will be visited later.
if (aClass.lookup(classDescToName(desc)) != null
&& overwrite) {
return new EmptyVisitor();
}
return super.visitAnnotation(desc, visible);
}
项目:annotation-tools
文件:ClassAnnotationSceneWriter.java
/**
* {@inheritDoc}
* @see org.objectweb.asm.ClassAdapter#visitTypeAnnotation(java.lang.String, boolean, boolean)
*/
@Override
public TypeAnnotationVisitor visitTypeAnnotation(String desc, boolean visible, boolean inCode) {
existingClassAnnotations.add(desc);
// If annotation exists in scene, and in overwrite mode,
// return empty visitor, annotation from scene will be visited later.
if (aClass.lookup(classDescToName(desc)) != null
&& overwrite) {
return new EmptyVisitor();
}
return new SafeTypeAnnotationVisitor(
super.visitTypeAnnotation(desc, visible, inCode));
}
项目:annotation-tools
文件:ClassAnnotationSceneWriter.java
/**
* {@inheritDoc}
* @see org.objectweb.asm.FieldVisitor#visitAnnotation(java.lang.String, boolean)
*/
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
existingFieldAnnotations.add(desc);
// If annotation exists in scene, and in overwrite mode,
// return empty visitor, annotation from scene will be visited later.
if (aField.lookup(classDescToName(desc)) != null
&& overwrite)
return new EmptyVisitor();
return fv.visitAnnotation(desc, visible);
}
项目:annotation-tools
文件:ClassAnnotationSceneWriter.java
/**
* {@inheritDoc}
* @see org.objectweb.asm.FieldVisitor#visitTypeAnnotation(java.lang.String, boolean)
*/
@Override
public TypeAnnotationVisitor visitTypeAnnotation(String desc, boolean visible, boolean inCode) {
existingFieldAnnotations.add(desc);
// If annotation exists in scene, and in overwrite mode,
// return empty visitor, annotation from scene will be visited later.
if (aField.lookup(classDescToName(desc)) != null
&& overwrite)
return new EmptyVisitor();
return new SafeTypeAnnotationVisitor(
fv.visitTypeAnnotation(desc, visible, inCode));
}
项目:annotation-tools
文件:ClassAnnotationSceneWriter.java
/**
* {@inheritDoc}
* @see org.objectweb.asm.MethodAdapter#visitAnnotation(java.lang.String, boolean)
*/
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
existingMethodAnnotations.add(desc);
// If annotation exists in scene, and in overwrite mode,
// return empty visitor, annotation from scene will be visited later.
if (shouldSkipExisting(classDescToName(desc))) {
return new EmptyVisitor();
}
return super.visitAnnotation(desc, visible);
}
项目:annotation-tools
文件:ClassAnnotationSceneWriter.java
/**
* {@inheritDoc}
* @see org.objectweb.asm.MethodAdapter#visitTypeAnnotation(java.lang.String, boolean)
*/
@Override
public TypeAnnotationVisitor visitTypeAnnotation(String desc, boolean visible, boolean inCode) {
existingMethodAnnotations.add(desc);
// If annotation exists in scene, and in overwrite mode,
// return empty visitor, annotation from scene will be visited later.
if (shouldSkipExisting(classDescToName(desc))) {
return new EmptyVisitor();
}
return new SafeTypeAnnotationVisitor(
super.visitTypeAnnotation(desc, visible, inCode));
}
项目:CodenameOne
文件:RetroWeaverGui.java
private Thread createWeaverThread() {
return new Thread(new Runnable() {
public void run() {
Cursor oldCursor = getTopLevelAncestor().getCursor();
getTopLevelAncestor().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
status.setText("Running");
RetroWeaver weaver = new RetroWeaver(version);
messages.setText("");
weaver.setListener(RetroWeaverGui.this);
String refCp = refClassPath.getText();
if (refCp.length() != 0) {
java.util.List<String> classpath = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(refCp,
File.pathSeparator);
while (st.hasMoreTokens()) {
classpath.add(st.nextToken());
}
RefVerifier verifier = new RefVerifier(version, new EmptyVisitor(), classpath,
RetroWeaverGui.this);
weaver.setVerifier(verifier);
}
weaver.weave(path);
status.setText("Done");
} catch (Exception ex) {
status.setText("Error: " + ex.getMessage());
} finally {
getTopLevelAncestor().setCursor(oldCursor);
}
}
});
}
项目:cn1
文件:RetroWeaverGui.java
private Thread createWeaverThread() {
return new Thread(new Runnable() {
public void run() {
Cursor oldCursor = getTopLevelAncestor().getCursor();
getTopLevelAncestor().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
status.setText("Running");
RetroWeaver weaver = new RetroWeaver(version);
messages.setText("");
weaver.setListener(RetroWeaverGui.this);
String refCp = refClassPath.getText();
if (refCp.length() != 0) {
java.util.List<String> classpath = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(refCp,
File.pathSeparator);
while (st.hasMoreTokens()) {
classpath.add(st.nextToken());
}
RefVerifier verifier = new RefVerifier(version, new EmptyVisitor(), classpath,
RetroWeaverGui.this);
weaver.setVerifier(verifier);
}
weaver.weave(path);
status.setText("Done");
} catch (Exception ex) {
status.setText("Error: " + ex.getMessage());
} finally {
getTopLevelAncestor().setCursor(oldCursor);
}
}
});
}
项目:findbugs-all-the-bugs
文件:SelfMethodCalls.java
public static <T> MultiMap<T, T> getSelfCalls(final ClassDescriptor classDescriptor, final Map<String, T> methods) {
final MultiMap<T, T> map = new MultiMap<T, T>(HashSet.class);
FBClassReader reader;
try {
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 EmptyVisitor() {
@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, String signature,
String[] exceptions) {
return new EmptyVisitor() {
@Override
public void visitMethodInsn(int opcode, String owner, String name2, String desc2) {
if (owner.equals(classDescriptor.getClassName()) && interestingSignature(desc2)) {
T from = methods.get(name + desc + ((access & Opcodes.ACC_STATIC) != 0));
T to = methods.get(name2 + desc2 + (opcode == Opcodes.INVOKESTATIC));
map.add(from, to);
}
}
};
}
}, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
return map;
}
项目:FindBug-for-Domino-Designer
文件:SelfMethodCalls.java
public static <T> MultiMap<T, T> getSelfCalls(final ClassDescriptor classDescriptor, final Map<String, T> methods) {
final MultiMap<T, T> map = new MultiMap<T, T>(HashSet.class);
FBClassReader reader;
try {
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 EmptyVisitor() {
@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, String signature,
String[] exceptions) {
return new EmptyVisitor() {
@Override
public void visitMethodInsn(int opcode, String owner, String name2, String desc2) {
if (owner.equals(classDescriptor.getClassName()) && interestingSignature(desc2)) {
T from = methods.get(name + desc + ((access & Opcodes.ACC_STATIC) != 0));
T to = methods.get(name2 + desc2 + (opcode == Opcodes.INVOKESTATIC));
map.add(from, to);
}
}
};
}
}, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
return map;
}
项目:metaworks_framework
文件:HydrationScanner.java
public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4) {
return new EmptyVisitor();
}
项目:SparkCommerce
文件:HydrationScanner.java
public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4) {
return new EmptyVisitor();
}
项目:annotation-tools
文件:ClassReaderTest.java
public void test() throws Exception {
new ClassReader(is).accept(new EmptyVisitor(), false);
}
项目:blcdemo
文件:HydrationScanner.java
public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4) {
return new EmptyVisitor();
}
项目:findbugs-all-the-bugs
文件:AbstractFBMethodVisitor.java
public AbstractFBMethodVisitor() {
super(new EmptyVisitor());
}
项目:FindBug-for-Domino-Designer
文件:AbstractFBMethodVisitor.java
public AbstractFBMethodVisitor() {
super(new EmptyVisitor());
}
项目:eclectic
文件:BytecodeClassLoader.java
public NameClassAdapter() {
super(new EmptyVisitor());
}
项目:eclectic
文件:BytecodeClassLoader.java
public NameClassAdapter() {
super(new EmptyVisitor());
}
项目:jconts
文件:CodeVisitors.java
public static ClassVisitor tracer() {
return tracer(new EmptyVisitor());
}