suppress-warnings

Class is a raw type. References to generic type Class<T> should be parameterized

孤街醉人 提交于 2019-11-26 22:36:42
I have the following class (from a simple Spring tutorial) public class CarValidator implements Validator { public boolean supports(Class aClass) { return Car.class.equals(aClass); } public void validate(Object obj, Errors errors) { Car car = (Car) obj; ValidationUtils.rejectIfEmptyOrWhitespace(errors, "model", "field.required", "Required field"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "price", "field.required", "Required field"); if( ! errors.hasFieldErrors("price")) { if (car.getPrice().intValue() == 0) { errors.rejectValue("price", "not_zero", "Can't be free!"); } } } } Where the

Suppress deprecated import warning in Java

倖福魔咒の 提交于 2019-11-26 22:31:26
In Java, if you import a deprecated class: import SomeDeprecatedClass; You get this warning: The type SomeDeprecatedClass is deprecated Is there a way to suppress this warning? Use this annotation on your class or method: @SuppressWarnings( "deprecation" ) To avoid the warning: do not import the class instead use the fully qualified class name and use it in as few locations as possible. TofuBeer As a hack you can not do the import and use the fully qualified name inside the code. You might also try javac -Xlint:-deprecation not sure if that would address it. I solved this by changing the

suppress messages displayed by “print” instead of “message” or “warning” in R

南笙酒味 提交于 2019-11-26 20:11:01
问题 Many R packages I work with involve functions that give all their messages and warnings through commands to print() calls rather than commands to message() or warning(). I'd like to be able to silence these functions progress indicators, etc, but the standard supressWarnings() or supressMessages doesn't do it. Is there a way I can just suppressPrint? For example: silly_developer_function <- function(x){ print("Thanks for using my function!!") if(is(x, "numeric")) print("warning, x should be a

How do you tell Valgrind to completely suppress a particular .so file?

可紊 提交于 2019-11-26 19:50:08
问题 I'm trying to use Valgrind on a program that I'm working on, but Valgrind generates a bunch of errors for one of the libraries that I'm using. I'd like to be able to tell it to suppress all errors which involve that library. The closest rule that I can come up with for the suppression file is { rule name Memcheck:Cond ... obj:/path/to/library/thelibrary.so } This doesn't entirely do the job, however. I have to create one of these for every suppression type that comes up (Cond, Value4, Param,

Avoid warning 'Unreferenced Formal Parameter'

北城余情 提交于 2019-11-26 19:22:58
问题 I have a super class like this: class Parent { public: virtual void Function(int param); }; void Parent::Function(int param) { std::cout << param << std::endl; } ..and a sub-class like this: class Child : public Parent { public: void Function(int param); }; void Child::Function(int param) { ;//Do nothing } When I compile the sub-class .cpp file, I get this error warning C4100: 'param' : unreferenced formal parameter As a practice, we used to treat warnings as errors. How to avoid the above

Disable warnings in Xcode from frameworks

余生颓废 提交于 2019-11-26 18:52:23
问题 I have imported the three20 project into my project, and when I upgraded to Xcode 4.2 with iOS 5, a bunch of warnings appeared in the project. I don't care about them, but they make a lot of noise, and it's easy to miss any real warnings in my project now. Is there a way to disable warnings for those specific libraries? 回答1: If your third-party libraries are added as a separate target, you can check Inhibit all warnings for that specific target to turn all warnings off. If your library is

How to suppress warnings in external headers in Visual C++

感情迁移 提交于 2019-11-26 17:59:58
问题 I'm starting a new BREW project, and I'd like to compile with Warning Level 4 (/W4) to keep the application code nice and clean. The problem is that the BREW headers themselves don't compile cleanly with /W4. In gcc you can differentiate between application and system headers by using -I and -isystem, and then by default gcc doesn't report any compilation warnings in system headers. Is there an equivalent mechanism in Visual C++? 回答1: Only use this method around a block of headers that you

How to suppress Java warnings for specific directories or files such as generated code

我是研究僧i 提交于 2019-11-26 17:57:20
问题 I'm using a parser generator that creates somewhat ugly code. As a result my Eclipse project has several dozen warnings emanating from generated source files. I know I can use the @SuppressWarning annotation to suppress particular warnings in particular elements, but any annotations I add by hand will be lost when the parser generator runs again. Is there a way to configure Eclipse to suppress warnings for a particular file or directory? 回答1: Starting with version 3.8 M6, Eclipse (to be exact

Is there a way to ignore a single FindBugs warning?

帅比萌擦擦* 提交于 2019-11-26 17:27:13
问题 With PMD, if you want to ignore a specific warning, you can use // NOPMD to have that line be ignored. Is there something similar for FindBugs? 回答1: The FindBugs initial approach involves XML configuration files aka filters. This is really less convenient than the PMD solution but FindBugs works on bytecode, not on the source code, so comments are obviously not an option. Example: <Match> <Class name="com.mycompany.Foo" /> <Method name="bar" /> <Bug pattern="DLS_DEAD_STORE_OF_CLASS_LITERAL" /

Is it possible to make valgrind ignore certain libraries?

若如初见. 提交于 2019-11-26 16:38:50
问题 Or preferably all of them instead of just my code? My program uses Gtk, Loudmouth and few other things, and these two (and some behind them, libgcrypto, libssl) are causing so many errors themselves that I'm unable to detect my own. Is it possible to make valgrind ignore things coming from deeper than my own code? 回答1: You can generate suppressions for the errors for the libraries, but I don't think you can exclude the libraries generally. Also it's hard to automatically know if a memory