Skip to content

Commit cc5daad

Browse files
authored
Merge pull request #653 from headius/remove_ineffective_snakeyaml_settings
Remove SnakeYAML settings that don't work
2 parents e8188ce + 307c368 commit cc5daad

File tree

1 file changed

+0
-87
lines changed

1 file changed

+0
-87
lines changed

ext/java/org/jruby/ext/psych/PsychParser.java

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ public class PsychParser extends RubyObject {
104104
public static final String ENCODING_UTF8 = "UTF8";
105105
public static final String ENCODING_UTF16LE = "UTF16LE";
106106
public static final String ENCODING_UTF16BE = "UTF16BE";
107-
public static final String MAX_ALIASES_FOR_COLLECTIONS = "max_aliases_for_collections";
108-
public static final String ALLOW_DUPLICATE_KEYS = "allow_duplicate_keys";
109-
public static final String ALLOW_RECURSIVE_KEYS = "allow_recursive_keys";
110107
public static final String CODE_POINT_LIMIT = "code_point_limit";
111108

112109
public static void initPsychParser(Ruby runtime, RubyModule psych) {
@@ -124,9 +121,6 @@ public static void initPsychParser(Ruby runtime, RubyModule psych) {
124121

125122
// defaults for SnakeYAML load settings
126123
LoadSettings defaults = LoadSettings.builder().build();
127-
psychParser.setInternalVariable(MAX_ALIASES_FOR_COLLECTIONS, runtime.newFixnum(defaults.getMaxAliasesForCollections()));
128-
psychParser.setInternalVariable(ALLOW_DUPLICATE_KEYS, runtime.newBoolean(defaults.getAllowDuplicateKeys()));
129-
psychParser.setInternalVariable(ALLOW_RECURSIVE_KEYS, runtime.newBoolean(defaults.getAllowRecursiveKeys()));
130124
psychParser.setInternalVariable(CODE_POINT_LIMIT, runtime.newFixnum(defaults.getCodePointLimit()));
131125
}
132126

@@ -138,9 +132,6 @@ public PsychParser(Ruby runtime, RubyClass klass) {
138132
// prepare settings builder and apply global defaults
139133
LoadSettingsBuilder lsb = LoadSettings.builder();
140134
lsb.setSchema(new CoreSchema());
141-
lsb.setMaxAliasesForCollections(((IRubyObject) klass.getInternalVariable(MAX_ALIASES_FOR_COLLECTIONS)).convertToInteger().getIntValue());
142-
lsb.setAllowDuplicateKeys(((IRubyObject) klass.getInternalVariable(ALLOW_DUPLICATE_KEYS)).isTrue());
143-
lsb.setAllowRecursiveKeys(((IRubyObject) klass.getInternalVariable(ALLOW_RECURSIVE_KEYS)).isTrue());
144135
lsb.setCodePointLimit(((IRubyObject) klass.getInternalVariable(CODE_POINT_LIMIT)).convertToInteger().getIntValue());
145136
this.loadSettingsBuilder = lsb;
146137
}
@@ -538,42 +529,6 @@ public IRubyObject mark(ThreadContext context) {
538529
);
539530
}
540531

541-
@JRubyMethod(name = "max_aliases_for_collections=")
542-
public IRubyObject max_aliases_for_collections_set(IRubyObject max) {
543-
loadSettingsBuilder.setMaxAliasesForCollections(max.convertToInteger().getIntValue());
544-
545-
return max;
546-
}
547-
548-
@JRubyMethod(name = MAX_ALIASES_FOR_COLLECTIONS)
549-
public IRubyObject max_aliases_for_collections(ThreadContext context) {
550-
return context.runtime.newFixnum(buildSettings().getMaxAliasesForCollections());
551-
}
552-
553-
@JRubyMethod(name = "allow_duplicate_keys=")
554-
public IRubyObject allow_duplicate_keys_set(IRubyObject allow) {
555-
loadSettingsBuilder.setAllowDuplicateKeys(allow.isTrue());
556-
557-
return allow;
558-
}
559-
560-
@JRubyMethod(name = ALLOW_DUPLICATE_KEYS)
561-
public IRubyObject allow_duplicate_keys(ThreadContext context) {
562-
return RubyBoolean.newBoolean(context, buildSettings().getAllowDuplicateKeys());
563-
}
564-
565-
@JRubyMethod(name = "allow_recursive_keys=")
566-
public IRubyObject allow_recursive_keys_set(IRubyObject allow) {
567-
loadSettingsBuilder.setAllowRecursiveKeys(allow.isTrue());
568-
569-
return allow;
570-
}
571-
572-
@JRubyMethod(name = ALLOW_RECURSIVE_KEYS)
573-
public IRubyObject allow_recursive_keys(ThreadContext context) {
574-
return RubyBoolean.newBoolean(context, buildSettings().getAllowRecursiveKeys());
575-
}
576-
577532
@JRubyMethod(name = "code_point_limit=")
578533
public IRubyObject code_point_limit_set(IRubyObject limit) {
579534
loadSettingsBuilder.setCodePointLimit(limit.convertToInteger().getIntValue());
@@ -588,48 +543,6 @@ public IRubyObject code_point_limit(ThreadContext context) {
588543

589544
// class-level accessors for default values
590545

591-
@JRubyMethod(name = "max_aliases_for_collections=", meta = true)
592-
public static IRubyObject max_aliases_for_collections_set(ThreadContext context, IRubyObject self, IRubyObject max) {
593-
int maxAliasesForCollections = RubyNumeric.num2int(max);
594-
595-
if (maxAliasesForCollections <= 0) {
596-
throw context.runtime.newRangeError("max_aliases_for_collections must be positive");
597-
}
598-
599-
self.getInternalVariables().setInternalVariable(MAX_ALIASES_FOR_COLLECTIONS, max);
600-
601-
return max;
602-
}
603-
604-
@JRubyMethod(name = MAX_ALIASES_FOR_COLLECTIONS)
605-
public static IRubyObject max_aliases_for_collections(ThreadContext context, IRubyObject self) {
606-
return (IRubyObject) self.getInternalVariables().getInternalVariable(MAX_ALIASES_FOR_COLLECTIONS);
607-
}
608-
609-
@JRubyMethod(name = "allow_duplicate_keys=", meta = true)
610-
public static IRubyObject allow_duplicate_keys_set(IRubyObject self, IRubyObject allow) {
611-
self.getInternalVariables().setInternalVariable(ALLOW_DUPLICATE_KEYS, allow);
612-
613-
return allow;
614-
}
615-
616-
@JRubyMethod(name = ALLOW_DUPLICATE_KEYS, meta = true)
617-
public static IRubyObject allow_duplicate_keys(ThreadContext context, IRubyObject self) {
618-
return (IRubyObject) self.getInternalVariables().getInternalVariable(ALLOW_DUPLICATE_KEYS);
619-
}
620-
621-
@JRubyMethod(name = "allow_recursive_keys=", meta = true)
622-
public static IRubyObject allow_recursive_keys_set(IRubyObject self, IRubyObject allow) {
623-
self.getInternalVariables().setInternalVariable(ALLOW_RECURSIVE_KEYS, allow);
624-
625-
return allow;
626-
}
627-
628-
@JRubyMethod(name = ALLOW_RECURSIVE_KEYS, meta = true)
629-
public static IRubyObject allow_recursive_keys(ThreadContext context, IRubyObject self) {
630-
return (IRubyObject) self.getInternalVariables().getInternalVariable(ALLOW_RECURSIVE_KEYS);
631-
}
632-
633546
@JRubyMethod(name = "code_point_limit=", meta = true)
634547
public static IRubyObject code_point_limit_set(ThreadContext context, IRubyObject self, IRubyObject limit) {
635548
int codePointLimit = RubyNumeric.num2int(limit);

0 commit comments

Comments
 (0)