Eva
Eva

Reputation: 4690

Can I set compiler preferences to ignore for “A generic array is created for a varargs parameter”?

I'm having the same problem as the person who asked this question.

Specifically, the warning is

Type safety: A generic array of Object&Serializable&Comparable is created for a varargs parameter

on this line of code

Collections.addAll(row, name, units, Boolean.FALSE);
// types: List<Object>, String, Integer, Boolean

The solutions posted were lovely, but I was wondering if Eclipse provides another way. Can I change the compiler preferences to ignore that sort of type safety warning? If so, which one would I change?

EDIT: So far, I've tried all the ones in generic types and "Inexact type match for varargs" in Potential Programming Problems." Are there warnings Eclipse won't let me ignore or is there a different one I can turn off?

Upvotes: 1

Views: 305

Answers (1)

Audrius Meškauskas
Audrius Meškauskas

Reputation: 21718

In Eclipse, you can disable any warnings, and also you can enable some warnings that are disabled by default, under Project->Properties->Java Compiler->Errors / Warnings:

Disable compilation warnings Eclipse

Upvotes: 3

Related Questions