@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); }
@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()); }
@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); }
@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; 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) { 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); return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags); }
@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()); }
@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); }