Skip to content

Commit 1b38431

Browse files
jfancheranthonyvdotbecushonbenmccanncgrushko
authored
Sync upstream changes. (#3)
* Update outdated Javadoc links Fixes google#409 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=286092096 * Fix a crash on c-style arrays in parameters Fixes google#374 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=286467734 * Add SBT plugin to readme Fixes google#391 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=286493206 * annotation/parameterless annotation Parameterless annotations aren't necessarily marker annotations. All we can tell about a use of an annotation is that it's parameterless, and that's how 4.8.5 is specified. Related: google#360 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=286650854 * Tell maven-javadoc-plugin to target JDK 8 This unbreaks `mvn install` on AdoptOpenJDK 11. Presumably it unbreaks on all JDKs >= 11. Fixes google#429 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=288016119 * Remove trailing tabs from comments to make behavior idempotent. Fixes google#422, fixes google#423 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=288364171 * Migrate from JSR-305 to the Checker Framework annotations this is tangentially related to Java 11 preparedness. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=300822964 * Add Java 11 regression tests ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=301273002 * Use the built-in JDK 11 javac instead of relying on the shaded/vendored version. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=301645476 * Increase minimum required JDK version to 11 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=301832060 * Use the default / latest supported language level Previously the shaded javac was defaulting to Java 8, which we needed to override to support Java 9. Now that we're using stock JDK 11 this is unnecessary. Also explicitly support `var`, instead of relying on it getting parsed as an actual type name. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=302105420 * Preserve tabular arguments for mixed sign numeric lists. Treats unary minus literals (eg -4.0) as their underlying type when checking if all elements in a tabular list are of the same Tree.Kind. Fixes google#400, google#406 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=303137504 * Add initial support for Java 14 language features ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=303367644 * Make re-parsing of var more robust to support uses of `var` as an identifier, with and without a type, e.g. in `var -> { ... }` and `int var x = 42`; and uses of `var ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=307693554 * Update the open-source google-java-format plugin for 2020.1. I couldn't find any good way to make this backwards compatible. Oh well. FYI, It looks like in 2020.1, we can probably actually use the ExternalFormatProcessor extension point instead of doing all this hacky nonsense... they added a #format(PsiFile, TextRange) method you can override. But I'll leave that for later because 2020.1 is out now and people are mad. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=308647308 * Fix formatting of records without an explicit constructor Fixes google#460 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=308658958 * Support `var` in enhanced for loops Fixes google#463 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=308891540 * Minor Javadoc improvement. PiperOrigin-RevId: 309329483 * Fix javadoc syntax Fix javadoc syntax by wrap `<` into an inline code block. ``` [WARNING] ...\google-java-format\core\src\main\java\com\google\googlejavaformat\java\JavaInputAstVisitor.java:2577: warning - invalid usage of tag < ``` Fixes google#454 COPYBARA_INTEGRATE_REVIEW=google#454 from sormuras:patch-1 f5583c7 PiperOrigin-RevId: 309364827 * Pre-release javadoc fixes PiperOrigin-RevId: 309456095 * Increment versions for 1.8 release PiperOrigin-RevId: 309467646 * Fix a crash in expression switches `throws` statements are allows to occur in non-block expression switch cases, which was causing the trailing `;` to be printed twice. Fixes google#477 PiperOrigin-RevId: 310974906 * Split up the string "M" + "OE:(begin|end)_intracomment_stripping," as the full string will trigger stripping under Copybara. Also, avoid reference to an internal link shortener, as we are making references to it an error. Looking to the future: When we migrate to use proper Copybara stripping directives, we could consider removing support for the old directives. Then the problem would mostly go away. However, we might end up having the same problem with Copybara directives when google-java-format's strings and method names start mentioning *them*. PiperOrigin-RevId: 311344956 * Addition of a third party: Github Actions - Add the possibility of formatting your code from Github directly (taking all the events of Github Actions) - Addition of the word "old" for the eclipse plugin, since it is 1.6 release Fixes google#487 COPYBARA_INTEGRATE_REVIEW=google#487 from av1m:master 351b737 PiperOrigin-RevId: 313312689 * Java 14 integration tests PiperOrigin-RevId: 314566781 * Add support for yield statement Implement visitYield. Fixes google#489 from ntkoopman:yield b46d1f0 COPYBARA_INTEGRATE_REVIEW=google#489 PiperOrigin-RevId: 314633394 * Support --skip-removing-unused-imports in google-java-format-diff.py Fixes google#495 COPYBARA_INTEGRATE_REVIEW=google#495 from taesu82:patch-1 91e32d4 PiperOrigin-RevId: 315560436 * Update the IDEA plugin to use google-java-format 1.8. PiperOrigin-RevId: 318495968 * Add missing license headers. PiperOrigin-RevId: 320733285 * Disable Appveyor builds on branches. Our account for Appveyor allows only 1 concurrent build. Our current Appveyor config builds every commit to a PR twice -- once as the PR and once as the branch. This CL updates our Appveyor config to disable builds on branches, so we get only one build per PR commit. PiperOrigin-RevId: 320734870 * Fix the google-java-format IDEA plugin for 2020.2 IDEs. PiperOrigin-RevId: 320945302 * Update links to Spotless' new documentation layout Also included the Spotless maven plugin (2+ years old, but not well marketed) Fixes google#509 COPYBARA_INTEGRATE_REVIEW=google#509 from nedtwigg:patch-2 546c758 PiperOrigin-RevId: 322832707 * Bump versions to 1.9 PiperOrigin-RevId: 328160170 * Increment versions after 1.10 release PiperOrigin-RevId: 328214914 * Bump checker-qual from 2.0.0 to 3.6.1 Fixes google#519 COPYBARA_INTEGRATE_REVIEW=google#519 from mernst:checker-qual-361 ca54cb9 PiperOrigin-RevId: 331830590 * Update the IntelliJ plugin to google-java-format 1.9. PiperOrigin-RevId: 332323928 * Upgrade junit dependency to 4.13.1 PiperOrigin-RevId: 336966883 * Tolerate extra semi-colons in import lists even if they're own their own line (which g-j-f does if it runs with import cleanup disabled). PiperOrigin-RevId: 337192414 * Move import ordering tests out of the AOSP section follow-up to google@b769e81 PiperOrigin-RevId: 337511552 * Remove typo period in flags documentation. I *think* they are typoes? Apologies if this is intended. PiperOrigin-RevId: 343547804 * Introduce GitHub Actions based CI workflow This PR introduces a CI workflow using GitHub Actions and removes the Travis CI configuration file. Find new workflow runs for this PR here: https://github.com/sormuras/google-java-format/actions #### TODO - [x] Email [Notifications](https://docs.github.com/en/free-pro-team@latest/github/managing-subscriptions-and-notifications-on-github/configuring-notifications) -- register `[email protected]` as a watcher or let each interested use register themself? - [ ] Test publish snapshot job on `google:master` -- after storing credential [secrets](https://github.com/google/google-java-format/settings/secrets/actions). - [ ] Remove AppVeyor [integration](https://github.com/google/google-java-format/settings/installations) and delete `appveyor.yml` configuration file. Closes google#543 Fixes google#544 COPYBARA_INTEGRATE_REVIEW=google#544 from sormuras:github-action a689f62 PiperOrigin-RevId: 344280060 * Check build with JDK 16-ea Addresses google#538 (comment) Fixes google#548 COPYBARA_INTEGRATE_REVIEW=google#548 from sormuras:jdk-ea 0ee3f7c PiperOrigin-RevId: 344818484 * Fix GitHub Actions-based snapshot deployment Fixes google#547 PiperOrigin-RevId: 344903246 * Delete google-java-format appveyor and travis configs PiperOrigin-RevId: 345300707 * Miscellaneous cleanups Startblock: cl-status copybara contains unknown commit in live PiperOrigin-RevId: 345718768 * Prepare google-java-format for JDK 16 ea * Work around change to tokenization in JDK-8254073 * Access refactored expression pattern getters reflectively * Relax a check on a diagnostic whose position changed PiperOrigin-RevId: 347318664 Co-authored-by: Anthony Vanelverdinghe <[email protected]> Co-authored-by: cushon <[email protected]> Co-authored-by: Ben McCann <[email protected]> Co-authored-by: Carmi Grushko <[email protected]> Co-authored-by: Eckert, Alexander <[email protected]> Co-authored-by: Andrew Reid <[email protected]> Co-authored-by: plumpy <[email protected]> Co-authored-by: google-java-format Team <[email protected]> Co-authored-by: Christian Stein <[email protected]> Co-authored-by: cpovirk <[email protected]> Co-authored-by: Avi Mimoun <[email protected]> Co-authored-by: Tim Koopman <[email protected]> Co-authored-by: taesu82.lee <[email protected]> Co-authored-by: google-java-format Team <[email protected]> Co-authored-by: Eddie Aftandilian <[email protected]> Co-authored-by: Ned Twigg <[email protected]> Co-authored-by: Michael Ernst <[email protected]>
1 parent d1f6d89 commit 1b38431

File tree

85 files changed

+1374
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1374
-575
lines changed

.github/workflows/ci.yml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright 2020 The Error Prone Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: CI
16+
17+
on: [ push, pull_request ]
18+
19+
jobs:
20+
test:
21+
name: "JDK ${{ matrix.java }} on ${{ matrix.os }}"
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [ ubuntu-latest, macos-latest, windows-latest ]
26+
java: [ 15, 11 ]
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: 'Check out repository'
30+
uses: actions/checkout@v2
31+
- name: 'Cache local Maven repository'
32+
uses: actions/cache@v2
33+
with:
34+
path: ~/.m2/repository
35+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
36+
restore-keys: |
37+
${{ runner.os }}-maven-
38+
- name: 'Set up JDK ${{ matrix.java }}'
39+
uses: actions/setup-java@v1
40+
with:
41+
java-version: ${{ matrix.java }}
42+
- name: 'Install'
43+
shell: bash
44+
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
45+
- name: 'Test'
46+
shell: bash
47+
run: mvn test -B
48+
49+
early_access:
50+
name: 'JDK Early-Access'
51+
continue-on-error: true
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: 'Check out repository'
55+
uses: actions/checkout@v2
56+
- name: 'Cache local Maven repository'
57+
uses: actions/cache@v2
58+
with:
59+
path: ~/.m2/repository
60+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
61+
restore-keys: |
62+
${{ runner.os }}-maven-
63+
- name: 'Set up JDK ${{ matrix.java }}'
64+
uses: actions/setup-java@v1
65+
with:
66+
java-version: 16-ea
67+
- name: 'Install'
68+
shell: bash
69+
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
70+
- name: 'Test'
71+
shell: bash
72+
run: mvn test -B
73+
74+
publish_snapshot:
75+
name: 'Publish snapshot'
76+
needs: test
77+
if: github.event_name == 'push' && github.repository == 'google/google-java-format' && github.ref == 'refs/heads/master'
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: 'Check out repository'
81+
uses: actions/checkout@v2
82+
- name: 'Cache local Maven repository'
83+
uses: actions/cache@v2
84+
with:
85+
path: ~/.m2/repository
86+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
87+
restore-keys: |
88+
${{ runner.os }}-maven-
89+
- name: 'Set up JDK 15'
90+
uses: actions/setup-java@v1
91+
with:
92+
java-version: 15
93+
server-id: sonatype-nexus-snapshots
94+
server-username: CI_DEPLOY_USERNAME
95+
server-password: CI_DEPLOY_PASSWORD
96+
- name: 'Publish'
97+
env:
98+
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
99+
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
100+
run: mvn source:jar deploy -B -DskipTests=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true

.travis.yml

-44
This file was deleted.

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
and run it with:
1414

1515
```
16-
java -jar /path/to/google-java-format-1.7-all-deps.jar <options> [files...]
16+
java -jar /path/to/google-java-format-1.9-all-deps.jar <options> [files...]
1717
```
1818

1919
The formatter can act on whole files, on limited lines (`--lines`), on specific
@@ -55,7 +55,7 @@ and import it into File→Settings→Editor→Code Style.
5555

5656
### Eclipse
5757

58-
A
58+
Version 1.6 of the
5959
[google-java-format Eclipse plugin](https://github.com/google/google-java-format/releases/download/google-java-format-1.6/google-java-format-eclipse-plugin_1.6.0.jar)
6060
can be downloaded from the releases page. Drop it into the Eclipse
6161
[drop-ins folder](http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fp2_dropins_format.html)
@@ -68,17 +68,23 @@ Implementation`.
6868
### Third-party integrations
6969

7070
* Gradle plugins
71-
* [Spotless](https://github.com/diffplug/spotless/tree/master/plugin-gradle#applying-to-java-source-google-java-format):
71+
* [spotless](https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format)
7272
* [sherter/google-java-format-gradle-plugin](https://github.com/sherter/google-java-format-gradle-plugin)
7373
* Apache Maven plugins
74+
* [spotless](https://github.com/diffplug/spotless/tree/main/plugin-maven#google-java-format)
7475
* [coveo/fmt-maven-plugin](https://github.com/coveo/fmt-maven-plugin)
7576
* [talios/googleformatter-maven-plugin](https://github.com/talios/googleformatter-maven-plugin)
7677
* [Cosium/maven-git-code-format](https://github.com/Cosium/maven-git-code-format):
7778
A maven plugin that automatically deploys google-java-format as a
7879
pre-commit git hook.
80+
* SBT plugins
81+
* [sbt/sbt-java-formatter](https://github.com/sbt/sbt-java-formatter)
7982
* [maltzj/google-style-precommit-hook](https://github.com/maltzj/google-style-precommit-hook):
8083
A pre-commit (pre-commit.com) hook that will automatically run GJF whenever
8184
you commit code to your repository
85+
* [Github Actions](https://github.com/features/actions)
86+
* [googlejavaformat-action](https://github.com/axel-op/googlejavaformat-action):
87+
Automatically format your Java files when you push on github
8288

8389
### as a library
8490

@@ -92,15 +98,15 @@ configuration.
9298
<dependency>
9399
<groupId>com.google.googlejavaformat</groupId>
94100
<artifactId>google-java-format</artifactId>
95-
<version>1.7</version>
101+
<version>1.9</version>
96102
</dependency>
97103
```
98104

99105
#### Gradle
100106

101107
```groovy
102108
dependencies {
103-
compile 'com.google.googlejavaformat:google-java-format:1.7'
109+
compile 'com.google.googlejavaformat:google-java-format:1.9'
104110
}
105111
```
106112

appveyor.yml

-32
This file was deleted.

core/pom.xml

+51-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>com.google.googlejavaformat</groupId>
2424
<artifactId>google-java-format-parent</artifactId>
25-
<version>1.8-SNAPSHOT</version>
25+
<version>1.10-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>google-java-format</artifactId>
@@ -39,15 +39,11 @@
3939
<groupId>com.google.guava</groupId>
4040
<artifactId>guava</artifactId>
4141
</dependency>
42-
<dependency>
43-
<groupId>com.google.errorprone</groupId>
44-
<artifactId>javac-shaded</artifactId>
45-
</dependency>
4642

4743
<!-- Compile-time dependencies -->
4844
<dependency>
49-
<groupId>com.google.code.findbugs</groupId>
50-
<artifactId>jsr305</artifactId>
45+
<groupId>org.checkerframework</groupId>
46+
<artifactId>checker-qual</artifactId>
5147
<optional>true</optional>
5248
</dependency>
5349
<dependency>
@@ -83,14 +79,23 @@
8379
<plugin>
8480
<artifactId>maven-javadoc-plugin</artifactId>
8581
<configuration>
82+
<source>11</source>
8683
<encoding>UTF-8</encoding>
8784
<docencoding>UTF-8</docencoding>
8885
<charset>UTF-8</charset>
8986
<links>
90-
<link>https://google.github.io/guava/releases/${guava.version}/api/docs/</link>
91-
<link>https://javadoc.io/page/com.google.code.findbugs/jsr305/${jsr305.version}/</link>
92-
<link>https://docs.oracle.com/javase/8/docs/api/</link>
87+
<link>https://guava.dev/releases/${guava.version}/api/docs/</link>
88+
<link>https://docs.oracle.com/en/java/javase/11/docs/api</link>
9389
</links>
90+
<additionalJOptions>
91+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
92+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
93+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
94+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
95+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
96+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
97+
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
98+
</additionalJOptions>
9499
</configuration>
95100
<executions>
96101
<execution>
@@ -238,6 +243,42 @@
238243
</execution>
239244
</executions>
240245
</plugin>
246+
<plugin>
247+
<groupId>org.apache.maven.plugins</groupId>
248+
<artifactId>maven-compiler-plugin</artifactId>
249+
<configuration>
250+
<source>11</source>
251+
<target>11</target>
252+
</configuration>
253+
</plugin>
241254
</plugins>
242255
</build>
256+
257+
<profiles>
258+
<profile>
259+
<id>jdk11</id>
260+
<activation>
261+
<jdk>(,14)</jdk>
262+
</activation>
263+
<build>
264+
<plugins>
265+
<plugin>
266+
<groupId>org.apache.maven.plugins</groupId>
267+
<artifactId>maven-compiler-plugin</artifactId>
268+
<configuration>
269+
<excludes>
270+
<exclude>**/Java14InputAstVisitor.java</exclude>
271+
</excludes>
272+
</configuration>
273+
</plugin>
274+
<plugin>
275+
<artifactId>maven-javadoc-plugin</artifactId>
276+
<configuration>
277+
<excludePackageNames>com.google.googlejavaformat.java.java14</excludePackageNames>
278+
</configuration>
279+
</plugin>
280+
</plugins>
281+
</build>
282+
</profile>
283+
</profiles>
243284
</project>

core/src/main/java/com/google/googlejavaformat/Doc.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.google.googlejavaformat;
1616

1717
import static com.google.common.collect.Iterables.getLast;
18+
import static java.lang.Math.max;
1819

1920
import com.google.common.base.MoreObjects;
2021
import com.google.common.collect.DiscreteDomain;
@@ -653,7 +654,7 @@ public State computeBreaks(State state, int lastIndent, boolean broken) {
653654

654655
if (broken) {
655656
this.broken = true;
656-
this.newIndent = Math.max(lastIndent + plusIndent.eval(), 0);
657+
this.newIndent = max(lastIndent + plusIndent.eval(), 0);
657658
return state.withColumn(newIndent);
658659
} else {
659660
this.broken = false;

core/src/main/java/com/google/googlejavaformat/OpsBuilder.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
package com.google.googlejavaformat;
1616

17+
import static java.lang.Math.max;
18+
import static java.lang.Math.min;
19+
1720
import com.google.common.base.MoreObjects;
1821
import com.google.common.collect.ArrayListMultimap;
1922
import com.google.common.collect.ImmutableList;
@@ -39,14 +42,14 @@ public int actualSize(int position, int length) {
3942
int start = startToken.getTok().getPosition();
4043
for (Tok tok : startToken.getToksBefore()) {
4144
if (tok.isComment()) {
42-
start = Math.min(start, tok.getPosition());
45+
start = min(start, tok.getPosition());
4346
}
4447
}
4548
Token endToken = input.getPositionTokenMap().get(position + length - 1);
4649
int end = endToken.getTok().getPosition() + endToken.getTok().length();
4750
for (Tok tok : endToken.getToksAfter()) {
4851
if (tok.isComment()) {
49-
end = Math.max(end, tok.getPosition() + tok.length());
52+
end = max(end, tok.getPosition() + tok.length());
5053
}
5154
}
5255
return end - start;
@@ -62,7 +65,7 @@ public Integer actualStartColumn(int position) {
6265
return start;
6366
}
6467
if (tok.isComment()) {
65-
start = Math.min(start, tok.getPosition());
68+
start = min(start, tok.getPosition());
6669
}
6770
}
6871
return start;

core/src/main/java/com/google/googlejavaformat/java/CommandLineOptionsParser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static CommandLineOptions parse(Iterable<String> options) {
5454
int idx = option.indexOf('=');
5555
if (idx >= 0) {
5656
flag = option.substring(0, idx);
57-
value = option.substring(idx + 1, option.length());
57+
value = option.substring(idx + 1);
5858
} else {
5959
flag = option;
6060
value = null;

0 commit comments

Comments
 (0)