         ]
         Proxy: [
           o 'defineClass0(L!/!/ClassLoader;L!/!/String;[BII)L!/!/Class;', (rs,cl,name,bytes,offset,len) ->
-              raw_bytes = ((256+b)%256 for b in bytes.array[offset...offset+len])  # convert to unsigned bytes
-              rs.define_class util.int_classname(name.jvm2js_str()), raw_bytes, cl
+              native_define_class rs, name, bytes, offset, len, cl
         ]
       Runtime: [
         o 'availableProcessors()I', () -> 1

        o 'getCaller(I)L!/!/Class;', (rs, i) ->
            type = rs.meta_stack().get_caller(i).method.class_type
            rs.jclass_obj(type, true)
        o 'defineClass1(L!/!/String;[BIIL!/security/ProtectionDomain;L!/!/String;)L!/!/Class;', (rs,_this,name,bytes,offset,len,pd,source) ->
            raw_bytes = ((256+b)%256 for b in bytes.array[offset...offset+len])  # convert to unsigned bytes
            rs.define_class util.int_classname(name.jvm2js_str()), raw_bytes, _this
        o 'resolveClass0(L!/!/Class;)V', (rs, _this, cls) ->
            rs.load_class cls.$type, true
      ],

    true
  else
    false

# avoid code dup among native methods
native_define_class = (rs, name, bytes, offset, len, loader) ->
  raw_bytes = ((256+b)%256 for b in bytes.array[offset...offset+len])  # convert to raw bytes
  rs.define_class util.int_classname(name.jvm2js_str()), raw_bytes, loader

native_methods =
  java:
