Skip to content

Commit 1e43d4f

Browse files
authored
Remove some exclusions from generated Java files so that they're cleaned up after regeneration (reformatted). (#15393)
1 parent c85c69f commit 1e43d4f

File tree

24 files changed

+7831
-7671
lines changed

24 files changed

+7831
-7671
lines changed

build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/spotless/GoogleJavaFormatPlugin.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,40 +96,10 @@ public void apply(Project project) {
9696

9797
private void configureExclusions(Project project, ConfigurableFileTree ftree) {
9898
switch (project.getPath()) {
99-
case ":lucene:core":
100-
ftree.exclude("**/StandardTokenizerImpl.java");
101-
break;
102-
10399
case ":lucene:analysis:common":
100+
// These two cause stack overflow errors in google java format. Just leave them.
104101
ftree.exclude("**/HTMLStripCharFilter.java", "**/UAX29URLEmailTokenizerImpl.java");
105102
break;
106-
107-
case ":lucene:test-framework":
108-
ftree.exclude(
109-
"**/EmojiTokenizationTestUnicode_11_0.java", "**/WordBreakTestUnicode_9_0_0.java");
110-
break;
111-
112-
case ":lucene:queryparser":
113-
ftree.exclude(
114-
"**/classic/ParseException.java",
115-
"**/classic/QueryParser.java",
116-
"**/classic/QueryParserConstants.java",
117-
"**/classic/QueryParserTokenManager.java",
118-
"**/classic/Token.java",
119-
"**/classic/TokenMgrError.java",
120-
"**/standard/parser/ParseException.java",
121-
"**/standard/parser/StandardSyntaxParser.java",
122-
"**/standard/parser/StandardSyntaxParserConstants.java",
123-
"**/standard/parser/StandardSyntaxParserTokenManager.java",
124-
"**/standard/parser/Token.java",
125-
"**/standard/parser/TokenMgrError.java",
126-
"**/surround/parser/ParseException.java",
127-
"**/surround/parser/QueryParser.java",
128-
"**/surround/parser/QueryParserConstants.java",
129-
"**/surround/parser/QueryParserTokenManager.java",
130-
"**/surround/parser/Token.java",
131-
"**/surround/parser/TokenMgrError.java");
132-
break;
133103
}
134104
}
135105
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"gradle/regenerate/jflex/skeleton.disable.buffer.expansion.txt": "6e43a3a64a9b5eb82ec5b4bc21f95aff5a2a061e",
3-
"lucene/core/src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.java": "f4d6311e03a97cb55301cfa55fab3338b1fdb725",
3+
"lucene/core/src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.java": "fc9832cd753927f00fdc1abb1639654cd049e9ff",
44
"lucene/core/src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.jflex": "6dd5ea9741b13281378be5680fdcc2bc2aef3aec"
55
}

lucene/core/src/java/org/apache/lucene/analysis/standard/StandardTokenizerImpl.java

Lines changed: 564 additions & 591 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java": "7a8a8fd5b2ea78f9a17f54cbae8b0e4496e8988e",
3-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java": "2dfb7df4e711425be20c33a277a27d7e2972def1",
2+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java": "d4f22934f0f8eb7ae70f47339cf04cac297a044b",
3+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java": "b88944c9c1ac6a3e6e8508a0c5ae84aad3306694",
44
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj": "82890f966a2456daf2b6100d3d79f77a861a2e03",
5-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserConstants.java": "e59a3fd38b66a3d56779c55955c1e014225a1f50",
6-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserTokenManager.java": "f5eb2a03a65caecff718b234d29390800c3e9be2",
7-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java": "310665ba37d982327fcb55cc3523d629ef29ef54",
8-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java": "31afe7034729960514f50fdc3c9b33e0def44f1d"
5+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserConstants.java": "80d2d516553d87539dce33f732e774a67fb800ea",
6+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserTokenManager.java": "1263b08f33f1b5e8642f4733ea830b3b03628942",
7+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java": "5748b8acdf890eb94fa39c9d7ac86fc35e688438",
8+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java": "a0082ca9014c48ede4c5aa4b84aa3c114ed8000a"
99
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java": "c1b095461818be6bf073ca12c383bf7c06443b7e",
3-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java": "55bd0228665fc67e6310558eb45c32ed1e20c32d",
2+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java": "cbdf1aa67b982cb79db23dd0498ad80d60107d64",
3+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java": "8733ffc409ccbd8991fe5a2f7c179d2d4474d09f",
44
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj": "cbcfc2d93dd684ab31e7824210cd167be210bce3",
5-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java": "d5e76f5f5522ae4b758d5c2f12e496fe182ae1f2",
6-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java": "49df9bdd3ca4a5f64aa5e3a9f1751e0bae637f03",
7-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java": "d4603a7c273e0ef5e9c8890552779e40864185f4",
8-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java": "d474a0039c288e5e7dfa0a0e22e16e0e0fdaeaab"
5+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java": "d779299b01504a1900a82fce172ced993bb867c2",
6+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java": "39f107d1aefe3ad2d953e4d3c49bd392a4d82a50",
7+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java": "8147fbc071eb833c04ab2baa6161f91245f39ad8",
8+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java": "7ffe1903324d6b016e3f83fbdf2ab10e4e866e91"
99
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java": "d8b3e605b4bfb01697df5ce246e84fa2b691fb4f",
3-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java": "b6fc4a6567f497c60c26f752db7f229dd6504cd7",
2+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java": "2224fb9524be521d47488d49b137dd2acec065e8",
3+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java": "394e02d5928b980973e58b1a8acc6b5461a2719e",
44
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.jj": "b81635f8de654757290d99911adece916afe369a",
5-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserConstants.java": "8feb77878890c27e874be457d839eba48192c40f",
6-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.java": "fcd1afca116eb6fa411d171e0b8a3c8729db1e0c",
7-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java": "a5eea2a3043e0aa2781f4a43b9ab9c5d59add80e",
8-
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java": "ee5fbd796ed8bd1c6e1a4b9e3d894f391da36236"
5+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserConstants.java": "e329bce57db896ffe9e4b30ea787e8221ea610b1",
6+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.java": "ca1ab7c0d7c8c5171d851cbcfe1c7d705c9c7ccc",
7+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java": "6b9b713e674e44485dd1ad3575e51a1a28060f01",
8+
"lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java": "71d5ea8e9fd854673632d1bb03a85972e1a0ba3a"
99
}

lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java

Lines changed: 79 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,43 @@
33
package org.apache.lucene.queryparser.classic;
44

55
/**
6-
* This exception is thrown when parse errors are encountered.
7-
* You can explicitly create objects of this exception type by
8-
* calling the method generateParseException in the generated
9-
* parser.
6+
* This exception is thrown when parse errors are encountered. You can explicitly create objects of
7+
* this exception type by calling the method generateParseException in the generated parser.
108
*
11-
* You can modify this class to customize your error reporting
12-
* mechanisms so long as you retain the public fields.
9+
* <p>You can modify this class to customize your error reporting mechanisms so long as you retain
10+
* the public fields.
1311
*/
1412
public class ParseException extends Exception {
1513

1614
/**
17-
* The version identifier for this Serializable class.
18-
* Increment only if the <i>serialized</i> form of the
19-
* class changes.
15+
* The version identifier for this Serializable class. Increment only if the <i>serialized</i>
16+
* form of the class changes.
2017
*/
2118
private static final long serialVersionUID = 1L;
2219

23-
/**
24-
* The end of line string for this machine.
25-
*/
20+
/** The end of line string for this machine. */
2621
protected static String EOL = System.getProperty("line.separator", "\n");
2722

2823
/**
29-
* This constructor is used by the method "generateParseException"
30-
* in the generated parser. Calling this constructor generates
31-
* a new object of this type with the fields "currentToken",
24+
* This constructor is used by the method "generateParseException" in the generated parser.
25+
* Calling this constructor generates a new object of this type with the fields "currentToken",
3226
* "expectedTokenSequences", and "tokenImage" set.
3327
*/
34-
public ParseException(Token currentTokenVal,
35-
int[][] expectedTokenSequencesVal,
36-
String[] tokenImageVal
37-
)
38-
{
28+
public ParseException(
29+
Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
3930
super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
4031
currentToken = currentTokenVal;
4132
expectedTokenSequences = expectedTokenSequencesVal;
4233
tokenImage = tokenImageVal;
4334
}
4435

4536
/**
46-
* The following constructors are for use by you for whatever
47-
* purpose you can think of. Constructing the exception in this
48-
* manner makes the exception behave in the normal way - i.e., as
49-
* documented in the class "Throwable". The fields "errorToken",
50-
* "expectedTokenSequences", and "tokenImage" do not contain
51-
* relevant information. The JavaCC generated code does not use
52-
* these constructors.
37+
* The following constructors are for use by you for whatever purpose you can think of.
38+
* Constructing the exception in this manner makes the exception behave in the normal way - i.e.,
39+
* as documented in the class "Throwable". The fields "errorToken", "expectedTokenSequences", and
40+
* "tokenImage" do not contain relevant information. The JavaCC generated code does not use these
41+
* constructors.
5342
*/
54-
5543
public ParseException() {
5644
super();
5745
}
@@ -61,38 +49,31 @@ public ParseException(String message) {
6149
super(message);
6250
}
6351

64-
6552
/**
66-
* This is the last token that has been consumed successfully. If
67-
* this object has been created due to a parse error, the token
68-
* following this token will (therefore) be the first error token.
53+
* This is the last token that has been consumed successfully. If this object has been created due
54+
* to a parse error, the token following this token will (therefore) be the first error token.
6955
*/
7056
public Token currentToken;
7157

7258
/**
73-
* Each entry in this array is an array of integers. Each array
74-
* of integers represents a sequence of tokens (by their ordinal
75-
* values) that is expected at this point of the parse.
59+
* Each entry in this array is an array of integers. Each array of integers represents a sequence
60+
* of tokens (by their ordinal values) that is expected at this point of the parse.
7661
*/
7762
public int[][] expectedTokenSequences;
7863

7964
/**
80-
* This is a reference to the "tokenImage" array of the generated
81-
* parser within which the parse error occurred. This array is
82-
* defined in the generated ...Constants interface.
65+
* This is a reference to the "tokenImage" array of the generated parser within which the parse
66+
* error occurred. This array is defined in the generated ...Constants interface.
8367
*/
8468
public String[] tokenImage;
8569

8670
/**
87-
* It uses "currentToken" and "expectedTokenSequences" to generate a parse
88-
* error message and returns it. If this object has been created
89-
* due to a parse error, and you do not catch it (it gets thrown
90-
* from the parser) the correct error message
91-
* gets displayed.
71+
* It uses "currentToken" and "expectedTokenSequences" to generate a parse error message and
72+
* returns it. If this object has been created due to a parse error, and you do not catch it (it
73+
* gets thrown from the parser) the correct error message gets displayed.
9274
*/
93-
private static String initialise(Token currentToken,
94-
int[][] expectedTokenSequences,
95-
String[] tokenImage) {
75+
private static String initialise(
76+
Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) {
9677

9778
StringBuilder expected = new StringBuilder();
9879
int maxSize = 0;
@@ -123,73 +104,69 @@ private static String initialise(Token currentToken,
123104
tok = tok.next;
124105
}
125106
if (currentToken.next != null) {
126-
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
107+
retval +=
108+
"\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
127109
}
128110
retval += "." + EOL;
129-
130-
111+
131112
if (expectedTokenSequences.length == 0) {
132-
// Nothing to add here
113+
// Nothing to add here
133114
} else {
134-
if (expectedTokenSequences.length == 1) {
135-
retval += "Was expecting:" + EOL + " ";
136-
} else {
137-
retval += "Was expecting one of:" + EOL + " ";
138-
}
139-
retval += expected.toString();
115+
if (expectedTokenSequences.length == 1) {
116+
retval += "Was expecting:" + EOL + " ";
117+
} else {
118+
retval += "Was expecting one of:" + EOL + " ";
119+
}
120+
retval += expected.toString();
140121
}
141-
122+
142123
return retval;
143124
}
144125

145-
146126
/**
147-
* Used to convert raw characters to their escaped version
148-
* when these raw version cannot be used as part of an ASCII
149-
* string literal.
127+
* Used to convert raw characters to their escaped version when these raw version cannot be used
128+
* as part of an ASCII string literal.
150129
*/
151130
static String add_escapes(String str) {
152-
StringBuilder retval = new StringBuilder();
153-
char ch;
154-
for (int i = 0; i < str.length(); i++) {
155-
switch (str.charAt(i))
156-
{
157-
case '\b':
158-
retval.append("\\b");
159-
continue;
160-
case '\t':
161-
retval.append("\\t");
162-
continue;
163-
case '\n':
164-
retval.append("\\n");
165-
continue;
166-
case '\f':
167-
retval.append("\\f");
168-
continue;
169-
case '\r':
170-
retval.append("\\r");
171-
continue;
172-
case '\"':
173-
retval.append("\\\"");
174-
continue;
175-
case '\'':
176-
retval.append("\\\'");
177-
continue;
178-
case '\\':
179-
retval.append("\\\\");
180-
continue;
181-
default:
182-
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
183-
String s = "0000" + Integer.toString(ch, 16);
184-
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
185-
} else {
186-
retval.append(ch);
187-
}
188-
continue;
189-
}
131+
StringBuilder retval = new StringBuilder();
132+
char ch;
133+
for (int i = 0; i < str.length(); i++) {
134+
switch (str.charAt(i)) {
135+
case '\b':
136+
retval.append("\\b");
137+
continue;
138+
case '\t':
139+
retval.append("\\t");
140+
continue;
141+
case '\n':
142+
retval.append("\\n");
143+
continue;
144+
case '\f':
145+
retval.append("\\f");
146+
continue;
147+
case '\r':
148+
retval.append("\\r");
149+
continue;
150+
case '\"':
151+
retval.append("\\\"");
152+
continue;
153+
case '\'':
154+
retval.append("\\\'");
155+
continue;
156+
case '\\':
157+
retval.append("\\\\");
158+
continue;
159+
default:
160+
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
161+
String s = "0000" + Integer.toString(ch, 16);
162+
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
163+
} else {
164+
retval.append(ch);
165+
}
166+
continue;
190167
}
191-
return retval.toString();
192-
}
193-
168+
}
169+
return retval.toString();
170+
}
194171
}
195172
/* (filtered)*/

0 commit comments

Comments
 (0)