org.objectweb.asm.signature.SignatureVisitor源码实例Demo

类org.objectweb.asm.signature.SignatureVisitor源码实例Demo

下面列出了org.objectweb.asm.signature.SignatureVisitor 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: buck   文件: SignatureFactory.java
@Override
public Void visitType(TypeElement element, SignatureVisitor visitor) {
  if (!signatureRequired(element)) {
    return null;
  }

  for (TypeParameterElement typeParameterElement : element.getTypeParameters()) {
    typeParameterElement.accept(this, visitor);
  }

  TypeMirror superclass = element.getSuperclass();
  if (superclass.getKind() != TypeKind.NONE) {
    superclass.accept(typeVisitorAdapter, visitor.visitSuperclass());
  } else {
    // Interface type; implicit superclass of Object
    SignatureVisitor superclassVisitor = visitor.visitSuperclass();
    superclassVisitor.visitClassType("java/lang/Object");
    superclassVisitor.visitEnd();
  }

  for (TypeMirror interfaceType : element.getInterfaces()) {
    interfaceType.accept(typeVisitorAdapter, visitor.visitInterface());
  }

  return null;
}
 
源代码2 项目: buck   文件: SignatureFactory.java
@Override
public Void visitExecutable(ExecutableType t, SignatureVisitor visitor) {
  if (!signatureRequired(t)) {
    return null;
  }

  for (TypeVariable typeVariable : t.getTypeVariables()) {
    typeVariable.asElement().accept(elementVisitorAdapter, visitor);
  }

  for (TypeMirror parameter : t.getParameterTypes()) {
    parameter.accept(this, visitor.visitParameterType());
  }

  t.getReturnType().accept(this, visitor.visitReturnType());

  if (throwsATypeVar(t)) {
    for (TypeMirror thrownType : t.getThrownTypes()) {
      thrownType.accept(typeVisitorAdapter, visitor.visitExceptionType());
    }
  }

  return null;
}
 
源代码3 项目: JReFrameworker   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitTypeArgument(final char tag) {
  if (argumentStack % 2 == 0) {
    ++argumentStack;
    declaration.append('<');
  } else {
    declaration.append(COMMA_SEPARATOR);
  }

  if (tag == EXTENDS) {
    declaration.append("? extends ");
  } else if (tag == SUPER) {
    declaration.append("? super ");
  }

  startType();
  return this;
}
 
源代码4 项目: Concurnas   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitTypeArgument(final char tag) {
  if (argumentStack % 2 == 0) {
    ++argumentStack;
    declaration.append('<');
  } else {
    declaration.append(COMMA_SEPARATOR);
  }

  if (tag == EXTENDS) {
    declaration.append("? extends ");
  } else if (tag == SUPER) {
    declaration.append("? super ");
  }

  startType();
  return this;
}
 
源代码5 项目: testability-explorer   文件: SignatureParser.java
@Override
public SignatureVisitor visitArrayType() {
  return new TypeVisitor(new Setter() {
    public void set(Type type) {
      parameters.add(type.toArray());
    }
  });
}
 
源代码6 项目: JReFrameworker   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitExceptionType() {
  if (exceptions == null) {
    exceptions = new StringBuilder();
  } else {
    exceptions.append(COMMA_SEPARATOR);
  }
  return new TraceSignatureVisitor(exceptions);
}
 
源代码7 项目: testability-explorer   文件: SignatureParser.java
@Override
public SignatureVisitor visitReturnType() {
  return new TypeVisitor(new Setter() {
    public void set(Type type) {
      returnType = type;
    }
  });
}
 
源代码8 项目: Concurnas   文件: Remapper.java
/**
 * Returns the given signature, remapped with the {@link SignatureVisitor} returned by {@link
 * #createSignatureRemapper(SignatureVisitor)}.
 *
 * @param signature a <i>JavaTypeSignature</i>, <i>ClassSignature</i> or <i>MethodSignature</i>.
 * @param typeSignature whether the given signature is a <i>JavaTypeSignature</i>.
 * @return signature the given signature, remapped with the {@link SignatureVisitor} returned by
 *     {@link #createSignatureRemapper(SignatureVisitor)}.
 */
