Questions tagged [suppress-warnings]

Compilers and interpreters commonly warn about miscellaneous conditions. Suppressing some or all of those warnings may help to reduce the 'noise' a compiler emits.

Compilers and interpreters commonly warn about miscellaneous conditions. Suppressing some or all of those warnings may help to reduce the 'noise' a compiler emits.

Common warnings may be deprecation warnings or the use of an undefined value.

790 questions
64
votes
2 answers

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

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…
user167768
62
votes
11 answers

Best way to suppress C warning "Unused variable x"?

What is the best/neatest way to suppress a C compiler (for example GCC) like "Unused variable x" warning? GCC's doumentation explains -Wunused-variable Warn whenever a local variable or non-constant static variable is unused aside from its…
gustaf
  • 776
  • 1
  • 6
  • 6
61
votes
8 answers

Avoid warning 'Unreferenced Formal Parameter'

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…
bdhar
  • 21,619
  • 17
  • 70
  • 86
59
votes
4 answers

Is there an equivalent to SuppressWarnings in Scala?

I was wondering if scala had an equivalent to java's @SuppressWarnings that can be applied to a function or whatever to ignore any deprecation warnings[1] that function emits? 1: Relevant warning in my case is: method stop in class Thread is…
BenjaminJackman
  • 1,439
  • 1
  • 10
  • 18
58
votes
5 answers

Disable/suppress warning CS0649 in C# for a specific field of class

I have some fields in a C# class which I initialize using reflection. The compiler shows CS0649 warning for them: Field foo' is never assigned to, and will always have its default valuenull' (CS0649) (Assembly-CSharp) I'd like to disable the…
iseeall
  • 3,381
  • 9
  • 34
  • 43
57
votes
6 answers

Suppress "variable is never assigned" warning in IntelliJ IDEA

We use reflection extensively to set class field values in our code. The fields are accessed in code but they are never assigned except via reflection. So IDEA displays "is never assigned" warning. If I ask IDEA to suppress the inspection, it…
ililit
  • 1,309
  • 1
  • 12
  • 19
56
votes
3 answers

Android Studio - remove Security Exception warning

I'm getting the user's location through Location location = LocationServices.FusedLocationApi.getLastLocation( mGoogleApiClient); This line of code is inside a method and before calling this method I do check for Android run time…
54
votes
1 answer

Unsupported @SuppressWarnings("PMD.DoNotCallSystemExit")

I need to use System.exit(0) in an application. Eclipse has the PMD plugin installed and complains about this line of code. Adding @SuppressWarnings ("PMD.DoNotCallSystemExit") remove that warning but now I get a warning that this SuppressWarnings…
user342495
  • 1,453
  • 1
  • 11
  • 10
51
votes
11 answers

Suppress Database Project errors and warnings in visual studio 2010

I have an Database project in my application and want to suppress the errors/warnings thrown by this project. .first of all is it possible ? I think I was not clear with my question, by suppressing I meant that when I build my Solution, the…
Sumit
  • 2,932
  • 6
  • 32
  • 54
47
votes
2 answers

Java 6: Unsupported @SuppressWarnings("rawtypes") warning

I moved to a new machine which has the latest Sun's Java compiler and noticed some warnings in the existing Java 6 code. The Eclipse IDE, suggested that I annotate the assignment with: @SuppressWarnings("rawtypes") For example: class Foo
eold
  • 5,972
  • 11
  • 56
  • 75
45
votes
2 answers

Dynamic forwarding: suppress Incomplete Implementation warning

I have a class exposing some methods, whose implementation is provided by an inner object. I'm using forward invocation to dispatch at runtime the method calls to the inner object, but XCode is complaining since it cannot find an implementation of…
Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
42
votes
7 answers

CGContextSaveGState: invalid context 0x0 (Xcode 7 GM)

I have this problem after I compiled my code with Xcode 7 GM. According to Apple this is a bug, but it still seems to be an issue. Everything works fine, but is it possible to get rid of these errors? : CGContextSaveGState: invalid context 0x0. If…
Beto
  • 3,438
  • 5
  • 30
  • 37
40
votes
1 answer

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…
AR.
  • 39,615
  • 9
  • 44
  • 52
39
votes
5 answers

How to disable warning for redefining a constant when loading a file

Is there a way to disable warning: already initialized constant when loading particular files?
sawa
  • 165,429
  • 45
  • 277
  • 381
39
votes
1 answer

Kotlin: Suppress unused Property?

My source code is as follows: There are warnings : Property '****' is never used. I added "@Suppress("UNUSED_PARAMETER")", "@Suppress("UNUSED_PROPERTY_GETTER")", "@Suppress("UNUSED_PROPERTY_SETTER")", however, none of them work. How can I suppress…
user3239558
  • 1,757
  • 4
  • 18
  • 31
1 2
3
52 53