Codota Logo
ASMUtil
Code IndexAdd Codota to your IDE (free)

How to use
ASMUtil
in
co.paralleluniverse.common.reflection

Best Java code snippets using co.paralleluniverse.common.reflection.ASMUtil (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: co.paralleluniverse/quasar-core

public static <T extends ClassVisitor> T accept(Class<?> clazz, int flags, T visitor) throws IOException {
  return accept(getClassInputStream(clazz), flags, visitor);
}
origin: co.paralleluniverse/quasar-core

public static MethodNode getMethod(MethodNode method, List<MethodNode> ms) {
  if (ms == null)
    return null;
  for (MethodNode m : ms) {
    if (equals(method, m))
      return m;
  }
  return null;
}
origin: co.paralleluniverse/quasar-core

public static ClassNode getClassNode(Class<?> clazz, boolean skipCode) throws IOException {
  return getClassNode(getClassInputStream(clazz), skipCode);
}
origin: co.paralleluniverse/quasar-core

private boolean findSuperDeclarations(ClassNode cls, ClassNode declaringClass, MethodNode method) throws IOException {
  if (cls == null)
    return false;
  boolean foundMethod = false;
  MethodNode m;
  if ((m = getMethod(method, cls)) != null) {
    foundMethod = true;
    if (!ASMUtil.equals(cls, declaringClass) && !isSuspendable(cls, m)) {
      log("Found parent of annotated method: " + declaringClass.name + "." + method.name + method.signature + " in " + cls.name, Project.MSG_VERBOSE);
      results.add(cls.name.replace('/', '.') + '.' + method.name);
    }
  }
  // recursively look in superclass and interfaces
  boolean methodInParent = false;
  methodInParent |= findSuperDeclarations(getClassNode(cls.superName, cl, true), declaringClass, method);
  for (String iface : (List<String>) cls.interfaces)
    methodInParent |= findSuperDeclarations(getClassNode(iface, cl, true), declaringClass, method);
  if (!foundMethod && methodInParent) {
    log("Found parent of annotated method in a parent of: " + declaringClass.name + "." + method.name + method.signature + " in " + cls.name, Project.MSG_VERBOSE);
    results.add(cls.name.replace('/', '.') + '.' + method.name);
  }
  return foundMethod | methodInParent;
}
origin: co.paralleluniverse/quasar-core

public static boolean hasAnnotation(Class ann, FieldNode f) {
  return hasAnnotation(ann, f.visibleAnnotations);
}
origin: co.paralleluniverse/quasar-core

private static boolean isAssignableFrom0(String supertypeName, String className, ClassLoader cl) {
  try {
    if (className == null)
      return false;
    if (supertypeName.equals(className))
      return true;
    ClassNode cn = getClassNode(className, cl, true);
    if (supertypeName.equals(cn.superName))
      return true;
    if (isAssignableFrom0(supertypeName, cn.superName, cl))
      return true;
    if (cn.interfaces != null) {
      for (String iface : (List<String>) cn.interfaces) {
        if (supertypeName.equals(iface))
          return true;
        if (isAssignableFrom0(supertypeName, iface, cl))
          return true;
      }
    }
    return false;
  } catch (IOException e) {
    // e.printStackTrace();
    throw new RuntimeException(e);
  }
}

origin: co.paralleluniverse/quasar-core

public static byte[] getClass(String className, ClassLoader cl) throws IOException {
  try (InputStream is = getClassInputStream(className, cl)) {
    return ByteStreams.toByteArray(is);
  }
}
origin: co.paralleluniverse/quasar-core

private void scanClass(File file) throws Exception {
  log("Scanning " + file, Project.MSG_VERBOSE);
  if (file != null) {
    if (USE_REFLECTION)
      scanClass(Class.forName(extractClassName(file)));
    else
      scanClass(getClassNode(new FileInputStream(file), true));
  }
}
origin: co.paralleluniverse/quasar-core

public static ClassNode getClassNode(InputStream is, boolean skipCode) throws IOException {
  return accept(is,
      ClassReader.SKIP_DEBUG | (skipCode ? 0 : ClassReader.SKIP_CODE),
      new ClassNode());
}
origin: co.paralleluniverse/quasar-core

public static MethodNode getMethod(MethodNode method, ClassNode c) {
  return getMethod(method, c.methods);
}
origin: co.paralleluniverse/quasar-core

private static boolean hasMethodWithDescriptor(String nameAndDescSuffix, Class<?> c) {
  if (nameAndDescSuffix == null || c == null)
    return false;
  for (final Method m : c.getDeclaredMethods()) {
    final String n = "." + m.getName() + ASMUtil.getDescriptor(m);
    if (nameAndDescSuffix.equals(n))
      return true;
  }
  if (hasMethodWithDescriptor(nameAndDescSuffix, c.getSuperclass()))
    return true;
  for (final Class<?> i : c.getInterfaces()) {
    if (hasMethodWithDescriptor(nameAndDescSuffix, i))
      return true;
  }
  return false;
}
origin: co.paralleluniverse/quasar-core

public static boolean hasMethod(MethodNode method, ClassNode c) {
  return hasMethod(method, c.methods);
}
origin: co.paralleluniverse/quasar-actors

private boolean isAutomaticUpgrade(String className) {
  for (Class<?> c : AUTOMATIC_UPGRADE_CLASSES) {
    if (ASMUtil.isAssignableFrom(c, className, ActorModule.this)) {
      LOG.debug("Automatic upgrade of class {} (implements/extends {})", className, c);
      return true;
    }
  }
  return false;
}

origin: co.paralleluniverse/quasar-core

private static String[] getReadableCallsites(String[] callsites) {
  String[] readable = new String[callsites.length];
  for (int i = 0; i < callsites.length; i++)
    readable[i] = SuspendableHelper.getCallsiteOwner(callsites[i]) + "."
           + SuspendableHelper.getCallsiteName(callsites[i])
           + ASMUtil.getReadableDescriptor(SuspendableHelper.getCallsiteDesc(callsites[i]));
  return readable;
}
origin: co.paralleluniverse/quasar-core

public static boolean hasAnnotation(Class ann, MethodNode m) {
  return hasAnnotation(ann, m.visibleAnnotations);
}
origin: co.paralleluniverse/quasar-core

public static byte[] getClass(Class<?> klass) throws IOException {
  try (InputStream is = getClassInputStream(klass)) {
    return ByteStreams.toByteArray(is);
  }
}
origin: co.paralleluniverse/quasar-core

private void scanSuspendablesFile() throws Exception {
  // scan classes in suspendables file
  if (ssc != null) {
    Set<String> classes = new HashSet<>();
    for (String susCls : ssc.getSuspendableClasses())
      classes.add(susCls);
    for (String susMethod : ssc.getSuspendables())
      classes.add(susMethod.substring(0, susMethod.indexOf('.')));
    for (String className : classes) {
      log("scanning suspendable class:" + className, Project.MSG_VERBOSE);
      scanClass(getClassNode(className, cl, true));
    }
  }
}
origin: co.paralleluniverse/quasar-core

try {
  final AtomicReference<String> descriptor = new AtomicReference<>();
  ASMUtil.accept(este.getDeclaringClass(), ClassReader.SKIP_FRAMES, new ClassVisitor(Opcodes.ASM5) {
    @Override
    public MethodVisitor visitMethod(int access, String name, final String desc, String signature, String[] exceptions) {
origin: co.paralleluniverse/quasar-core

public static boolean hasMethod(MethodNode method, List<MethodNode> ms) {
  return getMethod(method, ms) != null;
}
origin: co.paralleluniverse/quasar-core

final String nameAndDescSuffix = "." + callee.getName() + ASMUtil.getDescriptor(callee);
final String[] callsites = i.suspendableCallSiteNames();
for (String callsite : callsites) {
co.paralleluniverse.common.reflectionASMUtil

Most used methods

  • accept
  • equals
  • getClassInputStream
  • getClassNode
  • getDescriptor
  • getMethod
  • getReadableDescriptor
  • hasAnnotation
  • hasMethod
  • isAssignableFrom
  • isAssignableFrom0
  • isAssignableFrom0

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • getSystemService (Context)
  • getSharedPreferences (Context)
  • Path (java.nio.file)
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now