congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SignatureHelper
Code IndexAdd Tabnine to your IDE (free)

How to use
SignatureHelper
in
com.buschmais.jqassistant.plugin.java.api.scanner

Best Java code snippets using com.buschmais.jqassistant.plugin.java.api.scanner.SignatureHelper (Showing top 20 results out of 315)

origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, boolean itf) {
  String methodSignature = SignatureHelper.getMethodSignature(name, desc);
  TypeCache.CachedType targetType = visitorHelper.resolveType(SignatureHelper.getObjectType(owner), containingType);
  MethodDescriptor invokedMethodDescriptor = visitorHelper.getMethodDescriptor(targetType, methodSignature);
  visitorHelper.addInvokes(methodDescriptor, lineNumber, invokedMethodDescriptor);
}
origin: com.buschmais.jqassistant.plugin/java

/**
 * Returns the Java type name type corresponding to the given type
 * descriptor.
 * 
 * @param desc
 *            The type descriptor.
 * @return The type name.
 */
public static String getType(String desc) {
  return getType(Type.getType(desc));
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
  MethodDescriptor methodDescriptor = visitorHelper.getMethodDescriptor(cachedType, SignatureHelper.getMethodSignature(name, desc));
  methodDescriptor.setName(name);
  setModifiers(access, methodDescriptor);
  if (hasFlag(access, Opcodes.ACC_ABSTRACT)) {
    methodDescriptor.setAbstract(Boolean.TRUE);
  }
  if (hasFlag(access, Opcodes.ACC_NATIVE)) {
    methodDescriptor.setNative(Boolean.TRUE);
  }
  if (signature == null) {
    String returnType = SignatureHelper.getType(org.objectweb.asm.Type.getReturnType(desc));
    methodDescriptor.setReturns(visitorHelper.resolveType(returnType, cachedType).getTypeDescriptor());
    org.objectweb.asm.Type[] types = org.objectweb.asm.Type.getArgumentTypes(desc);
    for (int i = 0; i < types.length; i++) {
      String parameterType = SignatureHelper.getType(types[i]);
      TypeDescriptor typeDescriptor = visitorHelper.resolveType(parameterType, cachedType).getTypeDescriptor();
      ParameterDescriptor parameterDescriptor = visitorHelper.addParameterDescriptor(methodDescriptor, i);
      parameterDescriptor.setType(typeDescriptor);
    }
  } else {
    new SignatureReader(signature).accept(new MethodSignatureVisitor(cachedType, methodDescriptor, visitorHelper, dependentTypeSignatureVisitor));
  }
  for (int i = 0; exceptions != null && i < exceptions.length; i++) {
    TypeDescriptor exceptionType = visitorHelper.resolveType(SignatureHelper.getObjectType(exceptions[i]), cachedType).getTypeDescriptor();
    methodDescriptor.getDeclaredThrowables().add(exceptionType);
  }
  return new MethodVisitor(cachedType, methodDescriptor, visitorHelper, dependentTypeSignatureVisitor);
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitEnum(final String name, final String desc, final String value) {
  EnumValueDescriptor valueDescriptor = createValue(EnumValueDescriptor.class, name);
  TypeCache.CachedType cachedTypeDescriptor = visitorHelper.resolveType(SignatureHelper.getType(desc), containingType);
  FieldDescriptor fieldDescriptor = visitorHelper.getFieldDescriptor(cachedTypeDescriptor, SignatureHelper.getFieldSignature(value, desc));
  valueDescriptor.setType(visitorHelper.resolveType(Enum.class.getName(), containingType).getTypeDescriptor());
  valueDescriptor.setValue(fieldDescriptor);
  addValue(name, valueDescriptor);
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) {
  String fieldSignature = SignatureHelper.getFieldSignature(name, desc);
  TypeCache.CachedType targetType = visitorHelper.resolveType(SignatureHelper.getObjectType(owner), containingType);
  FieldDescriptor fieldDescriptor = visitorHelper.getFieldDescriptor(targetType, fieldSignature);
  switch (opcode) {
  case Opcodes.GETFIELD:
  case Opcodes.GETSTATIC:
    visitorHelper.addReads(methodDescriptor, lineNumber, fieldDescriptor);
    break;
  case Opcodes.PUTFIELD:
  case Opcodes.PUTSTATIC:
    visitorHelper.addWrites(methodDescriptor, lineNumber, fieldDescriptor);
    break;
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitTryCatchBlock(final Label start, final Label end, final Label handler, final String type) {
  if (type != null) {
    String fullQualifiedName = SignatureHelper.getObjectType(type);
    visitorHelper.resolveType(fullQualifiedName, containingType);
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) {
  if (visitorHelper.getClassModelConfiguration().isMethodDeclaresVariable() && !THIS.equals(name)) {
    final VariableDescriptor variableDescriptor = visitorHelper.getVariableDescriptor(name, SignatureHelper.getFieldSignature(name, desc));
    if (signature == null) {
      TypeDescriptor type = visitorHelper.resolveType(SignatureHelper.getType((desc)), containingType).getTypeDescriptor();
      variableDescriptor.setType(type);
    } else {
      new SignatureReader(signature).accept(new AbstractTypeSignatureVisitor(containingType, visitorHelper) {
        @Override
        public SignatureVisitor visitArrayType() {
          return dependentTypeSignatureVisitor;
        }
        @Override
        public SignatureVisitor visitTypeArgument(char wildcard) {
          return dependentTypeSignatureVisitor;
        }
        @Override
        public void visitEnd(TypeDescriptor resolvedTypeDescriptor) {
          variableDescriptor.setType(resolvedTypeDescriptor);
        }
      });
    }
    methodDescriptor.getVariables().add(variableDescriptor);
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitTypeInsn(final int opcode, final String type) {
  visitorHelper.resolveType(SignatureHelper.getObjectType(type), containingType);
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) {
  final FieldDescriptor fieldDescriptor = visitorHelper.getFieldDescriptor(cachedType, SignatureHelper.getFieldSignature(name, desc));
  fieldDescriptor.setName(name);
  fieldDescriptor.setVolatile(hasFlag(access, Opcodes.ACC_VOLATILE));
  setModifiers(access, fieldDescriptor);
  if (signature == null) {
    TypeDescriptor type = visitorHelper.resolveType(SignatureHelper.getType((desc)), cachedType).getTypeDescriptor();
    fieldDescriptor.setType(type);
  } else {
      visitorHelper.resolveType(SignatureHelper.getType((org.objectweb.asm.Type) value), cachedType);
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitLdcInsn(final Object cst) {
  if (cst instanceof Type) {
    visitorHelper.resolveType(SignatureHelper.getType((Type) cst), containingType);
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitOuterClass(final String owner, final String name, final String desc) {
  String outerTypeName = SignatureHelper.getObjectType(owner);
  TypeCache.CachedType cachedOuterType = visitorHelper.resolveType(outerTypeName, this.cachedType);
  TypeDescriptor innerType = this.cachedType.getTypeDescriptor();
  cachedOuterType.getTypeDescriptor().getDeclaredInnerClasses().add(innerType);
  if (name != null) {
    String methodSignature = SignatureHelper.getMethodSignature(name, desc);
    MethodDescriptor methodDescriptor = visitorHelper.getMethodDescriptor(cachedOuterType, methodSignature);
    methodDescriptor.getDeclaredInnerClasses().add(innerType);
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitClassType(String name) {
  resolvedTypeDescriptor = visitorHelper.resolveType(SignatureHelper.getObjectType(name), containingType).getTypeDescriptor();
}
origin: com.buschmais.jqassistant.plugin/java

/**
 * Returns the Java type name corresponding to the given internal name.
 * 
 * @param desc
 *            The internal name.
 * @return The type name.
 */
public static String getObjectType(String desc) {
  return getType(Type.getObjectType(desc));
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitInnerClass(final String name, final String outerName, final String innerName, final int access) {
  String fullQualifiedName = cachedType.getTypeDescriptor().getFullQualifiedName();
  // innerName always represents the name of the inner class
  String innerTypeName = SignatureHelper.getObjectType(name);
  TypeDescriptor innerType = visitorHelper.resolveType(innerTypeName, cachedType).getTypeDescriptor();
  // set relation only if outerName is current class
  if (outerName != null) {
    String outerTypeName = SignatureHelper.getObjectType(outerName);
    if (fullQualifiedName.equals(outerTypeName)) {
      cachedType.getTypeDescriptor().getDeclaredInnerClasses().add(innerType);
    }
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visitMultiANewArrayInsn(final String desc, final int dims) {
  visitorHelper.resolveType(SignatureHelper.getType(desc), containingType);
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
  Class<? extends ClassFileDescriptor> javaType = getJavaType(access);
  String fullQualifiedName = SignatureHelper.getObjectType(name);
  cachedType = visitorHelper.createType(fullQualifiedName, fileDescriptor, javaType);
  dependentTypeSignatureVisitor = new DependentTypeSignatureVisitor(cachedType, visitorHelper);
  ClassFileDescriptor classFileDescriptor = cachedType.getTypeDescriptor();
  classFileDescriptor.setByteCodeVersion(version);
  if (hasFlag(access, Opcodes.ACC_ABSTRACT) && !hasFlag(access, Opcodes.ACC_INTERFACE)) {
    classFileDescriptor.setAbstract(Boolean.TRUE);
  }
  setModifiers(access, classFileDescriptor);
  if (signature == null) {
    if (superName != null) {
      TypeDescriptor superClassType = visitorHelper.resolveType(SignatureHelper.getObjectType(superName), cachedType).getTypeDescriptor();
      classFileDescriptor.setSuperClass(superClassType);
    }
    for (int i = 0; interfaces != null && i < interfaces.length; i++) {
      TypeDescriptor interfaceType = visitorHelper.resolveType(SignatureHelper.getObjectType(interfaces[i]), cachedType).getTypeDescriptor();
      classFileDescriptor.getInterfaces().add(interfaceType);
    }
  } else {
    new SignatureReader(signature).accept(new ClassSignatureVisitor(cachedType, visitorHelper, dependentTypeSignatureVisitor));
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
  AnnotationValueDescriptor annotationDescriptor = visitorHelper.addAnnotation(containingType, methodDescriptor, SignatureHelper.getType(desc));
  return new AnnotationVisitor(containingType, annotationDescriptor, visitorHelper);
}
origin: com.buschmais.jqassistant.plugin/java

/**
 * Return the type name of the given ASM type.
 * 
 * @param t
 *            The ASM type.
 * @return The type name.
 */
public static String getType(final Type t) {
  switch (t.getSort()) {
  case Type.ARRAY:
    return getType(t.getElementType());
  default:
    return t.getClassName();
  }
}
origin: com.buschmais.jqassistant.plugin/java

  @Override
  public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {
    AnnotationValueDescriptor annotationDescriptor = visitorHelper.addAnnotation(containingType, fieldDescriptor, SignatureHelper.getType(arg0));
    return new AnnotationVisitor(containingType, annotationDescriptor, visitorHelper);
  }
}
origin: com.buschmais.jqassistant.plugin/java

@Override
public org.objectweb.asm.AnnotationVisitor visitParameterAnnotation(final int parameter, final String desc, final boolean visible) {
  String annotationType = SignatureHelper.getType(desc);
  if (JAVA_LANG_SYNTHETIC.equals(annotationType)) {
    // Ignore synthetic parameters add the start of the signature, i.e.
    // determine the number of synthetic parameters
    syntheticParameters = Math.max(syntheticParameters, parameter + 1);
    return null;
  }
  ParameterDescriptor parameterDescriptor = visitorHelper.getParameterDescriptor(methodDescriptor, parameter - syntheticParameters);
  if (parameterDescriptor == null) {
    LOGGER.warn("Cannot find parameter with index " + (parameter - syntheticParameters) + " in method signature "
        + containingType.getTypeDescriptor().getFullQualifiedName() + "#" + methodDescriptor.getSignature());
    return null;
  }
  AnnotationValueDescriptor annotationDescriptor = visitorHelper.addAnnotation(containingType, parameterDescriptor, SignatureHelper.getType(desc));
  return new AnnotationVisitor(containingType, annotationDescriptor, visitorHelper);
}
com.buschmais.jqassistant.plugin.java.api.scannerSignatureHelper

Javadoc

Provides utility functions for working with signatures.

Most used methods

  • getFieldSignature
    Return a field signature.
  • getMethodSignature
    Return a method signature.
  • getObjectType
    Returns the Java type name corresponding to the given internal name.
  • getType
    Return the type name of the given ASM type.

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSystemService (Context)
  • getSharedPreferences (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JOptionPane (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now