use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.
the class MethodAnalyzeVisitor method toMemberDescriptor.
private void toMemberDescriptor() {
String modifier = ASMReflector.toModifier(this.access, this.hasDefault);
if (this.interfaceMethod) {
modifier = ClassNameUtils.replace(modifier, "abstract", "").trim();
}
final CandidateUnit.MemberType memberType = name.equals("<init>") ? CandidateUnit.MemberType.CONSTRUCTOR : CandidateUnit.MemberType.METHOD;
final String methodName = memberType == CandidateUnit.MemberType.CONSTRUCTOR ? this.classAnalyzeVisitor.className : this.name;
final EntryMessage message = log.traceEntry("className={} memberType={} methodName={} returnType={}", this.classAnalyzeVisitor.className, methodName, memberType, this.returnType);
if (methodName.startsWith("lambda$")) {
// skip
log.traceExit(message);
return;
}
if (memberType == CandidateUnit.MemberType.CONSTRUCTOR && methodName.equals(ClassNameUtils.OBJECT_CLASS)) {
// skip
log.traceExit(message);
return;
}
final String returnFQCN = memberType == CandidateUnit.MemberType.CONSTRUCTOR ? methodName : this.returnType.getFQCN();
final List<MethodParameter> methodParameters = this.parameterTypes.stream().map(typeInfo -> new MethodParameter(typeInfo.getFQCN(), typeInfo.paramName)).collect(Collectors.toList());
final MethodDescriptor descriptor = new MethodDescriptor(this.classAnalyzeVisitor.className, methodName, modifier, methodParameters, this.exceptions, returnFQCN, this.hasDefault, memberType);
descriptor.setTypeParameters(this.typeParameters);
log.trace("formalType={}", this.formalType);
if (this.formalType != null) {
descriptor.formalType = this.formalType.toString();
}
this.classAnalyzeVisitor.members.add(descriptor);
log.traceExit(message);
}
use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.
the class MethodAnalyzeVisitor method visitEnd.
@Override
public void visitEnd() {
final EntryMessage entryMessage = log.traceEntry("returnType={} parameterTypes={}", this.returnType, this.parameterTypes);
if (this.returnType == null) {
// void
this.returnType = new TypeInfo("void", "void");
}
if (this.parameterTypes == null) {
// void
this.parameterTypes = new ArrayList<>(4);
}
if (((this.parameterTypes.size() != this.parameterNames.length) || (this.parameterNames.length > 0 && this.parameterNames[0] == null)) && !tryGetParameterName(this.classAnalyzeVisitor.className, this.name)) {
setDefaultParameterNames();
}
for (int i = 0; i < this.parameterTypes.size(); i++) {
TypeInfo typeInfo = this.parameterTypes.get(i);
typeInfo.paramName = this.parameterNames[i];
}
// log.debug("{} ({})", this.name, this.parameterTypes);
this.toMemberDescriptor();
log.traceExit(entryMessage);
}
use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.
the class MethodAnalyzeVisitor method parseSignature.
MethodAnalyzeVisitor parseSignature() {
final EntryMessage entryMessage = log.traceEntry("name={} methodSignature={}", this.name, this.methodSignature);
final boolean isStatic = (Opcodes.ACC_STATIC & this.access) > 0;
final SignatureReader signatureReader = new SignatureReader(this.methodSignature);
MethodSignatureVisitor visitor;
if (isStatic) {
visitor = new MethodSignatureVisitor(this.name, new ArrayList<>(4));
} else {
visitor = new MethodSignatureVisitor(this.name, this.classAnalyzeVisitor.classTypeParameters);
}
if (this.typeMap != null) {
visitor.setTypeMap(this.typeMap);
}
signatureReader.accept(visitor);
this.formalType = visitor.getFormalType();
this.parameterTypes = visitor.getParameterTypes();
this.typeParameters = visitor.getTypeParameters();
this.returnType = visitor.getReturnType();
log.traceExit(entryMessage);
return this;
}
use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.
the class MethodSignatureVisitor method visitClassType.
@Override
public void visitClassType(final String s) {
final String className = ClassNameUtils.replaceSlash(s);
final EntryMessage message = log.traceEntry("current={} s={} className={} isClassBound={}", this.current, s, className, this.isClassBound);
TypeInfo typeInfo = new TypeInfo(className, className);
if (this.isInterfaceBound && !this.isFormalType) {
final String name = this.current.name;
current.name = '<' + name + " extends " + className + '>';
log.traceExit(message);
return;
}
if (this.isClassBound && !this.isFormalType) {
final String name = this.current.name;
current.name = '<' + name + '>';
log.traceExit(message);
return;
}
if (this.hasTypes) {
// override
if (this.isExtends) {
typeInfo = new TypeInfo("? extends " + className, "? extends " + className);
} else if (this.isSuper) {
typeInfo = new TypeInfo("? super " + className, "? super " + className);
}
this.current = typeInfo;
}
if (this.current == null) {
this.current = typeInfo;
}
log.traceExit(message);
}
use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.
the class MethodSignatureVisitor method visitEnd.
@Override
public void visitEnd() {
final EntryMessage message = log.traceEntry("current={} isClassBound={} isInterfaceBound={}", this.current, this.isClassBound, this.isInterfaceBound);
if (this.isReturn && this.parent != null) {
if (this.hasTypes) {
if (this.parent.current.typeParameters == null) {
this.parent.current.typeParameters = new ArrayList<>(4);
}
this.parent.current.typeParameters.add(this.current);
} else {
if (this.isArray) {
this.parent.returnType = this.current;
this.parent.returnType.isArray = true;
} else {
this.parent.returnType = this.current;
}
}
log.traceExit(message);
return;
}
if (this.isParameter && this.parent != null) {
if (this.isArray) {
this.current.variableArguments = true;
}
if (this.parent.current != null) {
if (this.parent.current.typeParameters == null) {
this.parent.current.typeParameters = new ArrayList<>(4);
}
this.parent.current.typeParameters.add(this.current);
} else {
if (this.parent.parameterTypes == null) {
this.parent.parameterTypes = new ArrayList<>(4);
}
this.parent.parameterTypes.add(this.current);
}
log.traceExit(message);
return;
}
if (this.isClassBound || this.isInterfaceBound) {
assert this.parent != null;
this.parent.formalType = this.current;
}
log.traceExit(message);
}
Aggregations