S
S
Satangelus2018-07-19 19:18:07
Java
Satangelus, 2018-07-19 19:18:07

How to catch code that causes compilation error "uses unchecked or unsafe operations."?

Looks like the code hasn't changed. When compiling, the studio began to give an error:
MyKoteGame.java: uses unchecked or unsafe operations. Recompile with -Xlint:unchecked for details.
Not pointing to the error line. There is a lot of code, how to catch, where does the error come from?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2018-07-19
@Satangelus

Open build.gradle, find the allprojects section, add to it

allprojects {
    ...

    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked"
        }
    }   
}

and try building the project again. You will be directed to the lines.

G
GavriKos, 2018-07-19
@GavriKos

Read the error carefully.
Set this flag and you will have more details.
Most likely you are using collections somewhere without specifying the exact type

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question