Questions tagged [unchecked]

An option "unchecked" used to turn off a javac compiler warnings about failing to use generics because it does not have enough type information to perform all type checks necessary to ensure type safety.

The term "unchecked" means that the javac compiler does not have enough type information to perform all type checks necessary to ensure type safety. The "unchecked" warning is disabled, by default, though the compiler gives a hint. To see all "unchecked" warnings, recompile with -Xlint:unchecked.

In JDK 1.5 an annotation was introduced called SuppressWarnings. It could be used to insert the annotation prior to a class or method telling which sort of warning you want suppressed.

A @SuppressWarning option unchecked used to turn off a javac compiler warnings about failing to use generics.

234 questions
8
votes
1 answer

jquery button to uncheck checkboxes

This task seemed to be very easy, though my code doesn't work. I have table with some rows, each row has a checkbox, underneath I put button "Remove all" to uncheck checkboxes. This is my code: $('#remove-button').click(function(){ …
kuba0506
  • 425
  • 1
  • 7
  • 19
8
votes
5 answers

The local variable might not have been initialized - Detect unchecked exception throw within a method

I have some code with this structure: public void method() { Object o; try { o = new Object(); } catch (Exception e) { //Processing, several lines throw new Error(); //Our own unchecked exception } …
Luis Sep
  • 2,334
  • 4
  • 25
  • 32
7
votes
2 answers

Avoiding unchecked warnings when using Mockito

I'd like to mock a call on ScheduledExecutorService to return mock of ScheduledFuture class when method schedule is invoked. The following code compiles and works correctly: ScheduledExecutorService executor =…
Michal Kordas
  • 9,161
  • 7
  • 42
  • 81
7
votes
1 answer

Overloading the + operator so it is sensitive to being called in a checked or unchecked context

UPDATE: I've found the answer, which I will post in a couple of days if nobody else does. I am creating a numeric struct, so I am overloading the arithmetical operators. Here is an example for a struct that represents a 4-bit unsigned…
phoog
  • 39,474
  • 5
  • 73
  • 110
7
votes
1 answer

Good practices for Java exceptions handling

I have some questions regarding handling exceptions in Java. I read a bit about it and got some contradicting guidelines. Best Practices for Exception Handling Let's go through the mentioned article: It states that one should generally avoid using…
Michał Wróbel
  • 548
  • 1
  • 4
  • 13
6
votes
1 answer

System.OverflowException in unchecked block of C#

If I pass Int32.MinValue and -1 into the Divide() method, I get a System.OverflowException despite the block happening in an unchecked block. private static int Divide(int n, int d) { return unchecked (n / d); } This is…
will_w
  • 73
  • 6
6
votes
6 answers

Java unchecked/checked exception clarification

I've been reading about unchecked versus checked questions, none of the online resources have been truly clear about the difference and when to use both. From what I understand, both of them get thrown at runtime, both of them represent program…
donnyton
  • 5,668
  • 9
  • 39
  • 59
6
votes
2 answers

Dagger 2 unchecked warnings

In a project where I'm currently working on I've experienced some unchecked warnings related to Dagger 2. To exclude project related factors I've tried compiling the Dagger 2 examples provided on GitHub and they are also causing these unchecked…
Ben Groot
  • 4,915
  • 3
  • 38
  • 44
6
votes
1 answer

How do i get rid of these (unchecked call) warnings?

warning: [unchecked] unchecked call to setCellValueFactory(Callback,ObservableValue>) as a member of the raw type TableColumn column1.setCellValueFactory(new PropertyValueFactory("name")); where S,T are…
Markus Paul
  • 125
  • 1
  • 2
  • 7
6
votes
5 answers

not able to unchecked the already checked radio button in dynamic radio group

If I set a radio button to be selected on the first time, it works fine. But if I unselect it by calling .setChecked(false); then, later even if I try to make it selected by calling setChecked(true) will not unselect the previous one. private…
sameer balouria
  • 661
  • 7
  • 19
6
votes
2 answers

How to suppress overflow-checking in PowerShell?

PowerShell seems to perform bounds-checking after arithmetic operations and conversions. For instance, the following operations fail: [byte]$a = 255 $a++ $a = [byte]256 Is there any way to enforce overflows or the typecast without resorting to a…
6
votes
5 answers

Convert -1 to uint C#

Converting -1 to uint will not work "((uint)(-1))" solution? num10 = ((uint)(-1)) >> (0x20 - num9); Error: Constant value '-1' cannot be converted to a 'uint' (use 'unchecked' syntax to override)
user2089096
  • 111
  • 1
  • 1
  • 2
5
votes
4 answers

Optimize C# Code Fragment

I'm profiling some C# code. The method below is one of the most expensive ones. For the purpose of this question, assume that micro-optimization is the right thing to do. Is there an approach to improve performance of this method? Changing the…
Eric J.
  • 139,555
  • 58
  • 313
  • 529
5
votes
3 answers

do checked exceptions happen at run-time?

I am confused with the naming of runtime exception of java. Those checked exceptions, like SQLexception, also happen during the execution of a program. Why only those unchecked ones called runtime exception? It is probably I have misunderstanding…
paul paul
  • 93
  • 1
  • 5
5
votes
1 answer

How to Improve Performance of C# Object Mapping Code

How can I further improve the performance of the code below while still maintaining the public interface: public interface IMapper { void Map(TSource source, TDestination destination); } public static TDestination…
Muhammad Rehan Saeed
  • 28,236
  • 27
  • 169
  • 261
1 2
3
15 16