@Retention(value=RUNTIME) @Target(value={TYPE_USE,METHOD}) public @interface Self
Self
to achieve Self
type behavior.
Note the ElementType.METHOD
target is for internal use only.
This is necessary for generated code where even though the code applies the
Self
annotation at the method return type position Java 8 misinterprets
it as a Method annotation, hence the METHOD target here. The METHOD target type
will be removed in a future release.
See the Self Type documentation
for more information.Modifier and Type | Optional Element and Description |
---|---|
boolean |
value
value is exclusive to array extension methods. |
public abstract boolean value
value
is exclusive to array extension methods. Setting to true
accesses the array's core
component type instead of the array type itself. E.g.,
public class MyArrayExtension { public static List<@Self(true) Object> toList(@This Object array) { return Arrays.asList((Object[])array); }
Copyright © 2024. All rights reserved.