public String mapSignature(final String signature, final boolean typeSignature) {
  if (signature == null) {
    return null;
  }
  SignatureReader signatureReader = new SignatureReader(signature);
  SignatureWriter signatureWriter = new SignatureWriter();
  SignatureVisitor signatureRemapper = createSignatureRemapper(signatureWriter);
  if (typeSignature) {
    signatureReader.acceptType(signatureRemapper);
  } else {
    signatureReader.accept(signatureRemapper);
  }
  return signatureWriter.toString();
}
 
源代码9 项目: JReFrameworker   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitSuperclass() {
  endFormals();
  separator = EXTENDS_SEPARATOR;
  startType();
  return this;
}
 
源代码10 项目: meghanada-server   文件: FieldSignatureVisitor.java
@Override
public SignatureVisitor visitArrayType() {

  final TypeInfo current = this.currentType.peek();
  if (current != null) {
    current.isArray = true;
  } else {
    // on hold array flag
    this.holdArray = true;
  }
  final EntryMessage em =
      log.traceEntry("name={} current={} currentType={}", this.name, current, this.currentType);
  return log.traceExit(em, super.visitArrayType());
}
 
源代码11 项目: JByteMod-Beta   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitTypeArgument(final char wildcard) {
  if (state != CLASS_TYPE) {
    throw new IllegalStateException();
  }
  if ("+-=".indexOf(wildcard) == -1) {
    throw new IllegalArgumentException();
  }
  SignatureVisitor v = sv == null ? null : sv.visitTypeArgument(wildcard);
  return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
}
 
源代码12 项目: JReFrameworker   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitClassBound() {
  if (type == TYPE_SIGNATURE || !VISIT_CLASS_BOUND_STATES.contains(state)) {
    throw new IllegalStateException();
  }
  state = State.BOUND;
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE, signatureVisitor == null ? null : signatureVisitor.visitClassBound());
}
 
源代码13 项目: Concurnas   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitClassBound() {
  if (type == TYPE_SIGNATURE || !VISIT_CLASS_BOUND_STATES.contains(state)) {
    throw new IllegalStateException();
  }
  state = State.BOUND;
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE, signatureVisitor == null ? null : signatureVisitor.visitClassBound());
}
 
源代码14 项目: Concurnas   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitInterfaceBound() {
  if (type == TYPE_SIGNATURE || !VISIT_INTERFACE_BOUND_STATES.contains(state)) {
    throw new IllegalStateException();
  }
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE, signatureVisitor == null ? null : signatureVisitor.visitInterfaceBound());
}
 
源代码15 项目: JReFrameworker   文件: Remapper.java
/**
 * Returns the given signature, remapped with the {@link SignatureVisitor} returned by {@link
 * #createSignatureRemapper(SignatureVisitor)}.
 *
 * @param signature a <i>JavaTypeSignature</i>, <i>ClassSignature</i> or <i>MethodSignature</i>.
 * @param typeSignature whether the given signature is a <i>JavaTypeSignature</i>.
 * @return signature the given signature, remapped with the {@link SignatureVisitor} returned by
 *     {@link #createSignatureRemapper(SignatureVisitor)}.
 */
public String mapSignature(final String signature, final boolean typeSignature) {
  if (signature == null) {
    return null;
  }
  SignatureReader signatureReader = new SignatureReader(signature);
  SignatureWriter signatureWriter = new SignatureWriter();
  SignatureVisitor signatureRemapper = createSignatureRemapper(signatureWriter);
  if (typeSignature) {
    signatureReader.acceptType(signatureRemapper);
  } else {
    signatureReader.accept(signatureRemapper);
  }
  return signatureWriter.toString();
}
 
源代码16 项目: JReFrameworker   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitTypeArgument(final char wildcard) {
  if (state != State.CLASS_TYPE) {
    throw new IllegalStateException();
  }
  if ("+-=".indexOf(wildcard) == -1) {
    throw new IllegalArgumentException();
  }
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE,
      signatureVisitor == null ? null : signatureVisitor.visitTypeArgument(wildcard));
}
 
源代码17 项目: buck   文件: SignatureFactory.java
@Override
public Void visitError(ErrorType t, SignatureVisitor visitor) {
  // We don't really know, but if there's an error type the compilation is going to fail
  // anyway, so just pretend it's Object.
  visitor.visitClassType("java/lang/Object");
  visitor.visitEnd();
  return null;
}
 
