@@ -126,20 +126,25 @@ private String parseTopLevel(boolean stopAtQuote, boolean parseMetadata) {
126126 }
127127
128128 private Optional <String > parseItem () {
129- if (nextChar () != '@' ) return Optional .empty ();
130- if (nextChar () != '(' ) return Optional .empty ();
129+ if (nextChar () != '@' || nextChar () != '(' ) {
130+ return Optional .empty ();
131+ }
131132
132133 skipWhitespace ();
133134 Optional <String > ident = parseIdentifier ();
134- if (ident .isEmpty ()) return Optional .empty ();
135+ if (ident .isEmpty ()) {
136+ return Optional .empty ();
137+ }
135138 skipWhitespace ();
136139
137140 Function <MSBuildItem , String > transform = MSBuildItem ::getIdentity ;
138141 String separator = ";" ;
139142
140143 if (peekChar () == '-' ) {
141144 var maybeTransform = parseItemTransform ();
142- if (maybeTransform .isEmpty ()) return Optional .empty ();
145+ if (maybeTransform .isEmpty ()) {
146+ return Optional .empty ();
147+ }
143148 transform = maybeTransform .get ();
144149
145150 skipWhitespace ();
@@ -154,12 +159,16 @@ private Optional<String> parseItem() {
154159 nextChar ();
155160 skipWhitespace ();
156161 var maybeSeparator = parseSimpleString ();
157- if (maybeSeparator .isEmpty ()) return Optional .empty ();
162+ if (maybeSeparator .isEmpty ()) {
163+ return Optional .empty ();
164+ }
158165 separator = maybeSeparator .get ();
159166 skipWhitespace ();
160167 }
161168
162- if (nextChar () != ')' ) return Optional .empty ();
169+ if (nextChar () != ')' ) {
170+ return Optional .empty ();
171+ }
163172
164173 return Optional .of (concatItems (ident .get (), transform , separator ));
165174 }
@@ -170,8 +179,9 @@ private String concatItems(
170179 }
171180
172181 private Optional <Function <MSBuildItem , String >> parseItemTransform () {
173- if (nextChar () != '-' ) return Optional .empty ();
174- if (nextChar () != '>' ) return Optional .empty ();
182+ if (nextChar () != '-' || nextChar () != '>' ) {
183+ return Optional .empty ();
184+ }
175185
176186 return parseItemTransformExpression ();
177187 }
@@ -182,9 +192,15 @@ private Optional<Function<MSBuildItem, String>> parseItemTransformExpression() {
182192 return Optional .empty ();
183193 }
184194
185- if (nextChar () != '\'' ) return Optional .empty ();
195+ if (nextChar () != '\'' ) {
196+ return Optional .empty ();
197+ }
198+
186199 String expression = parseTopLevel (true , false );
187- if (nextChar () != '\'' ) return Optional .empty ();
200+
201+ if (nextChar () != '\'' ) {
202+ return Optional .empty ();
203+ }
188204
189205 return Optional .of (item -> expandMetadataValues (item , expression ));
190206 }
@@ -196,8 +212,10 @@ private String expandMetadataValues(MSBuildItem item, String expression) {
196212 }
197213
198214 private Optional <String > parseProperty () {
199- if (nextChar () != '$' ) return Optional .empty ();
200- if (nextChar () != '(' ) return Optional .empty ();
215+ if (nextChar () != '$' || nextChar () != '(' ) {
216+ return Optional .empty ();
217+ }
218+
201219 if (peekChar () == '[' ) {
202220 unsupportedFeature ("static property function" );
203221 return Optional .empty ();
@@ -215,7 +233,9 @@ private Optional<String> parseProperty() {
215233 }
216234
217235 discard = skipWhitespace () || discard ;
218- if (nextChar () != ')' ) return Optional .empty ();
236+ if (nextChar () != ')' ) {
237+ return Optional .empty ();
238+ }
219239
220240 if (discard ) {
221241 // Whitespace is significant inside property expressions, but it's impossible to
@@ -227,16 +247,21 @@ private Optional<String> parseProperty() {
227247 }
228248
229249 private Optional <String > parseMetadata () {
230- if (nextChar () != '%' ) return Optional .empty ();
231- if (nextChar () != '(' ) return Optional .empty ();
250+ if (nextChar () != '%' || nextChar () != '(' ) {
251+ return Optional .empty ();
252+ }
232253
233254 var discard = skipWhitespace ();
234255 Optional <String > ident = parseIdentifier ();
235- if (ident .isEmpty ()) return Optional .empty ();
256+ if (ident .isEmpty ()) {
257+ return Optional .empty ();
258+ }
236259
237260 discard = skipWhitespace () || discard ;
238261
239- if (nextChar () != ')' ) return Optional .empty ();
262+ if (nextChar () != ')' ) {
263+ return Optional .empty ();
264+ }
240265
241266 if (discard ) {
242267 // Whitespace is significant inside metadata expressions, but it's impossible to
@@ -258,7 +283,9 @@ private static boolean isSimpleStringChar(char character) {
258283 }
259284
260285 private Optional <String > parseSimpleString () {
261- if (nextChar () != '\'' ) return Optional .empty ();
286+ if (nextChar () != '\'' ) {
287+ return Optional .empty ();
288+ }
262289
263290 StringBuilder builder = new StringBuilder ();
264291
@@ -271,7 +298,9 @@ private Optional<String> parseSimpleString() {
271298 }
272299
273300 private Optional <String > parseIdentifier () {
274- if (!isSimpleStringStart (peekChar ())) return Optional .empty ();
301+ if (!isSimpleStringStart (peekChar ())) {
302+ return Optional .empty ();
303+ }
275304
276305 StringBuilder builder = new StringBuilder ();
277306
0 commit comments