suppress-warnings

Can unchecked warnings be avoided when overriding a method with raw type parameters?

I am extending a class defined in a library which I cannot change: public class Parent { public void init(Map properties) { ... } } If I am defining a class 'Child' that extends Parent and I am using Java 6 with generics, what is the best way to override the init method without getting unchecked warnings? public class Child exten...

SunStudio C++ compiler pragma to disable warnings?

The STLport bundled with the SunStudio11 generates alot of warnings. I beleive most compilers have a way to disable warnings from certain source files, like this: Sun C #pragma error_messages off #include <header.h> // ... #pragma error_messages on gcc #pragma warning(push, 0) #include <header.h> // ... #pragma warning(p...

How to suppress Java compiler warnings for specific functions

We are always taught to make sure we use a break in switch statements to avoid fall-through. The Java compiler warns about these situations to help us not make trivial (but drastic) errors. I have, however, used case fall-through as a feature (we don't have to get into it here, but it provides a very elegant solution). However the co...

How can I suppress warnings (codebase-wide) during javadoc compilation?

I'm stuck with a legacy Java codebase that has THOUSANDS of warnings when you compile it. I would love to actually fix the source of all these warnings, but unfortunately that's not an option at this time at my company (other things like "making new products that generate revenue" are considered higher priority by the people in charge; f...

Conversion from 'xxxx' to 'yyyy', possible loss of data, suppression?

Sometimes I've got warnings with conversion from a longer type to a smaller type e.g.: void f( unsigned short i ) // f - accept any numeric type // smaller than std::vector<>::size_type {} std::vector < some_type > v; .. f ( v.size() ); Usually I was using one of next solutions: assert( v.size() <= std::...

C# disable warning

Is there a way in code to disable certain warnings in C# alike #pragma warning(cmd: warningsNo) in c++? ...

What's the best way to suppress a runtime console warning in Java?

I am using the getResponseBody() method of the org.apache.commons.httpclient.methods.PostMethod class. However, I am always getting a message written to the console at runtime: WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended. In the code I have to write the response...

How to avoid the "unused param" warning when overriding a method in java 1.4 ?

In this code : public class MyClass { private Object innerValue; public Object getInnerValue() { return this.innerValue; } public void setInnerValue(Object innerValue) { this.innerValue = innerValue; } } public class MyClassReadOnly extends MyClass { MyClassReadOnly(MyClass cls) { // Mak...

How can I inhibit warning 4200 in Visual Studio 2005?

I can inhibit many warnings in Visual Studio 2005 SP1 in the C/C++ Advanced property page, which causes the IDE to use the /wd switch on the command line which invokes the compiler. However, when I try to inhibit warning 4200 (nonstandard extension used : zero-sized array in struct/union), it still appears when I compile. (Of course it's...

Eclipse - @SuppressWarnings("javadoc") does not work

Hi, I have my Eclipse configured to show warnings on missing javadoc comments and tags for public elements. That comes very usefull for me in order to keep my code well documented. But sometimes I have a class, where I have several constants describing for example states of DFA or something.. theres no need to document theese constant...

How to exclude MFC code from VS2008 Code Analysis

I have a C++/CLI project that uses CWinFormsControl and CWinFormsView to create .NET controls in my MFC views. To do this I need to #include "afxwinforms.h". When I run Code Analysis on the project, I always get warnings about some of the MFC classes I've included. Examples: 3>Running Code Analysis... 3>c:\program files\microsoft visua...

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

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 ru...

How to Disable a warning across projects in Visual Studio

I know this sounds bad but how can I disable/suppress a specific warning for all the projects in a solution. All of my projects are VC++ projects. Is it possible? If yes, how can this be done? Environment is Visual Studio 2005 ...

What is the list of valid @SuppressWarnings warning names in Java?

What is the list of valid @SuppressWarnings warning names in Java? The bit that come between the ("") in @SuppressWarnings(""). ...

Why does @SuppressWarnings break my code?

Got this idea from this previous question. http://stackoverflow.com/questions/529085/java-how-to-generic-array-creation Anyway, my code is like this: public class Slice<E> { private E[] data; public Slice(Class<E> elementType, int size) { //@SuppresWarnings({"unchecked"}) data = (E[])Array.newInstance(elementType...

How do I suppress T-SQL warnings when running a script SQL Server 2005?

Is it possible to suppress warnings generated by T-SQL scripts? If so, how? I know I can turn of the 'records affected' messages with SET NOCOUNT ON but is there an equivalent for warnings? Eg: Warning: Null value is eliminated by an aggregate or other SET operation. If I'm expecting these errors, it helps to sift the real errors ...

How does one disable deprecated warnings in Flex 3?

I've recently started working with an application written using Adobe Flex 3. We're using several deprecated functions and unfortunately we can't remove these dependencies. The documentation says to set -show-deprecated-warnings=false into the Compiler Additional Options. This isn't accepted, but I've found that using -show-deprecatio...

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

There are lots of threads about this type of question, but I want to get a complete answer and actually understand it without 'hiding' the problem with a @SupressWarnings ! I have the following class (from a simple Spring tutorial) public class CarValidator implements Validator { public boolean supports(Class aClass) { return Car.cla...

PHP function is_nan() throws a warning for strings

I've been using the is_nan() function (ie: is-not-a-number) to check whether a variable taken from the querystring is a number or not. However, in the case of the variable being a string (in which case is_nan() should return TRUE), the function also throws the following rather annoying warning: Warning: is_nan() expects parameter 1 to b...

Trying to supress resource warning in Visual Studio

I want to suppress the "The resource name 'X.Y' is not a valid identifier" warnings in Visual Studio 2008. I cannot find the warning number to supress it in the project's properties. Is there another way of achieving this, or better still, does anyone know the warning number? Thanks :) ...