Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AntonPanikov opened this issue Apr 21, 2017 · 1 comment
Closed

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

AntonPanikov opened this issue Apr 21, 2017 · 1 comment

Comments

@AntonPanikov
Copy link

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

@eric-milles
Copy link
Member

Literal is built with the sign character included (which is not correct for JDT) in org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.UnitPopulator.createConstantExpression. I will get this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants