Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate some new Class APIs. #85

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ private static Class<?> forName(Module module, String name, Class<?> caller) {
* @jls 15.8.2 Class Literals
* @since 22
*/
public static Class<?> forPrimitiveName(String primitiveName) {
public static @Nullable Class<?> forPrimitiveName(String primitiveName) {
return switch(primitiveName) {
// Integral types
case "int" -> int.class;
Expand Down Expand Up @@ -2683,7 +2683,7 @@ public Field[] getDeclaredFields() throws SecurityException {
* @since 16
*/
@CallerSensitive
public RecordComponent[] getRecordComponents() {
public RecordComponent @Nullable [] getRecordComponents() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Expand Down Expand Up @@ -4700,7 +4700,7 @@ public String descriptorString() {
* @since 12
*/
@Override
public Class<?> componentType() {
public @Nullable Class<?> componentType() {
return isArray() ? componentType : null;
}

Expand Down Expand Up @@ -4789,7 +4789,7 @@ public Optional<ClassDesc> describeConstable() {
* @since 17
*/
@CallerSensitive
public Class<?>[] getPermittedSubclasses() {
public Class<?> @Nullable [] getPermittedSubclasses() {
Class<?>[] subClasses;
if (isArray() || isPrimitive() || (subClasses = getPermittedSubclasses0()) == null) {
return null;
Expand Down
Loading