Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add checkstyle#3229

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MysterAitch wants to merge16 commits intojavaparser:master
base:master
Choose a base branch
Loading
fromMysterAitch:add_checkstyle
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
7493fe3
added checkstyle and the base sun configuration, with suppressions of…
MysterAitchApr 11, 2021
5c01268
handle avoid star imports
MysterAitchApr 11, 2021
8483666
solving checkstyle errors/warnings
MysterAitchApr 11, 2021
7825394
solving checkstyle errors/warnings
MysterAitchApr 11, 2021
2f51da7
handling checkstyle errors/warnings
MysterAitchApr 13, 2021
29f503b
Merge branch 'master' of github.com:javaparser/javaparser into checks…
MysterAitchApr 13, 2021
5f782b5
adjust checkstyle to process javadoc when checking for unused imports
MysterAitchApr 13, 2021
11bfc99
checkstyle imports
MysterAitchApr 14, 2021
4622822
checkstyle edit
MysterAitchApr 14, 2021
f9a9456
run generators
MysterAitchApr 14, 2021
1b3bafe
edited checkstyle suppressions to allow for edits made by the generators
MysterAitchApr 14, 2021
83d6551
reduce the number of issues flagged by HiddenField, but unable to do …
MysterAitchApr 14, 2021
37aba49
consistent operator wrap position
MysterAitchApr 14, 2021
d7e060c
adjust suppressions to be more precise
MysterAitchApr 14, 2021
c8d4560
javadoc for public variables -- adding it in, else adding a suppression
MysterAitchApr 15, 2021
44d21ee
update comments
MysterAitchApr 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
javadoc for public variables -- adding it in, else adding a suppression
  • Loading branch information
@MysterAitch
MysterAitch committedApr 15, 2021
commitc8d4560786354d990f40f48d59aebb515a3b5607
31 changes: 30 additions & 1 deletioncheckstyle-suppressions.xml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@
<suppress checks="JavadocPackage"/>
<suppress checks="JavadocStyle"/>
<suppress checks="JavadocType"/>
<suppress checks="JavadocVariable"/>
<!--<suppress checks="JavadocVariable"/>-->
<suppress checks="LineLength"/>
<suppress checks="MagicNumber"/>
<suppress checks="NeedBraces"/>
Expand DownExpand Up@@ -119,6 +119,33 @@
<!-- MetaModel classes have imports added/removed, therefore we tolerate unsorted imports -->
<suppress checks="CustomImportOrder" files=".*MetaModel.java"/>

<!-- MetaModel classes have public mutable attributes (instead of using accessor/mutator methods) -->
<suppress checks="JavadocVariable" files=".*MetaModel.java"/>

<!-- These classes contain generated public enum values, therefore lack of documents is tolerated -->
<suppress checks="JavadocVariable" files="ObservableProperty.java"/>
<suppress checks="JavadocVariable" files="JavaToken.java"/>

<!-- These classes contain .... public enum values, therefore lack of documents is tolerated -->
<suppress checks="JavadocVariable" files="AccessSpecifier.java"/>
<suppress checks="JavadocVariable" files="AssignExpr.java"/>
<suppress checks="JavadocVariable" files="BinaryExpr.java"/>
<suppress checks="JavadocVariable" files="UnaryExpr.java"/>
<suppress checks="JavadocVariable" files="Modifier.java"/>
<suppress checks="JavadocVariable" files="PrimitiveType.java"/>
<suppress checks="JavadocVariable" files="JavadocInlineTag.java"/>
<suppress checks="JavadocVariable" files="JavadocBlockTag.java"/>
<suppress checks="JavadocVariable" files="CsmConditional.java"/>
<suppress checks="JavadocVariable" files="ResolvedPrimitiveType.java"/>
<suppress checks="JavadocVariable" files="Node.java"/>
<suppress checks="JavadocVariable" files="NameCategory.java"/>

<!-- This clas is part of the serialisation module, therefore lack of documents is tolerated -->
<suppress checks="JavadocVariable" files="JavaParserJsonSerializer.java"/>

<!-- These classes contain .... public static final fields, therefore lack of documents is tolerated -->
<suppress checks="JavadocVariable" files="ParseStart.java"/>

