From 9fa233451423182ac989fd8b60ac4992001b929c Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Wed, 6 Mar 2024 05:01:51 -0600 Subject: [PATCH] Remove all references to CompatVersion --- core/pom.rb | 1 - core/pom.xml | 1 - .../main/java/org/jruby/CompatVersion.java | 53 ------------------- .../java/org/jruby/RubyInstanceConfig.java | 9 ---- core/src/main/java/org/jruby/RubyModule.java | 2 - .../java/org/jruby/anno/AnnotationBinder.java | 2 - .../main/java/org/jruby/anno/IndyBinder.java | 2 - .../main/java/org/jruby/anno/JRubyMethod.java | 3 -- .../embed/EmbedRubyInstanceConfigAdapter.java | 6 --- .../org/jruby/embed/ScriptingContainer.java | 12 +---- .../org/jruby/management/ConfigMBean.java | 5 -- .../jruby/embed/ScriptingContainerTest.java | 24 --------- .../org/jruby/test/TestMethodFactories.java | 1 - 13 files changed, 1 insertion(+), 120 deletions(-) delete mode 100644 core/src/main/java/org/jruby/CompatVersion.java diff --git a/core/pom.rb b/core/pom.rb index c53301cf95d..f98e1c1fdf1 100644 --- a/core/pom.rb +++ b/core/pom.rb @@ -194,7 +194,6 @@ 'org/jruby/anno/AnnotationBinder.java', 'org/jruby/anno/JRubyMethod.java', 'org/jruby/anno/FrameField.java', - 'org/jruby/CompatVersion.java', 'org/jruby/runtime/Visibility.java', 'org/jruby/util/CodegenUtils.java', 'org/jruby/util/SafePropertyAccessor.java' ] ) diff --git a/core/pom.xml b/core/pom.xml index 0d937c54655..1f276707474 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -429,7 +429,6 @@ DO NOT MODIFY - GENERATED CODE org/jruby/anno/AnnotationBinder.java org/jruby/anno/JRubyMethod.java org/jruby/anno/FrameField.java - org/jruby/CompatVersion.java org/jruby/runtime/Visibility.java org/jruby/util/CodegenUtils.java org/jruby/util/SafePropertyAccessor.java diff --git a/core/src/main/java/org/jruby/CompatVersion.java b/core/src/main/java/org/jruby/CompatVersion.java deleted file mode 100644 index f4c5ff1b1a2..00000000000 --- a/core/src/main/java/org/jruby/CompatVersion.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jruby; - -@Deprecated -public enum CompatVersion { - - @Deprecated RUBY1_8, - @Deprecated RUBY1_9, - @Deprecated RUBY2_0, - @Deprecated RUBY2_1, - @Deprecated BOTH; - - @Deprecated - public boolean is1_9() { - return this == RUBY1_9 || this == RUBY2_0 || this == RUBY2_1; - } - - @Deprecated - public boolean is2_0() { - return this == RUBY2_0 || this == RUBY2_1; - } - - @Deprecated - public static CompatVersion getVersionFromString(String compatString) { - if (compatString.equalsIgnoreCase("RUBY1_8")) { - return CompatVersion.RUBY1_8; - } else if (compatString.equalsIgnoreCase("1.8")) { - return CompatVersion.RUBY1_8; - } else if (compatString.equalsIgnoreCase("RUBY1_9")) { - return CompatVersion.RUBY1_9; - } else if (compatString.equalsIgnoreCase("1.9")) { - return CompatVersion.RUBY1_9; - } else if (compatString.equalsIgnoreCase("RUBY2_0")) { - return CompatVersion.RUBY2_0; - } else if (compatString.equalsIgnoreCase("2.0")) { - return CompatVersion.RUBY2_0; - } else if (compatString.equalsIgnoreCase("RUBY2_1")) { - return CompatVersion.RUBY2_1; - } else if (compatString.equalsIgnoreCase("2.1")) { - return CompatVersion.RUBY2_1; - } else { - return null; - } - } - - @Deprecated - public static boolean shouldBindMethod(CompatVersion runtimeVersion, CompatVersion methodVersion) { - if (runtimeVersion == RUBY1_8) return methodVersion == RUBY1_8 || methodVersion == BOTH; - if (runtimeVersion == RUBY1_9) return methodVersion == RUBY1_9 || methodVersion == BOTH; - if (runtimeVersion == RUBY2_0) return methodVersion == RUBY1_9 || methodVersion == RUBY2_0 || methodVersion == BOTH; - if (runtimeVersion == RUBY2_1) return methodVersion == RUBY1_9 || methodVersion == RUBY2_0 || methodVersion == RUBY2_1 || methodVersion == BOTH; - return false; - } -} diff --git a/core/src/main/java/org/jruby/RubyInstanceConfig.java b/core/src/main/java/org/jruby/RubyInstanceConfig.java index 63d5c845c14..b75083aca91 100644 --- a/core/src/main/java/org/jruby/RubyInstanceConfig.java +++ b/core/src/main/java/org/jruby/RubyInstanceConfig.java @@ -1946,15 +1946,6 @@ public boolean getIPv4Preferred() { return Options.PREFER_IPV4.load(); } - @Deprecated - public CompatVersion getCompatVersion() { - return CompatVersion.RUBY2_1; - } - - @Deprecated - public void setCompatVersion(CompatVersion compatVersion) { - } - @Deprecated public boolean isJitDumping() { return jitDumping; diff --git a/core/src/main/java/org/jruby/RubyModule.java b/core/src/main/java/org/jruby/RubyModule.java index 32f00280a72..21f8f8f6ec6 100644 --- a/core/src/main/java/org/jruby/RubyModule.java +++ b/core/src/main/java/org/jruby/RubyModule.java @@ -1307,8 +1307,6 @@ public void clump(final Method[] declaredMethods) { if (anno == null) continue; - if (anno.compat() == org.jruby.CompatVersion.RUBY1_8) continue; - // skip bridge methods, as generated by JDK8 javac for e.g. return-value overloaded methods if (method.isBridge()) continue; diff --git a/core/src/main/java/org/jruby/anno/AnnotationBinder.java b/core/src/main/java/org/jruby/anno/AnnotationBinder.java index 94042cd1d52..47b0f356e3e 100644 --- a/core/src/main/java/org/jruby/anno/AnnotationBinder.java +++ b/core/src/main/java/org/jruby/anno/AnnotationBinder.java @@ -181,8 +181,6 @@ public void processType(TypeElement cd) { if (anno == null) continue; - if (anno.compat() == org.jruby.CompatVersion.RUBY1_8) continue; - methodCount++; checkForThrows(cd, method); diff --git a/core/src/main/java/org/jruby/anno/IndyBinder.java b/core/src/main/java/org/jruby/anno/IndyBinder.java index 8e62bc2d51c..07c477c0eb1 100644 --- a/core/src/main/java/org/jruby/anno/IndyBinder.java +++ b/core/src/main/java/org/jruby/anno/IndyBinder.java @@ -192,8 +192,6 @@ public void processType(TypeElement cd) { JRubyMethod anno = method.getAnnotation(JRubyMethod.class); if (anno == null) continue; - if (anno.compat() == org.jruby.CompatVersion.RUBY1_8) continue; - methodCount++; AnnotationBinder.checkForThrows(cd, method); diff --git a/core/src/main/java/org/jruby/anno/JRubyMethod.java b/core/src/main/java/org/jruby/anno/JRubyMethod.java index e77cac9b1ad..39c53552dae 100644 --- a/core/src/main/java/org/jruby/anno/JRubyMethod.java +++ b/core/src/main/java/org/jruby/anno/JRubyMethod.java @@ -122,9 +122,6 @@ @Deprecated boolean scope() default false; - @Deprecated - org.jruby.CompatVersion compat() default org.jruby.CompatVersion.BOTH; - @Deprecated boolean backtrace() default false; } diff --git a/core/src/main/java/org/jruby/embed/EmbedRubyInstanceConfigAdapter.java b/core/src/main/java/org/jruby/embed/EmbedRubyInstanceConfigAdapter.java index 4033f6a7876..afe7335a802 100644 --- a/core/src/main/java/org/jruby/embed/EmbedRubyInstanceConfigAdapter.java +++ b/core/src/main/java/org/jruby/embed/EmbedRubyInstanceConfigAdapter.java @@ -446,10 +446,4 @@ public interface EmbedRubyInstanceConfigAdapter { * @return version information. */ public String getSupportedRubyVersion(); - - @Deprecated - public org.jruby.CompatVersion getCompatVersion(); - - @Deprecated - public void setCompatVersion(org.jruby.CompatVersion version); } diff --git a/core/src/main/java/org/jruby/embed/ScriptingContainer.java b/core/src/main/java/org/jruby/embed/ScriptingContainer.java index 32dbea57fe1..9c19c4a0246 100644 --- a/core/src/main/java/org/jruby/embed/ScriptingContainer.java +++ b/core/src/main/java/org/jruby/embed/ScriptingContainer.java @@ -441,8 +441,7 @@ public void setError(Writer writer) { /** * Returns a compile mode currently chosen, which is one of CompileMode.JIT, - * CompileMode.FORCE, CompileMode.OFF. The default mode is CompileMode.OFF - * if CompatVersion.RUBY1_9 is chosen, otherwise, CompileMode.JIT. Also, + * CompileMode.FORCE, CompileMode.OFF. The default mode is CompileMode.JIT. Also, * CompileMode.OFF is chosen when a security restriction is set. * * @since JRuby 1.5.0. @@ -1939,13 +1938,4 @@ private String createUri(ClassLoader cl, String ref) { protected void addGemPath(String uri) { runScriptlet( "require 'rubygems';Gem::Specification.add_dir '" + uri + "' unless Gem::Specification.dirs.member?( '" + uri + "' )" ); } - - @Deprecated - public org.jruby.CompatVersion getCompatVersion() { - return provider.getRubyInstanceConfig().getCompatVersion(); - } - - @Deprecated - public void setCompatVersion(org.jruby.CompatVersion version) { - } } diff --git a/core/src/main/java/org/jruby/management/ConfigMBean.java b/core/src/main/java/org/jruby/management/ConfigMBean.java index a96d8eed450..d450187a4d6 100644 --- a/core/src/main/java/org/jruby/management/ConfigMBean.java +++ b/core/src/main/java/org/jruby/management/ConfigMBean.java @@ -38,9 +38,4 @@ public interface ConfigMBean { public boolean isFullTraceEnabled(); public boolean isShowBytecode(); public String getExcludedMethods(); - - @Deprecated - default String getCompatVersion() { - return org.jruby.CompatVersion.RUBY2_1.name(); - } } diff --git a/core/src/test/java/org/jruby/embed/ScriptingContainerTest.java b/core/src/test/java/org/jruby/embed/ScriptingContainerTest.java index cb2d8df3010..0f97767743f 100644 --- a/core/src/test/java/org/jruby/embed/ScriptingContainerTest.java +++ b/core/src/test/java/org/jruby/embed/ScriptingContainerTest.java @@ -2686,28 +2686,4 @@ public void testJavadocExample4() { // } // } -// NOTE: test makes no sense on 9K -// @Test -// public void testSystemPropertyCatcherSetCompatVersion() { -// ScriptingContainer container; -// -// System.setProperty(PropertyName.COMPATVERSION.toString(), "1.8"); -// container = new ScriptingContainer(LocalContextScope.THREADSAFE); -// org.jruby.embed.util.SystemPropertyCatcher.setConfiguration(container); -// assertEquals("1.8.7", container.runScriptlet("RUBY_VERSION")); -// container.terminate(); -// -// System.setProperty(PropertyName.COMPATVERSION.toString(), "RUBY2_0"); -// container = new ScriptingContainer(LocalContextScope.SINGLETHREAD); -// org.jruby.embed.util.SystemPropertyCatcher.setConfiguration(container); -// assertEquals("2.0.0", container.runScriptlet("RUBY_VERSION")); -// container.terminate(); -// -// System.setProperty(PropertyName.COMPATVERSION.toString(), "1.9"); -// container = new ScriptingContainer(LocalContextScope.SINGLETHREAD); -// org.jruby.embed.util.SystemPropertyCatcher.setConfiguration(container); -// assertEquals("1.9.3", container.runScriptlet("RUBY_VERSION")); -// container.terminate(); -// } - } diff --git a/core/src/test/java/org/jruby/test/TestMethodFactories.java b/core/src/test/java/org/jruby/test/TestMethodFactories.java index a83b8bbfffd..a13dc251394 100644 --- a/core/src/test/java/org/jruby/test/TestMethodFactories.java +++ b/core/src/test/java/org/jruby/test/TestMethodFactories.java @@ -28,7 +28,6 @@ package org.jruby.test; -import org.jruby.CompatVersion; import org.jruby.Ruby; import org.jruby.RubyMethod; import org.jruby.RubyModule;