mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Split leaf/composite Javadoc element
This commit is contained in:
@@ -125,13 +125,13 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
if (node == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final IElementType type = node.getElementType();
|
||||
if (type == JavaDocTokenType.DOC_TAG_VALUE_TOKEN) {
|
||||
if (type == JavaDocElementType.DOC_TAG_VALUE_ELEMENT) {
|
||||
return PsiTreeUtil.getParentOfType(parent, PsiDocMethodOrFieldRef.class) != null;
|
||||
}
|
||||
|
||||
return type == JavaDocElementType.DOC_COMMENT || type == JavaDocElementType.DOC_TAG
|
||||
|| type == JavaDocElementType.DOC_INLINE_TAG;
|
||||
return type == JavaDocElementType.DOC_COMMENT || type == JavaDocElementType.DOC_TAG || type == JavaDocElementType.DOC_INLINE_TAG;
|
||||
}
|
||||
|
||||
private void init(final ASTNode child) {
|
||||
@@ -1096,9 +1096,8 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
else if (myRole1 == ChildRole.OPERATION_SIGN) {
|
||||
createSpaceInCode(mySettings.SPACE_AROUND_UNARY_OPERATOR);
|
||||
}
|
||||
else if (myChild1.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN
|
||||
&& myChild2.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN)
|
||||
{
|
||||
else if ((myType1 == JavaDocTokenType.DOC_TAG_VALUE_TOKEN || myType1 == JavaDocElementType.DOC_TAG_VALUE_ELEMENT) &&
|
||||
(myType2 == JavaDocTokenType.DOC_TAG_VALUE_TOKEN || myType2 == JavaDocElementType.DOC_TAG_VALUE_ELEMENT)) {
|
||||
createSpaceInCode(true);
|
||||
}
|
||||
else if (myRole1 == ChildRole.COMMA) {
|
||||
@@ -1516,7 +1515,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
}
|
||||
|
||||
@Override public void visitDocTag(PsiDocTag tag) {
|
||||
if (myChild1.getElementType() == JavaDocTokenType.DOC_TAG_NAME && myChild2.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN) {
|
||||
if (myType1 == JavaDocTokenType.DOC_TAG_NAME && myType2 == JavaDocElementType.DOC_TAG_VALUE_ELEMENT) {
|
||||
myResult = Spacing.createSpacing(1, 1, 0, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -22,10 +22,9 @@ import com.intellij.psi.tree.IElementType;
|
||||
* @author max
|
||||
*/
|
||||
public class JavaASTFactory extends CoreJavaASTFactory {
|
||||
|
||||
@Override
|
||||
public CompositeElement createComposite(final IElementType type) {
|
||||
if (type == DOC_TAG_VALUE_TOKEN) {
|
||||
if (type == DOC_TAG_VALUE_ELEMENT) {
|
||||
return new PsiDocTagValueImpl();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -147,7 +147,7 @@ public class JavadocParser {
|
||||
final PsiBuilder.Marker tagValue = builder.mark();
|
||||
builder.remapCurrentToken(JavaDocElementType.DOC_REFERENCE_HOLDER);
|
||||
builder.advanceLexer();
|
||||
tagValue.done(JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
tagValue.done(JavaDocElementType.DOC_TAG_VALUE_ELEMENT);
|
||||
}
|
||||
else if (!isInline && tagName != null && tagName.equals(PARAM_TAG)) {
|
||||
parseSimpleTagValue(builder, true);
|
||||
@@ -187,7 +187,7 @@ public class JavadocParser {
|
||||
else {
|
||||
final PsiBuilder.Marker tagValue = builder.mark();
|
||||
builder.advanceLexer();
|
||||
tagValue.done(JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
tagValue.done(JavaDocElementType.DOC_TAG_VALUE_ELEMENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ public class JavadocParser {
|
||||
}
|
||||
}
|
||||
else if (tokenType == JavaDocTokenType.DOC_TAG_VALUE_RPAREN) {
|
||||
subValue.done(JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
subValue.done(JavaDocElementType.DOC_TAG_VALUE_ELEMENT);
|
||||
builder.advanceLexer();
|
||||
refStart.done(JavaDocElementType.DOC_METHOD_OR_FIELD_REF);
|
||||
return;
|
||||
@@ -227,7 +227,7 @@ public class JavadocParser {
|
||||
}
|
||||
}
|
||||
|
||||
subValue.done(JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
subValue.done(JavaDocElementType.DOC_TAG_VALUE_ELEMENT);
|
||||
}
|
||||
|
||||
refStart.done(JavaDocElementType.DOC_METHOD_OR_FIELD_REF);
|
||||
@@ -238,7 +238,7 @@ public class JavadocParser {
|
||||
while (TAG_VALUES_SET.contains(getTokenType(builder))) {
|
||||
builder.advanceLexer();
|
||||
}
|
||||
tagValue.done(parameter ? JavaDocElementType.DOC_PARAMETER_REF : JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
tagValue.done(parameter ? JavaDocElementType.DOC_PARAMETER_REF : JavaDocElementType.DOC_TAG_VALUE_ELEMENT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -99,7 +99,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
|
||||
i == JavaElementType.THIS_EXPRESSION ||
|
||||
i == JavaElementType.SUPER_EXPRESSION ||
|
||||
i == JavaDocElementType.DOC_METHOD_OR_FIELD_REF ||
|
||||
i == JavaDocTokenType.DOC_TAG_VALUE_TOKEN ||
|
||||
i == JavaDocElementType.DOC_TAG_VALUE_ELEMENT ||
|
||||
i == JavaElementType.REFERENCE_PARAMETER_LIST ||
|
||||
i == JavaElementType.ANNOTATION) {
|
||||
if (isQualified()) {
|
||||
|
||||
+3
-1
@@ -21,6 +21,7 @@ import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.impl.source.tree.ChildRole;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.javadoc.PsiDocTagValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -29,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class CorePsiDocTagValueImpl extends CompositePsiElement implements PsiDocTagValue {
|
||||
public CorePsiDocTagValueImpl() {
|
||||
super(JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
super(JavaDocElementType.DOC_TAG_VALUE_ELEMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,6 +48,7 @@ public class CorePsiDocTagValueImpl extends CompositePsiElement implements PsiDo
|
||||
if (child.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_COMMA) {
|
||||
return ChildRole.COMMA;
|
||||
}
|
||||
|
||||
return super.getChildRole(child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -18,11 +18,7 @@ package com.intellij.psi.impl.source.javadoc;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.Constants;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
import com.intellij.psi.impl.source.tree.Factory;
|
||||
import com.intellij.psi.impl.source.tree.LeafElement;
|
||||
import com.intellij.psi.impl.source.tree.SharedImplUtil;
|
||||
import com.intellij.psi.impl.source.tree.*;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTag;
|
||||
@@ -43,9 +39,8 @@ import java.util.Set;
|
||||
* @author mike
|
||||
*/
|
||||
public class PsiDocParamRef extends CompositePsiElement implements PsiDocTagValue {
|
||||
|
||||
public PsiDocParamRef() {
|
||||
super(Constants.DOC_PARAMETER_REF);
|
||||
super(JavaDocElementType.DOC_PARAMETER_REF);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
package com.intellij.psi.impl.source.javadoc;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.source.Constants;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
|
||||
import com.intellij.psi.impl.source.tree.ChildRole;
|
||||
import com.intellij.psi.impl.source.tree.CompositePsiElement;
|
||||
@@ -37,9 +33,10 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Constants {
|
||||
private static final TokenSet VALUE_BIT_SET = TokenSet.create(
|
||||
JAVA_CODE_REFERENCE, DOC_TAG_VALUE_TOKEN, DOC_METHOD_OR_FIELD_REF, DOC_PARAMETER_REF,
|
||||
DOC_COMMENT_DATA, DOC_INLINE_TAG, DOC_REFERENCE_HOLDER);
|
||||
private static final TokenSet TAG_VALUE_BIT_SET = TokenSet.create(
|
||||
DOC_TAG_VALUE_ELEMENT, DOC_METHOD_OR_FIELD_REF, DOC_PARAMETER_REF);
|
||||
private static final TokenSet VALUE_BIT_SET = TokenSet.orSet(TAG_VALUE_BIT_SET, TokenSet.create(
|
||||
DOC_TAG_VALUE_TOKEN, JAVA_CODE_REFERENCE, DOC_COMMENT_DATA, DOC_INLINE_TAG, DOC_REFERENCE_HOLDER));
|
||||
|
||||
public PsiDocTagImpl() {
|
||||
super(DOC_TAG);
|
||||
@@ -47,17 +44,17 @@ public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Con
|
||||
|
||||
@Override
|
||||
public PsiDocComment getContainingComment() {
|
||||
return (PsiDocComment)SourceTreeToPsiMap.treeElementToPsi(getTreeParent());
|
||||
return (PsiDocComment)getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getNameElement() {
|
||||
return findChildByRoleAsPsiElement(ChildRole.DOC_TAG_NAME);
|
||||
return findPsiChildByType(DOC_TAG_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiDocTagValue getValueElement() {
|
||||
return (PsiDocTagValue)findChildByRoleAsPsiElement(ChildRole.DOC_TAG_VALUE);
|
||||
return (PsiDocTagValue)findPsiChildByType(TAG_VALUE_BIT_SET);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +62,7 @@ public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Con
|
||||
return getChildrenAsPsiElements(VALUE_BIT_SET, PsiElement.ARRAY_FACTORY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
if (getNameElement() == null) return "";
|
||||
@@ -79,7 +77,7 @@ public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Con
|
||||
|
||||
@Override
|
||||
public int getChildRole(ASTNode child) {
|
||||
assert (child.getTreeParent() == this);
|
||||
assert child.getTreeParent() == this : child.getTreeParent();
|
||||
IElementType i = child.getElementType();
|
||||
if (i == DOC_TAG_NAME) {
|
||||
return ChildRole.DOC_TAG_NAME;
|
||||
@@ -90,10 +88,7 @@ public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Con
|
||||
else if (i == DOC_COMMENT_LEADING_ASTERISKS) {
|
||||
return ChildRole.DOC_COMMENT_ASTERISKS;
|
||||
}
|
||||
else if (i == DOC_TAG_VALUE_TOKEN) {
|
||||
return ChildRole.DOC_TAG_VALUE;
|
||||
}
|
||||
else if (i == DOC_METHOD_OR_FIELD_REF || i == DOC_PARAMETER_REF) {
|
||||
else if (TAG_VALUE_BIT_SET.contains(i)) {
|
||||
return ChildRole.DOC_TAG_VALUE;
|
||||
}
|
||||
else {
|
||||
@@ -104,7 +99,7 @@ public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Con
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiReference[] getReferences() {
|
||||
return ReferenceProvidersRegistry.getReferencesFromProviders(this, PsiDocTag.class);
|
||||
return ReferenceProvidersRegistry.getReferencesFromProviders(this, PsiReferenceService.Hints.NO_HINTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-15
@@ -13,10 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.impl.source.tree.java;
|
||||
package com.intellij.psi.impl.source.javadoc;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.JavaElementVisitor;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
@@ -36,11 +35,10 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlineDocTag, Constants {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.PsiInlineDocTagImpl");
|
||||
|
||||
private static final TokenSet VALUE_BIT_SET = TokenSet.create(
|
||||
JAVA_CODE_REFERENCE, DOC_TAG_VALUE_TOKEN, DOC_METHOD_OR_FIELD_REF, DOC_COMMENT_DATA, DOC_INLINE_TAG,
|
||||
DOC_REFERENCE_HOLDER, WHITE_SPACE, DOC_COMMENT_BAD_CHARACTER);
|
||||
private static final TokenSet TAG_VALUE_BIT_SET = TokenSet.create(
|
||||
DOC_TAG_VALUE_ELEMENT, DOC_METHOD_OR_FIELD_REF);
|
||||
private static final TokenSet VALUE_BIT_SET = TokenSet.orSet(TAG_VALUE_BIT_SET, TokenSet.create(
|
||||
JAVA_CODE_REFERENCE, DOC_TAG_VALUE_TOKEN, DOC_COMMENT_DATA, DOC_INLINE_TAG, DOC_REFERENCE_HOLDER, WHITE_SPACE, DOC_COMMENT_BAD_CHARACTER));
|
||||
|
||||
public PsiInlineDocTagImpl() {
|
||||
super(DOC_INLINE_TAG);
|
||||
@@ -57,7 +55,7 @@ public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlin
|
||||
|
||||
@Override
|
||||
public PsiElement getNameElement() {
|
||||
return findChildByRoleAsPsiElement(ChildRole.DOC_TAG_NAME);
|
||||
return findPsiChildByType(DOC_TAG_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +65,7 @@ public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlin
|
||||
|
||||
@Override
|
||||
public PsiDocTagValue getValueElement() {
|
||||
return (PsiDocTagValue)findChildByRoleAsPsiElement(ChildRole.DOC_TAG_VALUE);
|
||||
return (PsiDocTagValue)findPsiChildByType(TAG_VALUE_BIT_SET);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,7 +77,7 @@ public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlin
|
||||
|
||||
@Override
|
||||
public int getChildRole(ASTNode child) {
|
||||
LOG.assertTrue(child.getTreeParent() == this);
|
||||
assert child.getTreeParent() == this : child.getTreeParent();
|
||||
IElementType i = child.getElementType();
|
||||
if (i == DOC_TAG_NAME) {
|
||||
return ChildRole.DOC_TAG_NAME;
|
||||
@@ -93,10 +91,7 @@ public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlin
|
||||
else if (i == DOC_INLINE_TAG_END) {
|
||||
return ChildRole.DOC_INLINE_TAG_END;
|
||||
}
|
||||
else if (i == DOC_TAG_VALUE_TOKEN) {
|
||||
return ChildRole.DOC_TAG_VALUE;
|
||||
}
|
||||
else if (i == DOC_METHOD_OR_FIELD_REF) {
|
||||
else if (TAG_VALUE_BIT_SET.contains(i)) {
|
||||
return ChildRole.DOC_TAG_VALUE;
|
||||
}
|
||||
else {
|
||||
@@ -124,4 +119,4 @@ public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlin
|
||||
PsiImplUtil.setName(getNameElement(), name);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -49,6 +49,7 @@ public class CoreJavaASTFactory extends ASTFactory implements Constants {
|
||||
return new PsiJavaTokenImpl(type, text);
|
||||
}
|
||||
else if (type instanceof IJavaDocElementType) {
|
||||
assert type != DOC_TAG_VALUE_ELEMENT;
|
||||
return new PsiDocTokenImpl(type, text);
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ public class CoreJavaASTFactory extends ASTFactory implements Constants {
|
||||
|
||||
@Override
|
||||
public CompositeElement createComposite(IElementType type) {
|
||||
if (type == DOC_TAG_VALUE_TOKEN) {
|
||||
if (type == DOC_TAG_VALUE_ELEMENT) {
|
||||
return new CorePsiDocTagValueImpl();
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -29,7 +29,7 @@ import com.intellij.psi.impl.source.javadoc.PsiDocCommentImpl;
|
||||
import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef;
|
||||
import com.intellij.psi.impl.source.javadoc.PsiDocParamRef;
|
||||
import com.intellij.psi.impl.source.javadoc.PsiDocTagImpl;
|
||||
import com.intellij.psi.impl.source.tree.java.PsiInlineDocTagImpl;
|
||||
import com.intellij.psi.impl.source.javadoc.PsiInlineDocTagImpl;
|
||||
import com.intellij.psi.tree.*;
|
||||
import com.intellij.psi.tree.java.IJavaDocElementType;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
@@ -70,6 +70,7 @@ public interface JavaDocElementType {
|
||||
IElementType DOC_INLINE_TAG = new JavaDocCompositeElementType("DOC_INLINE_TAG", PsiInlineDocTagImpl.class);
|
||||
IElementType DOC_METHOD_OR_FIELD_REF = new JavaDocCompositeElementType("DOC_METHOD_OR_FIELD_REF", PsiDocMethodOrFieldRef.class);
|
||||
IElementType DOC_PARAMETER_REF = new JavaDocCompositeElementType("DOC_PARAMETER_REF", PsiDocParamRef.class);
|
||||
IElementType DOC_TAG_VALUE_ELEMENT = new IJavaDocElementType("DOC_TAG_VALUE_ELEMENT");
|
||||
|
||||
ILazyParseableElementType DOC_REFERENCE_HOLDER = new JavaDocLazyElementType("DOC_REFERENCE_HOLDER") {
|
||||
private final JavaParserUtil.ParserWrapper myParser = new JavaParserUtil.ParserWrapper() {
|
||||
@@ -135,6 +136,6 @@ public interface JavaDocElementType {
|
||||
};
|
||||
|
||||
TokenSet ALL_JAVADOC_ELEMENTS = TokenSet.create(
|
||||
DOC_TAG, DOC_INLINE_TAG, DOC_METHOD_OR_FIELD_REF, DOC_PARAMETER_REF, DOC_REFERENCE_HOLDER, DOC_TYPE_HOLDER, DOC_COMMENT
|
||||
);
|
||||
DOC_TAG, DOC_INLINE_TAG, DOC_METHOD_OR_FIELD_REF, DOC_PARAMETER_REF, DOC_TAG_VALUE_ELEMENT,
|
||||
DOC_REFERENCE_HOLDER, DOC_TYPE_HOLDER, DOC_COMMENT);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ PsiJavaFile:Exception0.java
|
||||
PsiDocTag:@throws
|
||||
PsiDocToken:DOC_TAG_NAME('@throws')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_REFERENCE_HOLDER)
|
||||
PsiJavaCodeReferenceElement:java.lang.Exception
|
||||
PsiJavaCodeReferenceElement:java.lang
|
||||
|
||||
@@ -15,7 +15,7 @@ PsiJavaFile:InlineTag1.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('somefunc')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
|
||||
@@ -15,7 +15,7 @@ PsiJavaFile:InlineTag2.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('somefunc')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
|
||||
@@ -15,7 +15,7 @@ PsiJavaFile:InlineTag3.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('somefunc')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
|
||||
@@ -30,7 +30,7 @@ PsiJavaFile:LinkPlainTag1.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:java.lang.Object
|
||||
PsiJavaCodeReferenceElement:java.lang.Object
|
||||
|
||||
@@ -10,7 +10,7 @@ PsiJavaFile:LinkPlainTag2.java
|
||||
PsiDocTag:@linkplain
|
||||
PsiDocToken:DOC_TAG_NAME('@linkplain')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('java.lang.String')
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
|
||||
@@ -30,7 +30,7 @@ PsiJavaFile:LinkTag1.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:java.lang.Object
|
||||
PsiJavaCodeReferenceElement:java.lang.Object
|
||||
|
||||
@@ -10,7 +10,7 @@ PsiJavaFile:LinkTag2.java
|
||||
PsiDocTag:@link
|
||||
PsiDocToken:DOC_TAG_NAME('@link')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('java.lang.String')
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
|
||||
@@ -17,7 +17,7 @@ PsiJavaFile:LinkTag3.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('foo')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
<empty list>
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiDocToken:DOC_INLINE_TAG_END('}')
|
||||
|
||||
@@ -16,7 +16,7 @@ PsiJavaFile:LinkTag4.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('foo')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
<empty list>
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiDocToken:DOC_INLINE_TAG_END('}')
|
||||
|
||||
@@ -15,7 +15,7 @@ PsiJavaFile:LinkTag5.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('foo')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
<empty list>
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiDocToken:DOC_INLINE_TAG_END('}')
|
||||
|
||||
@@ -15,7 +15,7 @@ PsiJavaFile:LinkTag6.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('foo')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
<empty list>
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiDocToken:DOC_INLINE_TAG_END('}')
|
||||
|
||||
@@ -29,7 +29,7 @@ PsiJavaFile:SeeTag10.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:java.lang.Object
|
||||
PsiJavaCodeReferenceElement:java.lang.Object
|
||||
|
||||
@@ -29,7 +29,7 @@ PsiJavaFile:SeeTag11.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('wait')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
<empty list>
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
|
||||
@@ -14,7 +14,7 @@ PsiJavaFile:SeeTag12.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('wait')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
<empty list>
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
|
||||
@@ -29,7 +29,7 @@ PsiJavaFile:SeeTag14.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('append')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:char[]
|
||||
PsiTypeElement:char
|
||||
|
||||
@@ -29,7 +29,7 @@ PsiJavaFile:SeeTag15.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('append')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:java.lang.Object
|
||||
PsiJavaCodeReferenceElement:java.lang.Object
|
||||
|
||||
@@ -19,7 +19,7 @@ PsiJavaFile:SeeTag16.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
|
||||
@@ -19,7 +19,7 @@ PsiJavaFile:SeeTag3.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('equals')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:Object
|
||||
PsiJavaCodeReferenceElement:Object
|
||||
|
||||
@@ -29,7 +29,7 @@ PsiJavaFile:SeeTag5.java
|
||||
PsiDocToken:DOC_TAG_VALUE_SHARP_TOKEN('#')
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('wait')
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiElement(DOC_TYPE_HOLDER)
|
||||
PsiTypeElement:long
|
||||
PsiKeyword:long('long')
|
||||
|
||||
@@ -15,16 +15,16 @@ PsiJavaFile:SeeTag9.java
|
||||
PsiIdentifier:equals('equals')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_LPAREN('(')
|
||||
PsiElement(DOC_REFERENCE_HOLDER)
|
||||
PsiKeyword:long('long')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOC_REFERENCE_HOLDER)
|
||||
PsiKeyword:long('long')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_RPAREN(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiDocToken:DOC_COMMENT_END('*/')
|
||||
|
||||
@@ -23,7 +23,7 @@ PsiJavaFile:Tag2.java
|
||||
PsiDocTag:@return
|
||||
PsiDocToken:DOC_TAG_NAME('@return')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('value')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiDocToken:DOC_COMMENT_DATA('value')
|
||||
|
||||
@@ -10,7 +10,7 @@ PsiJavaFile:Tag5.java
|
||||
PsiDocTag:@ejb:bean
|
||||
PsiDocToken:DOC_TAG_NAME('@ejb:bean')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOC_TAG_VALUE_TOKEN)
|
||||
PsiElement(DOC_TAG_VALUE_ELEMENT)
|
||||
PsiDocToken:DOC_TAG_VALUE_TOKEN('this')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiDocToken:DOC_COMMENT_DATA('is an EJB ')
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.formatter.java;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -529,12 +544,12 @@ public class JavaFormatterTest extends AbstractJavaFormatterTest {
|
||||
public void testJavaDocLinksWithParameterNames() throws Exception {
|
||||
// See IDEADEV-8332
|
||||
doTextTest("/**\n" +
|
||||
"* @return if ( x1 == x1 ) then retrun {@link #cmp(String y1,int y2)}\n" +
|
||||
"* @return if ( x1 == x1 ) then return {@link #cmp(String y1,int y2)}\n" +
|
||||
"* otherwise return {@link #cmp(int x1,int x2)}\n" +
|
||||
"*/\n" +
|
||||
"class X {\n" +
|
||||
"}\n", "/**\n" +
|
||||
" * @return if ( x1 == x1 ) then retrun {@link #cmp(String y1, int y2)}\n" +
|
||||
" * @return if ( x1 == x1 ) then return {@link #cmp(String y1, int y2)}\n" +
|
||||
" * otherwise return {@link #cmp(int x1, int x2)}\n" +
|
||||
" */\n" +
|
||||
"class X {\n" +
|
||||
|
||||
Reference in New Issue
Block a user