-Xlint:unchecked

-Xlint:unchecked

von Christian Gasde -
Anzahl Antworten: 2

Hi,

in Coderunner I began a new "java_class" -project.

It's simple code that deals with generics.

While trying to run the code I get the following error:

"Note: __tester__.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details."

Where is the place to tell coderunner: -Xlint:unchecked ?

Thankx for help!

Best Regards
Chris

Als Antwort auf Christian Gasde

Re: -Xlint:unchecked

von Richard Lobb -
Compile parameters for a question or prototype are set via Customise > Advanced customisation > Sandbox > Parameters. Something like

{"compileargs": ["-Xrs", "-Xss8m", "-Xmx200m", "-Xlint:unchecked"]}

should work. But this will just result in more information about the unsafe operation - it won't turn the message off. AFAIK there's no way to disable the message completely, though I haven't used Java in years so you should check that.

If you want to filter the message from the output you have a much harder job. See this discussion.
Als Antwort auf Richard Lobb

Re: -Xlint:unchecked

von Christian Gasde -
Thank you very much! I'm not the admin, but I sent your information to our adminboard.

We found one other workaround:

@SuppressWarnings("unchecked") <------------- with this annotation our code is running in coderunner
public static void main(String[] args) {

/* getypte Orte mit Integer */
Integer[] iArr = {63, 98, 72, 4, 6, 63, 57, 55, 83, 29 };

Ort[] ortInts;
ortInts = new Ort[iArr.length]; <----PROBLEM: Type safety: The expression of type Ort[] needs unchecked conversion to conform to Ort[]
...

In Eclpise we only get a warning, but the execution doesn't stop. ....

Best Regards
Chris