Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

avoid using deprecated setTypeMapper

  • Loading branch information...
commit 65d68b8d706ecbc74f07857096950501f9d74482 1 parent 44b4bc0
@twall twall authored
View
2  .classpath
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" output="jna/build.eclipse/test-classes" path="contrib/platform/test"/>
+ <classpathentry kind="src" path="contrib/platform/src"/>
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
View
10 src/com/sun/jna/Structure.java
@@ -198,7 +198,7 @@ protected Structure(Pointer p, int alignType) {
protected Structure(Pointer p, int alignType, TypeMapper mapper) {
setAlignType(alignType);
- setTypeMapper(mapper);
+ initializeTypeMapper(mapper);
if (p != null) {
useMemory(p);
}
@@ -231,6 +231,14 @@ TypeMapper getTypeMapper() {
* or {@link #Structure(Pointer,int,TypeMapper)} constructors instead.
*/
protected void setTypeMapper(TypeMapper mapper) {
+ initializeTypeMapper(mapper);
+ }
+
+ /** Initialize the type mapper for this structure.
+ * If <code>null</code>, the default mapper for the
+ * defining class will be used.
+ */
+ private void initializeTypeMapper(TypeMapper mapper) {
if (mapper == null) {
Class declaring = getClass().getDeclaringClass();
if (declaring != null) {
View
3  test/com/sun/jna/TypeMapperTest.java
@@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.Map;
+
import junit.framework.TestCase;
//@SuppressWarnings("unused")
@@ -133,7 +134,7 @@ public Class nativeType() {
public static interface StructureTestLibrary extends Library {
public static class TestStructure extends Structure {
public TestStructure(TypeMapper mapper) {
- setTypeMapper(mapper);
+ super(mapper);
}
public boolean data;
}
Please sign in to comment.
Something went wrong with that request. Please try again.