Created
August 18, 2014 21:19
-
-
Save tateisu/55a284a086f4754e9b35 to your computer and use it in GitHub Desktop.
android.support.annotation の @nonnull が定数式以外に全く効果が無い件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// android.support.annotation の @NonNull が定数式以外に全く効果が無い件。 | |
// この場合は test() の3つ目は警告を出して欲しいだろう普通 | |
boolean f1( @NonNull String arg){ | |
return arg.contains( "foo" ); | |
} | |
@NonNull String getString(){ | |
return "foo"; | |
} | |
String getStringOrNull(){ | |
return (System.currentTimeMillis() %1) ==0 ? null : "foo"; | |
} | |
void test(){ | |
f1(null); // 警告が出る | |
f1(getString()); // 警告が出ない | |
f1(getStringOrNull()); // 警告が出ない | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment