Skip to content

Instantly share code, notes, and snippets.

@lopex
Created May 12, 2015 18:12
Show Gist options
  • Save lopex/bcd261403d093672c52f to your computer and use it in GitHub Desktop.
Save lopex/bcd261403d093672c52f to your computer and use it in GitHub Desktop.
require 'nokogiri'
include Java
mods = java.lang.reflect.Field.java_class.declared_field('modifiers')
mods.accessible = true
Field = java.lang.reflect.Field
cls = Java::nokogiri.internals.c14n.CanonicalizerBase
field = cls.java_class.declared_field('COMPARE')
field.accessible = true
mods.to_java(Field).set_int(field.to_java(Field), field.modifiers & ~java.lang.reflect.Modifier::FINAL)
field.set_value(nil, nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment