本文整理汇总了Java中com.intellij.psi.impl.cache.TypeInfo类的典型用法代码示例。如果您正苦于以下问题:Java TypeInfo类的具体用法?Java TypeInfo怎么用?Java TypeInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeInfo类属于com.intellij.psi.impl.cache包,在下文中一共展示了TypeInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ClsTypeElementImpl
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
myParent = parent;
myTypeText = TypeInfo.internFrequentType(typeText);
myVariance = variance;
myChild = new AtomicNullableLazyValue<ClsElementImpl>() {
@Override
protected ClsElementImpl compute() {
return calculateChild();
}
};
myCachedType = new AtomicNotNullLazyValue<PsiType>() {
@NotNull
@Override
protected PsiType compute() {
return calculateType();
}
};
}
示例2: getType
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@Override
@NotNull
public PsiType getType() {
final PsiFieldStub stub = getStub();
if (stub != null) {
PsiType type = SoftReference.dereference(myCachedType);
if (type != null) return type;
String typeText = TypeInfo.createTypeText(stub.getType(true));
try {
type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this);
myCachedType = new SoftReference<PsiType>(type);
return type;
}
catch (IncorrectOperationException e) {
LOG.error(e);
return null;
}
}
myCachedType = null;
return JavaSharedImplUtil.getType(getTypeElement(), getNameIdentifier());
}
示例3: ClsTypeElementImpl
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
myParent = parent;
myTypeText = TypeInfo.internFrequentType(typeText);
myVariance = variance;
myChild = new VolatileNullableLazyValue<ClsElementImpl>() {
@Nullable
@Override
protected ClsElementImpl compute() {
return calculateChild();
}
};
myCachedType = new AtomicNotNullLazyValue<PsiType>() {
@NotNull
@Override
protected PsiType compute() {
return calculateType();
}
};
}
示例4: visitField
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@Override
@Nullable
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)
{
if(isSet(access, Opcodes.ACC_SYNTHETIC))
{
return null;
}
if(name == null)
{
return null;
}
byte flags = PsiFieldStubImpl.packFlags(isSet(access, Opcodes.ACC_ENUM), isSet(access, Opcodes.ACC_DEPRECATED), false, false);
TypeInfo type = fieldType(desc, signature);
String initializer = constToString(value, type.text, false, myMapping);
PsiFieldStub stub = new PsiFieldStubImpl(myResult, name, type, initializer, flags);
PsiModifierListStub modList = new PsiModifierListStubImpl(stub, packFieldFlags(access));
return new FieldAnnotationCollectingVisitor(modList, myMapping);
}
示例5: fieldType
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
private TypeInfo fieldType(String desc, String signature)
{
String type = null;
if(signature != null)
{
try
{
type = SignatureParsing.parseTypeString(new StringCharacterIterator(signature), myMapping);
}
catch(ClsFormatException e)
{
if(LOG.isDebugEnabled())
{
LOG.debug("source=" + mySource + " signature=" + signature, e);
}
}
}
if(type == null)
{
type = toJavaType(Type.getType(desc), myMapping);
}
return TypeInfo.fromString(type, false);
}
示例6: ClsTypeElementImpl
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance)
{
myParent = parent;
myTypeText = TypeInfo.internFrequentType(typeText);
myVariance = variance;
myChild = new AtomicNullableLazyValue<ClsElementImpl>()
{
@Override
protected ClsElementImpl compute()
{
return calculateChild();
}
};
myCachedType = new AtomicNotNullLazyValue<PsiType>()
{
@NotNull
@Override
protected PsiType compute()
{
return calculateType();
}
};
}
示例7: serialize
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@Override
public void serialize(@NotNull final PsiMethodStub stub, @NotNull final StubOutputStream dataStream) throws IOException {
dataStream.writeName(stub.getName());
TypeInfo.writeTYPE(dataStream, stub.getReturnTypeText(false));
dataStream.writeByte(((PsiMethodStubImpl)stub).getFlags());
if (stub.isAnnotationMethod()) {
dataStream.writeName(stub.getDefaultValueText());
}
}
示例8: deserialize
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@NotNull
@Override
public PsiMethodStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
StringRef name = dataStream.readName();
final TypeInfo type = TypeInfo.readTYPE(dataStream);
byte flags = dataStream.readByte();
final StringRef defaultMethodValue = PsiMethodStubImpl.isAnnotationMethod(flags) ? dataStream.readName() : null;
return new PsiMethodStubImpl(parentStub, StringRef.toString(name), type, flags, StringRef.toString(defaultMethodValue));
}
示例9: createStub
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
boolean isDeprecatedByComment = false;
boolean hasDeprecatedAnnotation = false;
boolean hasDocComment = false;
String name = null;
String initializer = null;
boolean expectingInit = false;
for (final LighterASTNode child : tree.getChildren(node)) {
final IElementType type = child.getTokenType();
if (type == JavaDocElementType.DOC_COMMENT) {
hasDocComment = true;
isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
}
else if (type == JavaElementType.MODIFIER_LIST) {
hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
}
else if (type == JavaTokenType.IDENTIFIER) {
name = RecordUtil.intern(tree.getCharTable(), child);
}
else if (type == JavaTokenType.EQ) {
expectingInit = true;
}
else if (expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type != JavaTokenType.SEMICOLON) {
initializer = encodeInitializer(tree, child);
break;
}
}
final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);
return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
示例10: serialize
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@Override
public void serialize(@NotNull final PsiFieldStub stub, @NotNull final StubOutputStream dataStream) throws IOException {
dataStream.writeName(stub.getName());
TypeInfo.writeTYPE(dataStream, stub.getType(false));
dataStream.writeName(stub.getInitializerText());
dataStream.writeByte(((PsiFieldStubImpl)stub).getFlags());
}
示例11: deserialize
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@NotNull
@Override
public PsiFieldStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
final StringRef name = dataStream.readName();
final TypeInfo type = TypeInfo.readTYPE(dataStream);
final StringRef initializerText = dataStream.readName();
final byte flags = dataStream.readByte();
return new PsiFieldStubImpl(parentStub, name, type, initializerText, flags);
}
示例12: PsiMethodStubImpl
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
public PsiMethodStubImpl(StubElement parent,
String name,
byte flags,
String signature,
@NotNull List<String> args,
@Nullable List<String> throwables,
String desc,
int modifiersMask) {
super(parent, isAnnotationMethod(flags) ? JavaStubElementTypes.ANNOTATION_METHOD : JavaStubElementTypes.METHOD);
myName = name;
myDefaultValueText = null;
new PsiModifierListStubImpl(this, modifiersMask);
String returnType = null;
boolean parsedViaGenericSignature = false;
if (signature != null) {
try {
returnType = StubBuildingVisitor.parseMethodViaGenericSignature(signature, this, args, throwables);
parsedViaGenericSignature = true;
}
catch (ClsFormatException ignored) { }
}
if (returnType == null) {
returnType = StubBuildingVisitor.parseMethodViaDescription(desc, this, args);
}
myReturnType = TypeInfo.fromString(returnType);
myFlags = (byte)(flags | (parsedViaGenericSignature ? PARSED_VIA_GENERIC_SIGNATURE : 0));
}
示例13: PsiFieldStubImpl
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
public PsiFieldStubImpl(StubElement parent, StringRef name, @NotNull TypeInfo type, @Nullable StringRef initializer, byte flags) {
super(parent, isEnumConst(flags) ? JavaStubElementTypes.ENUM_CONSTANT : JavaStubElementTypes.FIELD);
myName = name;
myType = type;
myInitializer = initializer;
myFlags = flags;
}
示例14: createStub
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
String name = RecordUtil.intern(tree.getCharTable(), id);
return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
示例15: deserialize
import com.intellij.psi.impl.cache.TypeInfo; //导入依赖的package包/类
@NotNull
@Override
public PsiParameterStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
StringRef name = dataStream.readName();
TypeInfo type = TypeInfo.readTYPE(dataStream);
boolean isEllipsis = dataStream.readBoolean();
return new PsiParameterStubImpl(parentStub, name, type, isEllipsis);
}