Autoboxing can’t convert an int to an Integer

You need to have your language level set to at least 1.5/5.0 to take advantage of autoboxing/unboxing.

Change your settings in Project --> Properties --> Java Compiler, chances are, it’s not set to the right level.

Note this is NOT directly tied to the version of the JDK you’re using, it simply means the level in which your java code will be interpreted as if it were no higher than the language level version, using any particular version of the JDK that is at least at or higher than the given language level setting.

IE: you’re using JDK 1.8+, setting your language level to 5.0 means you will only be able to use java features that are up to JDK 1.5.

Leave a Comment