mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Common TypeInfo usage pattern in toString()'s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,9 +57,7 @@ public class PsiFieldStubImpl extends StubBase<PsiField> implements PsiFieldStub
|
||||
@Override
|
||||
@NotNull
|
||||
public TypeInfo getType(boolean doResolve) {
|
||||
if (!doResolve) return myType;
|
||||
|
||||
return addApplicableTypeAnnotationsFromChildModifierList(this, myType);
|
||||
return doResolve ? addApplicableTypeAnnotationsFromChildModifierList(this, myType) : myType;
|
||||
}
|
||||
|
||||
public static TypeInfo addApplicableTypeAnnotationsFromChildModifierList(StubBase<?> aThis, TypeInfo type) {
|
||||
@@ -126,13 +124,11 @@ public class PsiFieldStubImpl extends StubBase<PsiField> implements PsiFieldStub
|
||||
if (isDeprecated() || hasDeprecatedAnnotation()) {
|
||||
builder.append("deprecated ");
|
||||
}
|
||||
|
||||
if (isEnumConstant()) {
|
||||
builder.append("enumconst ");
|
||||
}
|
||||
|
||||
TypeInfo type = getType(false); // this can be called from low-level code and we don't want resolve to mess with indexing
|
||||
builder.append(getName()).append(':').append(TypeInfo.createTypeText(type));
|
||||
builder.append(myName).append(':').append(myType);
|
||||
|
||||
if (myInitializer != null) {
|
||||
builder.append('=').append(myInitializer);
|
||||
|
||||
@@ -99,8 +99,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
|
||||
@Override
|
||||
@NotNull
|
||||
public TypeInfo getReturnTypeText(boolean doResolve) {
|
||||
if (!doResolve) return myReturnType;
|
||||
return PsiFieldStubImpl.addApplicableTypeAnnotationsFromChildModifierList(this, myReturnType);
|
||||
return doResolve ? PsiFieldStubImpl.addApplicableTypeAnnotationsFromChildModifierList(this, myReturnType) : myReturnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,6 +161,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PsiMethodStub[");
|
||||
|
||||
if (isConstructor()) {
|
||||
builder.append("cons ");
|
||||
}
|
||||
@@ -175,9 +175,9 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
|
||||
builder.append("deprecated ");
|
||||
}
|
||||
|
||||
builder.append(getName()).append(":").append(TypeInfo.createTypeText(getReturnTypeText(false)));
|
||||
builder.append(myName).append(":").append(myReturnType);
|
||||
|
||||
final String defaultValue = getDefaultValueText();
|
||||
String defaultValue = getDefaultValueText();
|
||||
if (defaultValue != null) {
|
||||
builder.append(" default=").append(defaultValue);
|
||||
}
|
||||
|
||||
+1
-1
@@ -97,6 +97,6 @@ public class PsiParameterStubImpl extends StubBase<PsiParameter> implements PsiP
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiParameterStub[" + myName + ':' + TypeInfo.createTypeText(getType(false)) + ']';
|
||||
return "PsiParameterStub[" + myName + ':' + myType + ']';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user