<!-- These classes have a generated switch element, which does not include compliant whitespace -->
<suppress checks="WhitespaceAround" files="AssignExpr.java"/>
<suppress checks="WhitespaceAround" files="BinaryExpr.java"/>
Expand All@@ -129,4 +156,6 @@
<suppress checks="RegexpSingleline" files="MethodCallExpr.java"/>
<suppress checks="RegexpSingleline" files="JavaToken.java"/>

<!-- These classes contain .... public enum values, therefore lack of documents is tolerated -->

</suppressions>
5 changes: 4 additions & 1 deletioncheckstyle.xml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -101,7 +101,10 @@
<module name="InvalidJavadocPosition"/>
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocVariable">
<!-- Edit: JP Deviation from Sun style -->
<property name="scope" value="public"/>
</module>
<module name="JavadocStyle"/>
<module name="MissingJavadocMethod"/>

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,10 @@ public class NodeMetaModelGenerator extends AbstractGenerator {
private final InitializePropertyMetaModelsStatementsGenerator initializePropertyMetaModelsStatementsGenerator = new InitializePropertyMetaModelsStatementsGenerator();
private final InitializeConstructorParametersStatementsGenerator initializeConstructorParametersStatementsGenerator = new InitializeConstructorParametersStatementsGenerator();

/**
* A comment to be added at the top of metamodel classes.
* This comment is to indicate the class should not be edited directly.
*/
public static final String GENERATED_CLASS_COMMENT = "" +
"This file, class, and its contents are completely generated based on:" +
"\n<ul>" +
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,17 @@
* A position in a source file. Lines and columns start counting at 1.
*/
public class Position implements Comparable<Position> {

/**
* The line that this position points at.
* Note that this is not zero-indexed (i.e. the first line is line 1, not 0 - see also {@link #FIRST_LINE}).
*/
public final int line;

/**
* The column that this position points at.
* Note that this is not zero-indexed (i.e. the first column is line 1, not 0 - see also {@link #FIRST_COLUMN}).
*/
public final int column;

/**
Expand All@@ -47,10 +57,15 @@ public class Position implements Comparable<Position> {


/**
* Line numbers must be positive, thus
* This special value represents the first line in the file.
* Line numbers must be positive, thus we can use negative numbers to represent special values.
*/
public static final int ABSOLUTE_BEGIN_LINE = -1;

/**
* This special value represents the last line in the file.
* Line numbers must be positive, thus we can use negative numbers to represent special values.
*/
public static final int ABSOLUTE_END_LINE = -2;


Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,17 +28,20 @@
import java.io.InputStream;
import java.io.Reader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

import static com.github.javaparser.utils.Utils.assertNotNull;

/**
* Factory for providers of source code for JavaParser. Providers that have no parameter for encoding but need it will
* use UTF-8.
* Factory for providers of source code for JavaParser.
*Providers that have no parameter for encoding but need it willuse UTF-8.
*/
public final class Providers {
public static final Charset UTF8 = Charset.forName("utf-8");

/** The Charset to use when processing a given file/string - specifically UTF-8. */
public static final Charset UTF8 = StandardCharsets.UTF_8;

private Providers() {
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,11 @@
* A range of characters in a source file, from "begin" to "end", including the characters at "begin" and "end".
*/
public class Range {

/** The start position of this range. This must be before the {@link #end} position. */
public final Position begin;

/** The start position of this range. This must be after the {@link #begin} position. */
public final Position end;

/**
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,8 @@
* The range of tokens covered by this node.
*/
public class TokenRange implements Iterable<JavaToken> {

/** A null-object, representing an invalid token range. */
public static final TokenRange INVALID = new TokenRange(JavaToken.INVALID, JavaToken.INVALID);

private final JavaToken begin;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -825,10 +825,10 @@ private Iterator<Node> treeIterator(TreeTraversal traversal) {
return new PostOrderIterator(this);
case PREORDER:
return new PreOrderIterator(this);
case DIRECT_CHILDREN:
return new DirectChildrenIterator(this);
case PARENTS:
return new ParentsVisitor(this);
case DIRECT_CHILDREN:
return new DirectChildrenIterator(this);
default:
throw new IllegalArgumentException("Unknown traversal choice.");
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,8 +48,20 @@
*/
public class IntegerLiteralExpr extends LiteralStringValueExpr {

/**
* Note that negative numbers are represented within JavaParser as the negative sign and an
* unsigned number. Where {@code Integer.MIN_VALUE} is found, the absolute value cannot be
* represented as an {@code Integer}, instead a workarounds are required.
* See {@link #asNumber()} for additional detail.
*/
public static final String MAX_31_BIT_UNSIGNED_VALUE_AS_STRING = "2147483648";

/**
* Note that negative numbers are represented within JavaParser as the negative sign and an
* unsigned number. Where {@code Integer.MIN_VALUE} is found, the absolute value cannot be
* represented as an {@code Integer}, instead a workarounds are required.
* See {@link #asNumber()} for additional detail.
*/
public static final long MAX_31_BIT_UNSIGNED_VALUE_AS_LONG = 2147483648L;

public IntegerLiteralExpr() {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,8 +50,20 @@
*/
public class LongLiteralExpr extends LiteralStringValueExpr {

/**
* Note that negative numbers are represented within JavaParser as the negative sign and an
* unsigned number. Where {@code Long.MIN_VALUE} is found, the absolute value cannot be
* represented as an {@code Long}, instead a workarounds are required.
* See {@link #asNumber()} for additional detail.
*/
public static final String MAX_63_BIT_UNSIGNED_VALUE_AS_STRING = "9223372036854775808L";

/**
* Note that negative numbers are represented within JavaParser as the negative sign and an
* unsigned number. Where {@code Long.MIN_VALUE} is found, the absolute value cannot be
* represented as an {@code Long}, instead a workarounds are required.
* See {@link #asNumber()} for additional detail.
*/
public static final BigInteger MAX_63_BIT_UNSIGNED_VALUE_AS_BIG_INTEGER = new BigInteger("9223372036854775808");

public LongLiteralExpr() {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,9 +83,29 @@
*/
public class SwitchEntry extends Node implements NodeWithStatements<SwitchEntry> {

/**
* There are multiple "types" of entry within a switch.
* The grammar for these different entry types are specified within the grammar (JLS 14.11).
* @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.11">14.11.1. Switch Blocks</a>
*/
public enum Type {

STATEMENT_GROUP, EXPRESSION, BLOCK, THROWS_STATEMENT
/**
* @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.11">14.11.1. Switch Blocks</a>
*/
STATEMENT_GROUP,
/**
* @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-15.2">15.2. Forms of Expressions</a>
*/
EXPRESSION,
/**
* @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.2">14.2. Blocks</a>
*/
BLOCK,
/**
* @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.18">14.18. The throw Statement</a>
*/
THROWS_STATEMENT
}

private NodeList<Expression> labels;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@

import com.github.javaparser.printer.Printer;
import com.github.javaparser.printer.configuration.Indentation.IndentType;
import com.github.javaparser.utils.Utils;
import com.github.javaparser.utils.LineSeparator;

import java.util.Arrays;
import java.util.HashSet;
Expand All@@ -47,18 +47,38 @@ public enum ConfigOption {
* Print javadoc comments only. It can be combined with {@code PRINT_COMMENTS} to print regular javadoc and comments
*/
PRINT_JAVADOC(Boolean.class),
/**
* Whether to include space around operators - e.g. {@code 1+2} when {@code false} vs {@code 1 + 2} when {@code true}.
*/
SPACE_AROUND_OPERATORS(Boolean.class),
/**
* When true, indent wrapped parameters. For example:
* <pre>{@code
* public void foo(String a,
* String b,
* String c) {}
* }<pre>
* TODO: Confirm this description and example.
*/
COLUMN_ALIGN_PARAMETERS(Boolean.class),
/**
* When true, indent wrapped method calls. For example:
* <pre>{@code
* foo.bar()
* .baz();
* }<pre>
* TODO: Confirm this description and example.
*/
COLUMN_ALIGN_FIRST_METHOD_CHAIN(Boolean.class),
/**
* Indent the case when it is true, don't if false
* <pre>{@code
* switch(x) { switch(x) {
* case 1: case 1:
* return y; return y;
* case 2: case 2:
* return z; return x;
* } }
*switch(x) { | switch(x) {
*case 1: | case 1:
*return y; | return y;
*case 2: | case 2:
*return z; | return x;
*} | }
* }<pre>
*/
INDENT_CASE_IN_SWITCH(Boolean.class),
Expand DownExpand Up@@ -86,7 +106,12 @@ public enum ConfigOption {
* Set it to 1 or less to always align vertically.
*/
MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY(Integer.class, Integer.valueOf(5)),
END_OF_LINE_CHARACTER(String.class, Utils.SYSTEM_EOL),
/**
* The character(s) to use when inserting a newline. Defaults to the system's EOL character.
* Options typically include {@code \r} (MacOS), {@code \n} (Linux), {@code \r\n} (Windows).
* TODO: Use LineSeparator directly, rather than a String.
*/
END_OF_LINE_CHARACTER(String.class, LineSeparator.SYSTEM.asRawString()),
/**
* Indentation proprerty
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@
*/
public class Difference {

/** How wide should the indentation be. Defaults to 4 columns. TODO: Confirm columns vs characters. */
public static final int STANDARD_INDENTATION_SIZE = 4;

private final NodeText nodeText;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,10 @@
public interface ResolvedReferenceTypeDeclaration extends ResolvedTypeDeclaration,
ResolvedTypeParametrizable {

/** A utility reference to the fully qualified, canonical, name. */
String JAVA_LANG_ENUM = java.lang.Enum.class.getCanonicalName();

/** A utility reference to the fully qualified, canonical, name. */
String JAVA_LANG_OBJECT = java.lang.Object.class.getCanonicalName();

@Override
Expand DownExpand Up@@ -115,7 +118,7 @@ default List<ResolvedReferenceType> getAllAncestors(Function<ResolvedReferenceTy
return traverser.apply(this);
}

/*
/**
* depth first search all ancestors
* In the example above, this method returns B,C,E,D
*/
Expand All@@ -135,7 +138,7 @@ default List<ResolvedReferenceType> getAllAncestors(Function<ResolvedReferenceTy
return ancestors;
};

/*
/**
* breadth first search all all ancestors
* In the example above, this method returns B,C,D,E
*/
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@
*/
public class ResolvedVoidType implements ResolvedType {

/** Singleton pattern - the single, static, instance of ResolvedVoidType. */
public static final ResolvedType INSTANCE = new ResolvedVoidType();

private ResolvedVoidType() {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,6 +37,7 @@
*/
public class ResolvedWildcard implements ResolvedType {

/** A null-object representing an unbounded wildcard bound - specifically {@code ?), e.g. {@code List<?>}. */
public static final ResolvedWildcard UNBOUNDED = new ResolvedWildcard(null, null);

private BoundType type;
Expand DownExpand Up@@ -176,7 +177,9 @@ public boolean isLowerBounded() {
}

public enum BoundType {
/** A {@code super} bound type, representing a lower bound (e.g. {@code ? super Number}). */
SUPER,
/** An {@code extends} bound type, representing a upper bound (e.g. {@code ? extends Number}). */
EXTENDS
}

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,11 @@
* @param <B> type of object b.
*/
public class Pair<A, B> {

/** One of the pair items. */
public final A a;

/** One of the pair items. */
public final B b;

public Pair(A a, B b) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@
*/
public interface TypeSolver {

String JAVA_LANG_OBJECT = Object.class.getCanonicalName();

/**
* Get the root of the hierarchy of type solver.
Expand DownExpand Up@@ -77,7 +76,7 @@ default ResolvedReferenceTypeDeclaration solveType(String name) throws UnsolvedS
* @return A resolved reference to {@code java.lang.Object}
*/
default ResolvedReferenceTypeDeclaration getSolvedJavaLangObject() throws UnsolvedSymbolException {
return solveType(JAVA_LANG_OBJECT);
return solveType(ResolvedReferenceTypeDeclaration.JAVA_LANG_OBJECT);
}

default boolean hasType(String name) {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp