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

Add method to ignore unstable checker framework violations. #12210

Closed
Vyom-Yadav opened this issue Sep 17, 2022 · 5 comments · Fixed by #12215
Closed

Add method to ignore unstable checker framework violations. #12210

Vyom-Yadav opened this issue Sep 17, 2022 · 5 comments · Fixed by #12215

Comments

@Vyom-Yadav
Copy link
Member

Vyom-Yadav commented Sep 17, 2022

From https://github.com/checkstyle/checkstyle/actions/runs/3074040335/jobs/4966560151

link to Suppression :

<!-- Unstable as 'capture#' keeps changing in different runs. -->
<checkerFrameworkError unstable="true">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter constructor of invokeConstructor.</message>
<lineContent>handlerCtor, indentCheck, ast, parent);</lineContent>
<details>
found : @Initialized @Nullable Constructor&lt;capture#788 extends @Initialized @Nullable Object&gt;
required: @Initialized @NonNull Constructor&lt;capture#788 extends @Initialized @Nullable Object&gt;
</details>
</checkerFrameworkError>

New surviving error(s) found:

File Name: "checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java"
Specifier: "argument"
Message: "incompatible argument for parameter constructor of invokeConstructor."
Line Contents: "handlerCtor, indentCheck, ast, parent);"
Line Number: 164
Details: found   : @Initialized @Nullable Constructor&lt;capture#394 extends @Initialized @Nullable Object&gt;
         required: @Initialized @NonNull Constructor&lt;capture#394 extends @Initialized @Nullable Object&gt;

<!-- Unstable as 'capture#' keeps changing in different runs. -->
<checkerFrameworkError unstable="true">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java</fileName>
<specifier>type.argument</specifier>
<message>incompatible type argument for type parameter T extends Object of invokeConstructor.</message>
<lineContent>resultHandler = (AbstractExpressionHandler) CommonUtil.invokeConstructor(</lineContent>
<details>
found : capture#788[ extends @UnknownKeyFor Object super @KeyForBottom Void]
required: [extends @UnknownKeyFor Object super @UnknownKeyFor NullType]
</details>
</checkerFrameworkError>

File Name: "checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java"
Specifier: "type.argument"
Message: "incompatible type argument for type parameter T extends Object of invokeConstructor."
Line Contents: "resultHandler = (AbstractExpressionHandler) CommonUtil.invokeConstructor("
Line Number: 163
Details: found   : capture#394[ extends @UnknownKeyFor Object super @KeyForBottom Void]
         required: [extends @UnknownKeyFor Object super @UnknownKeyFor NullType]

These errors are unstable because capture# keeps changing with every run. Although these errors are present in the current suppression model as unstable = "true" but it does not work because unlike pitest unstable suppression model, here the content of the error changes.

Another one is:

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java</fileName>
<specifier>required.method.not.called</specifier>
<message>@MustCall method close may not have been invoked on temp-var-20912 or any of its aliases.</message>
<lineContent>sarifLogger = new SarifLogger(new LogOutputStream(task, Project.MSG_INFO),</lineContent>
<details>
The type of object is: org.apache.tools.ant.taskdefs.LogOutputStream.
Reason for going out of scope: possible exceptional exit due to new SarifLogger(new LogOutputStream(task, Project.MSG_INFO), AutomaticBean.OutputStreamOptions.CLOSE) with exception type java.io.IOException
</details>
</checkerFrameworkError>

New surviving error(s) found:

File Name: "checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java"
Specifier: "required.method.not.called"
Message: "@MustCall method close may not have been invoked on temp-var-20910 or any of its aliases."
Line Contents: "sarifLogger = new SarifLogger(new LogOutputStream(task, Project.MSG_INFO),"
Line Number: 705
Details: The type of object is: org.apache.tools.ant.taskdefs.LogOutputStream.
         Reason for going out of scope: possible exceptional exit due to new SarifLogger(new LogOutputStream(task, Project.MSG_INFO), AutomaticBean.OutputStreamOptions.CLOSE) with exception type java.io.IOException

Here temp-var-\d+ keeps on changing, this field is present in Message:

@rnveach
Copy link
Member

rnveach commented Sep 17, 2022

If it is always capture#\d+, then we could just do a blind string replace and remove it.

@Vyom-Yadav
Copy link
Member Author

If it is always capture#\d+, then we could just do a blind string replace and remove it.

We got a new one temp-var-\d+, and we could get new ones in the future, don't think replacing would be a very stable way.

@Vyom-Yadav
Copy link
Member Author

Or for unstable errors, we could just remove any numbers (just while comparing) present in <details> and <message> and then we can compare the errors.

@romani
Copy link
Member

romani commented Sep 18, 2022

lets remove details for now, to make fix quicker.
Details might change from version to version of Checker, lets try to live without considering of it for failure.

Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Sep 18, 2022
Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Sep 18, 2022
Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Sep 18, 2022
Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Sep 19, 2022
Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Sep 19, 2022
Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Sep 19, 2022
@romani romani added this to the 10.3.4 milestone Sep 19, 2022
@romani
Copy link
Member

romani commented Sep 19, 2022

Fix is merged

rnveach pushed a commit to rnveach/checkstyle that referenced this issue Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants