Skip to content

Forbid test sources to use System.out.println and Throwable.printStackTrace #17112

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

Merged
merged 3 commits into from
Mar 15, 2016

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Mar 15, 2016

Test sources have been exempt from the bundled forbiddenApi signatures jdk-system-out that check among others usages of System.out.println and Throwable.printStackTrace. With the removal of benchmarks in #15356, there is no need to relax this check for tests anymore.

This PR:

  • enables jdk-system-out checks on all sources
  • removes the few remaining usages of println and printStackTrace
  • removes two benchmark classes (probably missed in Remove benchmark package #15356)

@ywelsch ywelsch added review :Delivery/Build Build or test infrastructure v5.0.0-alpha1 labels Mar 15, 2016
@@ -59,6 +57,7 @@
public static final List<String> LOGGER_METHODS = Arrays.asList("trace", "debug", "info", "warn", "error");
public static final String IGNORE_CHECKS_ANNOTATION = "org.elasticsearch.common.SuppressLoggerChecks";

@SuppressForbidden(reason = "command line tool")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use the @ SuppressForbidden from lucene here? I think the test framework has dependencies on lucene no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logger usage checker is a standalone tool. Its main sources have no dependencies besides ASM framework (its test sources reuse our test framework however). Just one additional "SuppressForbidden" beside the other 5 in the classpath ;-)

@s1monw
Copy link
Contributor

s1monw commented Mar 15, 2016

left one minor comment - LGTM otherwise, no need to re-review

@jasontedor
Copy link
Member

LGTM.

ywelsch added a commit that referenced this pull request Mar 15, 2016
Forbid test sources to use System.out.println and Throwable.printStackTrace
@ywelsch ywelsch merged commit 7fb07a9 into elastic:master Mar 15, 2016
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants