From 221b11d3ff9d247d4ca2646be2a68be543d7185a Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Mon, 28 Oct 2019 11:36:42 -0500 Subject: [PATCH] Just use the Ruby definition of this type. --- .../java/org/jruby/ext/ffi/StructLayout.java | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/core/src/main/java/org/jruby/ext/ffi/StructLayout.java b/core/src/main/java/org/jruby/ext/ffi/StructLayout.java index 3e6c5782a5b..62f508fe034 100644 --- a/core/src/main/java/org/jruby/ext/ffi/StructLayout.java +++ b/core/src/main/java/org/jruby/ext/ffi/StructLayout.java @@ -145,11 +145,6 @@ public static RubyClass createStructLayoutClass(Ruby runtime, RubyModule module) ArrayFieldAllocator.INSTANCE, layoutClass); arrayFieldClass.defineAnnotatedMethods(ArrayField.class); - RubyClass mappedFieldClass = runtime.defineClassUnder("Mapped", fieldClass, - MappedFieldAllocator.INSTANCE, layoutClass); - mappedFieldClass.defineAnnotatedMethods(MappedField.class); - - return layoutClass; } @@ -894,39 +889,6 @@ public final IRubyObject initialize(ThreadContext context, IRubyObject[] args) { } } - private static final class MappedFieldAllocator implements ObjectAllocator { - public final IRubyObject allocate(Ruby runtime, RubyClass klass) { - return new MappedField(runtime, klass); - } - private static final ObjectAllocator INSTANCE = new MappedFieldAllocator(); - } - - @JRubyClass(name="FFI::StructLayout::Mapped", parent="FFI::StructLayout::Field") - public static final class MappedField extends Field { - - public MappedField(Ruby runtime, RubyClass klass) { - super(runtime, klass, DefaultFieldIO.INSTANCE); - } - - @JRubyMethod(required = 4, visibility = PRIVATE) - public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { - if (!(args[2] instanceof MappedType)) { - throw context.runtime.newTypeError(args[2], - context.runtime.getModule("FFI").getClass("Type").getClass("Mapped")); - } - - if (!(args[3] instanceof Field)) { - throw context.runtime.newTypeError(args[3], - context.runtime.getModule("FFI").getClass("StructLayout").getClass("Field")); - } - - init(args[0], args[2], args[1], new MappedFieldIO((MappedType) args[2], ((Field) args[3]).getFieldIO())); - - return this; - } - } - - public static interface Storage { IRubyObject getCachedValue(Member member); void putCachedValue(Member member, IRubyObject value);