14. Slide # JGGUG G*Workshop Copyright(C) 2013 NTT Software Corporation All rights reserved.
静的型チェックにより検出されるエラー例
11
import
groovy.transform.TypeChecked
@TypeChecked
int
foo(String
s)
{
int
i
=
s
//
[Static
type
checking]
-‐
Cannot
assign
value
of
type
java.lang.String
to
variable
of
type
int
String
result
=
s.toUppperCase()
//
[Static
type
checking]
-‐
Cannot
find
matching
method
java.lang.String#toUppperCase().
Please
check
if
the
declared
type
is
right
and
if
the
method
exists.
return
result
//
[Static
type
checking]
-‐
Cannot
return
value
of
type
java.lang.String
on
method
returning
type
int
}
型が違う!
そんなメソッド無い!
型が違う!
13年5月11日土曜日