Skip to content
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

Use of default charset in LexScan #470

Closed
regisd opened this issue Oct 17, 2018 · 0 comments · Fixed by #699
Closed

Use of default charset in LexScan #470

regisd opened this issue Oct 17, 2018 · 0 comments · Fixed by #699
Assignees
Labels
bug Not working as intended help wanted Good first issues
Milestone

Comments

@regisd
Copy link
Member

regisd commented Oct 17, 2018

I think this should be in 1.7.1 as a follow-up of #308

bazel-out/darwin-fastbuild/genfiles/jflex/LexScan.java:2035: error: [DefaultCharset] Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
yypushStream( new FileReader(f) );
^
(see https://errorprone.info/bugpattern/DefaultCharset)
Did you mean 'yypushStream( Files.newBufferedReader(f.toPath(), UTF_8) );' or 'yypushStream( Files.newBufferedReader(f.toPath(), Charset.defaultCharset()) );'?

@regisd regisd added the bug Not working as intended label Oct 17, 2018
@regisd regisd added this to the 1.7.1 milestone Oct 17, 2018
regisd added a commit to regisd/jflex that referenced this issue Oct 17, 2018
@regisd regisd added the help wanted Good first issues label Oct 18, 2018
@regisd regisd modified the milestones: 1.7.1, 1.8.0 Nov 5, 2019
@regisd regisd removed this from the 1.8.0 milestone Nov 27, 2019
lsf37 added a commit that referenced this issue Jan 2, 2020
Mostly:
 * make final where possible
 * avoid implicit use of platform default charset (also fixes #470).

The charset for skeletons and graphviz dot files is UTF-8 (docs updated), for
spec input/output files, Options.enconding.
@lsf37 lsf37 added this to the 1.8.0 milestone Jan 2, 2020
@lsf37 lsf37 closed this as completed in #699 Jan 3, 2020
lsf37 added a commit that referenced this issue Jan 3, 2020
 * make final where possible
 * avoid implicit use of platform default charset (also fixes #470)
 * Vector -> ArrayList
 * Stack -> Deque

The charset for skeletons and graphviz dot files is UTF-8 (docs updated), for spec input/output files, Options.enconding.
regisd pushed a commit that referenced this issue Jan 3, 2020
commit 51fa835
Author:     Gerwin Klein <lsf@jflex.de>
AuthorDate: Fri Jan 3 13:56:43 2020 +0800
Commit:     GitHub <noreply@github.com>
CommitDate: Fri Jan 3 13:56:43 2020 +0800

    address further error-prone warnings (#699)

     * make final where possible
     * avoid implicit use of platform default charset (also fixes #470)
     * Vector -> ArrayList
     * Stack -> Deque

    The charset for skeletons and graphviz dot files is UTF-8 (docs updated), for spec input/output files, Options.enconding.

Updated from target/jflex-parent-1.8.0-SNAPSHOT-sources.jar
regisd added a commit to regisd/jflex that referenced this issue Mar 28, 2020
Bump DefaultCharset to error
https://errorprone.info/bugpattern/DefaultCharset

LexScan was already fixed in jflex-de#470
regisd added a commit that referenced this issue Mar 28, 2020
* Exclude all generated code from error-prone.

* Remove cup from the XepExcludedPaths
Follow-up of #734

* Make fields final.
  https://errorprone.info/bugpattern/FieldCanBeFinal

* Remove reference equality
  https://errorprone.info/bugpattern/ReferenceEquality

* Keep UnnecessaryParentheses disabled

```
jflex/src/main/java/jflex/generator/Emitter.java:1173: error: [UnnecessaryParentheses] Unnecessary use of grouping parentheses
          println("            case " + (++last) + ": break;");
                                        ^
    (see https://errorprone.info/bugpattern/UnnecessaryParentheses)
  Did you mean 'println("            case " + ++last + ": break;");'?
```

https://errorprone.info/bugpattern/UnnecessaryParentheses

* Reenable CatchAndPrintStackTrace

Nothing to fix

* Fix DefaultCharset
Also Replace guava Charsets by java StandardCharsets

https://errorprone.info/bugpattern/DefaultCharset

LexScan was already fixed in #470

* Fix ConstructorInvokesOverridable

make methods final.
https://errorprone.info/bugpattern/ConstructorInvokesOverridable

SuppressWarnings for OptionsDialog.java

* Add default case to switch statements

https://errorprone.info/bugpattern/MissingDefault

* Enable Unused  at ERROR

Suppress warnings on WIP ucd_generator

https://errorprone.info/bugpattern/Unused

* Enable UnusedException as ERROR

Fix violations when possible
SuppressWarnings otherwise

https://errorprone.info/bugpattern/UnusedException

* Keep Var OFF

it's quite controversial and there are tons of violations.
https://errorprone.info/bugpattern/Var

* Fix MixedArrayDimensions

Rewrite C-style array declaration.

https://errorprone.info/bugpattern/MixedArrayDimensions

* Fix MethodCanBeStatic

https://errorprone.info/bugpattern/MixedArrayDimensions

* Fix WildcardImport

List imports  explicitly

https://errorprone.info/bugpattern/WildcardImport
regisd pushed a commit that referenced this issue Mar 28, 2020
commit 48787cf
Author:     Régis Décamps <regisd@google.com>
AuthorDate: Sat Mar 28 21:50:42 2020 +0100
Commit:     GitHub <noreply@github.com>
CommitDate: Sat Mar 28 21:50:42 2020 +0100

    Minor: Address Error prone warnings (#749)

    * Exclude all generated code from error-prone.

    * Remove cup from the XepExcludedPaths
    Follow-up of #734

    * Make fields final.
      https://errorprone.info/bugpattern/FieldCanBeFinal

    * Remove reference equality
      https://errorprone.info/bugpattern/ReferenceEquality

    * Keep UnnecessaryParentheses disabled

    ```
    jflex/src/main/java/jflex/generator/Emitter.java:1173: error: [UnnecessaryParentheses] Unnecessary use of grouping parentheses
              println("            case " + (++last) + ": break;");
                                            ^
        (see https://errorprone.info/bugpattern/UnnecessaryParentheses)
      Did you mean 'println("            case " + ++last + ": break;");'?
    ```

    https://errorprone.info/bugpattern/UnnecessaryParentheses

    * Reenable CatchAndPrintStackTrace

    Nothing to fix

    * Fix DefaultCharset
    Also Replace guava Charsets by java StandardCharsets

    https://errorprone.info/bugpattern/DefaultCharset

    LexScan was already fixed in #470

    * Fix ConstructorInvokesOverridable

    make methods final.
    https://errorprone.info/bugpattern/ConstructorInvokesOverridable

    SuppressWarnings for OptionsDialog.java

    * Add default case to switch statements

    https://errorprone.info/bugpattern/MissingDefault

    * Enable Unused  at ERROR

    Suppress warnings on WIP ucd_generator

    https://errorprone.info/bugpattern/Unused

    * Enable UnusedException as ERROR

    Fix violations when possible
    SuppressWarnings otherwise

    https://errorprone.info/bugpattern/UnusedException

    * Keep Var OFF

    it's quite controversial and there are tons of violations.
    https://errorprone.info/bugpattern/Var

    * Fix MixedArrayDimensions

    Rewrite C-style array declaration.

    https://errorprone.info/bugpattern/MixedArrayDimensions

    * Fix MethodCanBeStatic

    https://errorprone.info/bugpattern/MixedArrayDimensions

    * Fix WildcardImport

    List imports  explicitly

    https://errorprone.info/bugpattern/WildcardImport

Updated from target/jflex-parent-1.9.0-SNAPSHOT-sources.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended help wanted Good first issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants