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

Output of NullAway can be againt each file list of issues #788

Closed
nagkumar opened this issue Jul 20, 2023 · 1 comment
Closed

Output of NullAway can be againt each file list of issues #788

nagkumar opened this issue Jul 20, 2023 · 1 comment

Comments

@nagkumar
Copy link

Note: experiments\java\edu\src\main\java\com\tejasoft\edu\cc\annotations\nulls\NullsEx.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')
	

1 warning
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\fakes\TestBAWFake.java:120: warning: [UnusedVariable] The parameter 'user' is never read.
    private record FakeUserService(User user) implements UserService
            ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\fakes\TestBAWFake.java:161: warning: [UnusedVariable] The parameter 'subject' is never read.
	private record Email(String recipient, String subject, String body)
	        ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\fakes\TestBAWFake.java:161: warning: [UnusedVariable] The parameter 'body' is never read.
	private record Email(String recipient, String subject, String body)
	        ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\fakes\TestBAWFake.java:111: warning: [UnusedVariable] The parameter 'authenticated' is never read.
    private record FakeSecurityService(boolean authenticated) implements SecurityService
            ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\fakes\TestBAWFake.java:161: warning: [UnusedVariable] The parameter 'recipient' is never read.
	private record Email(String recipient, String subject, String body)
	        ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean 'private record Email(String subject, String body)'?
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\stubs\TestBAWStub.java:62: warning: [NullAway] @NonNull field recipient not initialized
    private String recipient;
                   ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\stubs\TestBAWStub.java:63: warning: [NullAway] @NonNull field subject not initialized
    private String subject;
                   ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\bank\tests\doubles\stubs\TestBAWStub.java:64: warning: [NullAway] @NonNull field body not initialized
    private String body;
                   ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\date\tests\bdd\ccbr\StepsDateCalc.java:14: warning: [NullAway] @NonNull field dateCalc not initialized
    private DateCalc dateCalc;
                     ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\date\tests\bdd\ccbr\StepsDateCalc.java:15: warning: [NullAway] @NonNull field result not initialized
    private String result;
                   ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\rpn\tests\bdd\ccbr\Grocery.java:5: warning: [NullAway] @NonNull field name not initialized
    private String name;
                   ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\rpn\tests\bdd\ccbr\Grocery.java:6: warning: [NullAway] @NonNull field price not initialized
    private Price price;
                  ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\rpn\tests\bdd\ccbr\StepsRPNCalc.java:19: warning: [NullAway] @NonNull field rpnCalc not initialized
    private RPNCalc rpnCalc;
                    ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\rpn\tests\bdd\ccbr\StepsRPNCalc.java:78: warning: [NullAway] @NonNull field StepsRPNCalc$Entry.first not initialized
	private Integer first;
	                ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\rpn\tests\bdd\ccbr\StepsRPNCalc.java:79: warning: [NullAway] @NonNull field StepsRPNCalc$Entry.second not initialized
	private Integer second;
	                ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\rpn\tests\bdd\ccbr\StepsRPNCalc.java:80: warning: [NullAway] @NonNull field StepsRPNCalc$Entry.operation not initialized
	private String operation;
	               ^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\dsa\bbraces\tests\ju\ju5\ut\AbstTestBB.java:14: warning: [UnusedVariable] The field 'baBalancedBraces' is never read.
    private static BalancedBraces baBalancedBraces;
                                  ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean to remove this line or to remove this line?
experiments\java\edu\src\main\java\com\tejasoft\edu\dsa\bbraces\tests\ju\ju5\ut\AbstTestBB.java:13: warning: [UnusedVariable] The field 'csBalancedBraces' is never read.
    private final static BalancedBraces csBalancedBraces = new BalancedBraces();
                                        ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean to remove this line or 'static { new BalancedBraces(); }'?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju3\ut\learn\TestJU3.java:29: warning: [ComplexBooleanConstant] This expression always evaluates to `false`, prefer a boolean literal for clarity.
	assertFalse(3 == 2);
	              ^
    (see https://errorprone.info/bugpattern/ComplexBooleanConstant)
  Did you mean 'assertFalse(false);'?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\utils\scan\aop\AbstTypeCounter.java:52: warning: [NullAway] returning @Nullable expression from method with @NonNull return type
	return null;
	^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\AsyncWorker.java:58: warning: [UnusedMethod] Method 'withExecutor' is never used.
    private static void withExecutor(final int aMillis, final int aInt, final AtomicInteger lAtomicInteger)
                        ^
    (see https://errorprone.info/bugpattern/UnusedMethod)
  Did you mean to remove this line?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\AsyncWorker.java:62: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.
	    bExecutorService.schedule(() -> lAtomicInteger.set(aInt),
	                             ^
    (see https://errorprone.info/bugpattern/FutureReturnValueIgnored)
  Did you mean 'var unused = bExecutorService.schedule(() -> lAtomicInteger.set(aInt),' or to remove this line?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\tests\TestAsyncEx.java:29: warning: [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
					    e.printStackTrace();
					    ^
    (see https://errorprone.info/bugpattern/CatchAndPrintStackTrace)
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\tests\TestAsyncWorker.java:43: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.
	CompletableFuture.runAsync(() ->
	                          ^
    (see https://errorprone.info/bugpattern/FutureReturnValueIgnored)
  Did you mean 'var unused = CompletableFuture.runAsync(() ->' or to remove this line?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\tests\TestAsyncWorker.java:52: warning: [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
					   e.printStackTrace();
					   ^
    (see https://errorprone.info/bugpattern/CatchAndPrintStackTrace)
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\tests\TestAsyncWorker.java:118: warning: [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
		e.printStackTrace();
		^
    (see https://errorprone.info/bugpattern/CatchAndPrintStackTrace)
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\tests\TestAsyncWorker.java:321: warning: [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
	    aException.printStackTrace();
	    ^
    (see https://errorprone.info/bugpattern/CatchAndPrintStackTrace)
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\asserts\awaitility\learn\async\tests\TestAsyncWorker.java:617: warning: [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
			   aInterruptedException.printStackTrace();
			   ^
    (see https://errorprone.info/bugpattern/CatchAndPrintStackTrace)
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\perf\jmeter\ext\JUnit5Sampler.java:158: warning: [UnusedMethod] Method 'getMethodWithAnnotation' is never used.
    private Method getMethodWithAnnotation(Object testObject, Class<? extends Annotation> annotation)
                   ^
    (see https://errorprone.info/bugpattern/UnusedMethod)
  Did you mean to remove this line?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\perf\jmeter\ext\JUnit5Sampler.java:25: warning: [UnusedVariable] The field 'log' is never read.
    private static final Logger log = LoggerFactory.getLogger(JUnit5Sampler.class);
                                ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean to remove this line or 'static { LoggerFactory.getLogger(JUnit5Sampler.class); }'?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\perf\jmeter\ext\JUnit5Sampler.java:168: warning: [NullAway] returning @Nullable expression from method with @NonNull return type
	return null;
	^
    (see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\perf\jmeter\ext\JUnit5Sampler.java:208: warning: [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.
	listener.getSummary().printTo(new PrintWriter(System.out));
	                              ^
    (see https://errorprone.info/bugpattern/DefaultCharset)
  Did you mean 'listener.getSummary().printTo(new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, UTF_8))));' or 'listener.getSummary().printTo(new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()))));'?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\sec\jazzer\cifuzz\learn\OOMAnalyzer.java:42: warning: [UnusedVariable] The parameter 'aInput' is never read.
    private static int getPosCorrect(final int[] aInput, int lPos)
                                                 ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean 'lPos = getPosCorrect(lPos);'?
experiments\java\edu\src\main\java\com\tejasoft\tests\ju\ju5\ut\suites\learn\TestExGroupAsserts.java:21: warning: [ComplexBooleanConstant] This expression always evaluates to `true`, prefer a boolean literal for clarity.
		  () -> assertTrue("2nd Assert Pass", 2 == 2),
		                                        ^
    (see https://errorprone.info/bugpattern/ComplexBooleanConstant)
  Did you mean '() -> assertTrue("2nd Assert Pass", true),'?
34 warnings

Instead of repeating the same file against each error, it would be more easy to know each file and list of reported errors and warnings against it..

Also, in the end, can talk about the file names and total errors in that file, this way hotspot files can be more clearly visible.

@msridhar
Copy link
Collaborator

NullAway and Error Prone report errors via standard javac APIs, and have little control about how the compiler formats the errors. You might be interested in google/error-prone#3766 which would enable serialization of these errors; then a separate tool could group the errors in different ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants