Ali
Ali

Reputation: 267267

Play framework: type Integer is deprecated: use java.lang.Integer instead

Since PlayFramework doesn't seem to allow primitive java types (e.g int, long) in routes, I've had to resort to using Integer in the routes, e.g:

GET /paginate/:page controllers.Foo.paginate(page: Integer)

However, when starting the app, I get a ton of warnings saying:

[warn] /project/target/scala-2.9.1/src_managed/main/routes_reverseRouting.scala:351: type Integer is deprecated: use java.lang.Integer instead
[warn] def paginate(page:Integer) = new play.api.mvc.HandlerRef(

Wtf is this about? Do I now have to specify java.lang.Integer in all my routes? Or am I missing something?

Upvotes: 2

Views: 1467

Answers (1)

Gonfi den Tschal
Gonfi den Tschal

Reputation: 1764

1) In the routes file: replace "Integer" with "Int". You may want to specify a default value. Example:

GET  /my/path  controllers.MyController.foo(value:Int ?= 0)

2) In the (Java) controller: change Integer to int

public static Result foo(int value) {}

I found the warning "type Integer is deprecated: use java.lang.Integer instead" very confusing too.

Upvotes: 3

Related Questions