< prev index next >
src/java.base/share/classes/jdk/internal/nicl/types/References.java
Print this page
*** 27,37 ****
import jdk.internal.nicl.LibrariesHelper;
import jdk.internal.nicl.Util;
import java.nicl.Libraries;
! import java.nicl.metadata.NativeType;
import java.nicl.layout.Address;
import java.nicl.layout.Sequence;
import java.nicl.layout.Value;
import java.nicl.layout.Value.Kind;
import java.nicl.types.*;
--- 27,37 ----
import jdk.internal.nicl.LibrariesHelper;
import jdk.internal.nicl.Util;
import java.nicl.Libraries;
! import java.nicl.metadata.NativeStruct;
import java.nicl.layout.Address;
import java.nicl.layout.Sequence;
import java.nicl.layout.Value;
import java.nicl.layout.Value.Kind;
import java.nicl.types.*;
*** 651,664 ****
/**
* Create a struct reference factory from a given carrier class.
* @param clazz the native struct carrier.
* @param <T> the native struct type.
* @return a reference factory for native struct references.
! * @throws IllegalArgumentException if the carrier is not annotated with the {@link NativeType} annotation.
*/
public static <T extends Struct<T>> OfStruct<T> ofStruct(Class<T> clazz) throws IllegalArgumentException {
! if (!clazz.isAnnotationPresent(NativeType.class)) {
! throw new IllegalArgumentException("Not a native type carrier!");
}
return new OfStruct<>(clazz);
}
}
--- 651,664 ----
/**
* Create a struct reference factory from a given carrier class.
* @param clazz the native struct carrier.
* @param <T> the native struct type.
* @return a reference factory for native struct references.
! * @throws IllegalArgumentException if the carrier is not annotated with the {@link NativeStruct} annotation.
*/
public static <T extends Struct<T>> OfStruct<T> ofStruct(Class<T> clazz) throws IllegalArgumentException {
! if (!clazz.isAnnotationPresent(NativeStruct.class)) {
! throw new IllegalArgumentException("Not a native struct!");
}
return new OfStruct<>(clazz);
}
}
< prev index next >