源代码18 项目: Concurnas   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitTypeArgument(final char wildcard) {
  if (state != State.CLASS_TYPE) {
    throw new IllegalStateException();
  }
  if ("+-=".indexOf(wildcard) == -1) {
    throw new IllegalArgumentException("Wildcard must be one of +-=");
  }
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE,
      signatureVisitor == null ? null : signatureVisitor.visitTypeArgument(wildcard));
}
 
源代码19 项目: JReFrameworker   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitSuperclass() {
  if (type != CLASS_SIGNATURE || !VISIT_SUPER_CLASS_STATES.contains(state)) {
    throw new IllegalArgumentException();
  }
  state = State.SUPER;
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE, signatureVisitor == null ? null : signatureVisitor.visitSuperclass());
}
 
源代码20 项目: Concurnas   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitSuperclass() {
  endFormals();
  separator = EXTENDS_SEPARATOR;
  startType();
  return this;
}
 
源代码21 项目: Concurnas   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitInterface() {
  if (interfaceVisited) {
    separator = COMMA_SEPARATOR;
  } else {
    separator = isInterface ? EXTENDS_SEPARATOR : IMPLEMENTS_SEPARATOR;
    interfaceVisited = true;
  }
  startType();
  return this;
}
 
源代码22 项目: Concurnas   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitParameterType() {
  endFormals();
  if (parameterTypeVisited) {
    declaration.append(COMMA_SEPARATOR);
  } else {
    declaration.append('(');
    parameterTypeVisited = true;
  }
  startType();
  return this;
}
 
源代码23 项目: Concurnas   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitExceptionType() {
  if (exceptions == null) {
    exceptions = new StringBuilder();
  } else {
    exceptions.append(COMMA_SEPARATOR);
  }
  return new TraceSignatureVisitor(exceptions);
}
 
源代码24 项目: JReFrameworker   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitSuperclass() {
  endFormals();
  separator = EXTENDS_SEPARATOR;
  startType();
  return this;
}
 
源代码25 项目: AVM   文件: JarOptimizer.java
private Set<String> visitClass(String className, Map<String, byte[]> classMap) {

        DependencyCollector dependencyCollector = new DependencyCollector();

        ClassReader reader = new ClassReader(classMap.get(className));

        SignatureVisitor signatureVisitor = new SignatureDependencyVisitor(dependencyCollector);
        ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
        ClassVisitor classVisitor = new ClassDependencyVisitor(signatureVisitor, dependencyCollector, writer, preserveDebugInfo);
        reader.accept(classVisitor, 0);

        classMap.put(className, writer.toByteArray());
        return dependencyCollector.getDependencies();
    }
 
源代码26 项目: JByteMod-Beta   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitExceptionType() {
  if (exceptions == null) {
    exceptions = new StringBuilder();
  } else {
    exceptions.append(", ");
  }
  // startType();
  return new TraceSignatureVisitor(exceptions);
}
 
源代码27 项目: JByteMod-Beta   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitInterface() {
  if (state != SUPER) {
    throw new IllegalStateException();
  }
  SignatureVisitor v = sv == null ? null : sv.visitInterface();
  return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
}
 
源代码28 项目: JReFrameworker   文件: TraceSignatureVisitor.java
@Override
public SignatureVisitor visitReturnType() {
  endFormals();
  if (parameterTypeVisited) {
    parameterTypeVisited = false;
  } else {
    declaration.append('(');
  }
  declaration.append(')');
  returnType = new StringBuilder();
  return new TraceSignatureVisitor(returnType);
}
 
源代码29 项目: JReFrameworker   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitExceptionType() {
  if (type != METHOD_SIGNATURE || !VISIT_EXCEPTION_TYPE_STATES.contains(state)) {
    throw new IllegalStateException();
  }
  return new CheckSignatureAdapter(
      TYPE_SIGNATURE, signatureVisitor == null ? null : signatureVisitor.visitExceptionType());
}
 
源代码30 项目: JByteMod-Beta   文件: CheckSignatureAdapter.java
@Override
public SignatureVisitor visitSuperclass() {
  if (type != CLASS_SIGNATURE || (state & (EMPTY | FORMAL | BOUND)) == 0) {
    throw new IllegalArgumentException();
  }
  state = SUPER;
  SignatureVisitor v = sv == null ? null : sv.visitSuperclass();
  return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法