Skip to content

The literal -1 of type int is out of range #285

@AntonPanikov

Description

@AntonPanikov

As soon as you have any other compile errors in your code, any constant (static final fields) of type int and long produce an additional compiler error:

The literal -1 of type int is out of range

and by the way -1 is not out for range of int or long. You can easily reproduce it by the next example:

package test

class Test {

    static final long VAR = -1  // this will be marked as compile error with message: 'The literal -1 of type int is out of range' as soon as you have any other compile error, like type 'qwe' in the main()

    static main(args) {
        qwe // compile error on purpose, comment it out to see the difference
        println 'hello groovy'
    }

}

I am using groovy-eclispe of: Groovy-Eclipse Feature 2.9.2.xx-201704202017-e46 org.codehaus.groovy.eclipse.feature.feature.group Codehaus.org

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions