Demo.java:13: warning: [cast.unsafe] cast from "@PossiblyUnencrypted String" to "@Encrypted String" cannot be statically verified return (@Encrypted String) new String(b); ^ Demo.java:36: error: [argument.type.incompatible] incompatible types in argument. sendOverTheInternet(password); // invalid ^ found : @PossiblyUnencrypted String required: @Encrypted String 1 error 1 warning