
com.github.sbt.jni.javah.util.ClassMetaInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bleep-plugin-jni_3 Show documentation
Show all versions of bleep-plugin-jni_3 Show documentation
A bleeping fast scala build tool!
package com.github.sbt.jni.javah.util;
import com.github.sbt.jni.javah.ClassName;
import org.objectweb.asm.*;
import java.util.*;
public class ClassMetaInfo extends ClassVisitor {
public final List constants = new LinkedList<>();
public final List methods = new LinkedList<>();
public final Map counts = new HashMap<>();
ClassName superClassName;
ClassName name;
public ClassMetaInfo() {
super(Opcodes.ASM7);
}
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.superClassName = superName == null ? null : ClassName.ofInternalName(superName);
this.name = ClassName.ofInternalName(name);
}
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
counts.put(name, counts.getOrDefault(name, 0) + 1);
if ((access & Opcodes.ACC_NATIVE) != 0) {
this.methods.add(NativeMethod.of(access, name, descriptor));
}
return null;
}
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
if (value != null && !(value instanceof String)) {
constants.add(Constant.of(name, value));
}
return null;
}
public boolean isOverloadMethod(NativeMethod method) {
Objects.requireNonNull(method);
return counts.getOrDefault(method.name(), 1) > 1;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy