>
>
PVS-Studio 7.29: Java code check in VS …

Gleb Aslamov
Articles: 14

PVS-Studio 7.29: Java code check in VS Code, Boost smart pointers, and plugin for Qt Creator on macOS

PVS-Studio 7.29 has been released. Now you can analyze Java projects in a plugin for VS Code, check Boost smart pointers, use the PVS-Studio plugin for Qt Creator 12 on macOS, and that's not all! See more details in this note.

You can download the latest PVS-Studio version here.

Support for Java projects in Visual Studio Code plugin

Now you can analyze Java projects using the PVS-Studio plugin for Visual Studio Code. In the plugin, you can:

  • run the analysis and view a report;
  • suppress warnings using suppress files;
  • enable the incremental analysis mode.

You can explore other features in the documentation section.

Support for Boost smart pointers

The C++ analyzer now supports smart pointers from the Boost library: boost::unique_ptr and boost::shared_ptr.

Now the PVS-Studio analyzer is able to detect errors such as null pointer dereferences when these classes are used.

Considering hash of code line to mark false positives

In the latest PVS-Studio release, we added a mode that considers the hash of the source code line, which triggers a warning, when users mark warnings as false positives.

PVS-Studio had considered hash before, but it was used for navigation and the more efficient operation of suppress files. There is now a new way to use the hash: you can specify it inline when marking false positives. This makes it clear whether the line of code had been changed since the warning was marked as a false positive. If there are changes in the code, the false positive marker will no longer suppress the analyzer warning.

Here is an example of a line where the false positive marker and hash for tracking changes are specified:

std::string(4, std::string().at(0)); //-V530 //-VH"920700501"

The PVS-Studio plugins for Microsoft Visual Studio now support this feature. For further details, please refer to the documentation.

Note. If you are interested in learning more about methods and technologies of false positive suppression, you may want to read this article.

PVS-Studio plugin for Qt Creator 12 on macOS

The PVS-Studio plugin for Qt Creator 12 is now supported on macOS operating systems.

You can find more details on how to use PVS-Studio in Qt Creator in the documentation.

New diagnostic rules

C, C++

  • V839. Decreased performance. Function returns a constant value. This may interfere with the move semantics.
  • V1104. Priority of the 'M' operator is higher than that of the 'N' operator. Possible missing parentheses.
  • V2625. MISRA. Identifier with external linkage should be unique.

C#

  • V3194. Calling 'OfType' for collection will return an empty collection. It is not possible to cast collection elements to the type parameter.
  • V3195. Collection initializer implicitly calls 'Add' method. Using it on member with default value of null will result in null dereference exception.

Java

  • V6108. Do not use real-type variables in 'for' loop counters.
  • V6109. Potentially predictable seed is used in pseudo-random number generator.

C++ quiz by PVS-Studio and Sergei Kushnirenko

In this release, the PVS-Studio team together with Sergei Kushnirenko prepared a C++ quiz based on errors described in his publications.

Take the quiz, challenge your focus and coding skills while looking for errors in the C++ code. You can find the quiz here.

Articles

For C++ programmers

For C# programmers:

For Java programmers:

Articles on general topics

Do you want to check a project with PVS-Studio? Then start from this page.

If you would like to get news on latest releases, subscribe to the PVS-Studio newsletter here.