New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeclarationOrder: problem with forward references #4984

Closed
romani opened this Issue Aug 22, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@romani
Member

romani commented Aug 22, 2017

http://checkstyle.sourceforge.net/config_coding.html#DeclarationOrder

ATTENTION: the check skips class fields which have forward references from validation due to the fact that we have Checkstyle's limitations to clearly detect user intention of fields location and grouping.

There is forward reference at https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java#L36 but it is not ignored.

after fix, this suppression should be removed - https://github.com/checkstyle/checkstyle/blob/master/config/suppressions.xml#L58

@romani romani added the approved label Aug 22, 2017

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Sep 12, 2017

Member

@kazachka ,

so structure of class is:

public final class JavadocTokenTypes {
    private static final int RULE_TYPES_OFFSET = 10000;
    public static final int JAVADOC = JavadocParser.RULE_javadoc + RULE_TYPES_OFFSET;
    public static final int JAVADOC_TAG = JavadocParser.RULE_javadocTag + RULE_TYPES_OFFSET;
    public static final int JAVADOC_INLINE_TAG = JavadocParser.RULE_javadocInlineTag
            + RULE_TYPES_OFFSET;
    public static final int RETURN_LITERAL = JavadocParser.RETURN_LITERAL; // violation is here and further down for  lines that do not use RULE_TYPES_OFFSET

so Looks like Check is right and we just need to reorder fileds in class

Member

romani commented Sep 12, 2017

@kazachka ,

so structure of class is:

public final class JavadocTokenTypes {
    private static final int RULE_TYPES_OFFSET = 10000;
    public static final int JAVADOC = JavadocParser.RULE_javadoc + RULE_TYPES_OFFSET;
    public static final int JAVADOC_TAG = JavadocParser.RULE_javadocTag + RULE_TYPES_OFFSET;
    public static final int JAVADOC_INLINE_TAG = JavadocParser.RULE_javadocInlineTag
            + RULE_TYPES_OFFSET;
    public static final int RETURN_LITERAL = JavadocParser.RETURN_LITERAL; // violation is here and further down for  lines that do not use RULE_TYPES_OFFSET

so Looks like Check is right and we just need to reorder fileds in class

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Sep 12, 2017

Member

@kazachka , let's try to make changes that Check requests in that java file and see how it will looks like.

Member

romani commented Sep 12, 2017

@kazachka , let's try to make changes that Check requests in that java file and see how it will looks like.

kazachka added a commit to kazachka/checkstyle that referenced this issue Sep 14, 2017

rnveach added a commit that referenced this issue Sep 15, 2017

@rnveach

This comment has been minimized.

Show comment
Hide comment
@rnveach

rnveach Sep 15, 2017

Member

Fix was merged

Member

rnveach commented Sep 15, 2017

Fix was merged

@rnveach rnveach closed this Sep 15, 2017

@rnveach rnveach added this to the 8.3 milestone Sep 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment