final class Main {
public static void main
(String[] args
) {}
// Static methods cannot be overridden, only hidden
@SafeVarargs
public static void method1
(Object...
objs) {} // Final methods cannot be overridden
@SafeVarargs
public final void method2
(Object...
objs) {} // Private methods cannot be overridden, only hidden
@SafeVarargs
private void method3
(Object...
objs) {} // Final classes cannot be subclassed, so in fact none of these methods can be overridden
@SafeVarargs
public void method4
(Object...
objs) {}
}
ZmluYWwgY2xhc3MgTWFpbiB7CgkKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHt9CgkKCS8vIFN0YXRpYyBtZXRob2RzIGNhbm5vdCBiZSBvdmVycmlkZGVuLCBvbmx5IGhpZGRlbgoJQFNhZmVWYXJhcmdzIHB1YmxpYyBzdGF0aWMgdm9pZCBtZXRob2QxKE9iamVjdC4uLiBvYmpzKSB7fQoJLy8gRmluYWwgbWV0aG9kcyBjYW5ub3QgYmUgb3ZlcnJpZGRlbgoJQFNhZmVWYXJhcmdzIHB1YmxpYyBmaW5hbCB2b2lkIG1ldGhvZDIoT2JqZWN0Li4uIG9ianMpIHt9CgkvLyBQcml2YXRlIG1ldGhvZHMgY2Fubm90IGJlIG92ZXJyaWRkZW4sIG9ubHkgaGlkZGVuCglAU2FmZVZhcmFyZ3MgcHJpdmF0ZSB2b2lkIG1ldGhvZDMoT2JqZWN0Li4uIG9ianMpIHt9CgkvLyBGaW5hbCBjbGFzc2VzIGNhbm5vdCBiZSBzdWJjbGFzc2VkLCBzbyBpbiBmYWN0IG5vbmUgb2YgdGhlc2UgbWV0aG9kcyBjYW4gYmUgb3ZlcnJpZGRlbgoJQFNhZmVWYXJhcmdzIHB1YmxpYyB2b2lkIG1ldGhvZDQoT2JqZWN0Li4uIG9ianMpIHt9CgkKfQ==
Main.java:10: error: Invalid SafeVarargs annotation. Instance method method3(Object...) is not final.
@SafeVarargs private void method3(Object... objs) {}
^
Main.java:12: error: Invalid SafeVarargs annotation. Instance method method4(Object...) is not final.
@SafeVarargs public void method4(Object... objs) {}
^
2 errors