Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@
if (hash.isBuiltin(this)) return id;

// we truncate for Java hashcode
return (int) hash.call(context, this, this).convertToInteger().getLongValue();

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Dependency check

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain,test -Dinvoker.test=extended (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 25 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Build JRuby release artifacts (21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / jruby-tests-dev

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 21 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Build JRuby release artifacts (21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby_complete_jar_extended -Dinvoker.skip=true (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / regression-specs-jit

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / sequel

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / concurrent-ruby

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 21 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 21 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / regression-specs-jit

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / run specs repeatedly to test optimizations

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Verify build artifacts

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / language specs (Windows, Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pdist (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 25 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 25 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest, rake test:jruby (Windows, Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 21 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars,test -Dinvoker.test=extended (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest (OpenJ9 Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 25 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / language specs (Windows, Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 26 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby_complete_jar_extended -Dinvoker.skip=true (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain,test -Dinvoker.test=extended (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest, rake test:jruby (Windows, Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pdist (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 25 -indy)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 25)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / concurrent-ruby

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / core specs (Windows, Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated

Check warning on line 3228 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars,test -Dinvoker.test=extended (Java 21)

[deprecation] getLongValue() in RubyNumeric has been deprecated
}

@JRubyMethod(name = "hash")
Expand All @@ -3234,8 +3234,8 @@
}

@Override
public RubyString to_s() {

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Dependency check

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain,test -Dinvoker.test=extended (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 25 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Build JRuby release artifacts (21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / jruby-tests-dev

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 21 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Build JRuby release artifacts (21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby_complete_jar_extended -Dinvoker.skip=true (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / regression-specs-jit

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / sequel

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / concurrent-ruby

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 21 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 21 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / regression-specs-jit

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / run specs repeatedly to test optimizations

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Verify build artifacts

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / language specs (Windows, Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pdist (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 25 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 25 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest, rake test:jruby (Windows, Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 21 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars,test -Dinvoker.test=extended (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest (OpenJ9 Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 25 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / language specs (Windows, Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 26 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby_complete_jar_extended -Dinvoker.skip=true (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain,test -Dinvoker.test=extended (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest, rake test:jruby (Windows, Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pdist (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 25 -indy)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 25)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / concurrent-ruby

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / core specs (Windows, Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated

Check warning on line 3237 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars,test -Dinvoker.test=extended (Java 21)

[deprecation] to_s() in RubyBasicObject has been deprecated
return (RubyString) to_s(getCurrentContext());

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Dependency check

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain,test -Dinvoker.test=extended (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 25 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Build JRuby release artifacts (21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / jruby-tests-dev

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 21 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Build JRuby release artifacts (21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby_complete_jar_extended -Dinvoker.skip=true (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / regression-specs-jit

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / sequel

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / concurrent-ruby

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 21 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 21 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / regression-specs-jit

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / run specs repeatedly to test optimizations

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / Verify build artifacts

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / language specs (Windows, Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pdist (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 25 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake test:jruby:jit (Java 25 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest, rake test:jruby (Windows, Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 21 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars,test -Dinvoker.test=extended (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest (OpenJ9 Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:jruby (Java 26)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ji (Java 25 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / language specs (Windows, Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 26 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby_complete_jar_extended -Dinvoker.skip=true (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pcomplete (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain,test -Dinvoker.test=extended (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest, rake test:jruby (Windows, Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pdist (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pmain (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / rake spec:ruby:fast:jit (Java 25 -indy)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Ptest (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Posgi (Java 25)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / concurrent-ruby

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / core specs (Windows, Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated

Check warning on line 3238 in core/src/main/java/org/jruby/RubyModule.java

View workflow job for this annotation

GitHub Actions / mvn -Pjruby-jars,test -Dinvoker.test=extended (Java 21)

[deprecation] getCurrentContext() in RubyBasicObject has been deprecated
}

/** rb_mod_to_s
Expand Down Expand Up @@ -6689,11 +6689,14 @@
// This method needs to be synchronized for removing Autoload
// from autoloadMap when it's loaded.
LoadService loadService = loadService(context);
if (!loadService.featureAlreadyLoaded(path.asJavaString())) {
if (loadService.autoloadRequire(path)) {
// Do not finish autoloading by cyclic autoload
finishAutoload(context, symbol);
}
if (loadService.featureAlreadyLoaded(path.asJavaString())) {
// Nothing to load here: the feature is loaded, or a direct require of it is in
// progress. Keeping the claim would make that require's definition of the
// constant look like this autoload's own and leave UNDEF in the constant table.
this.ctx = null;
} else if (loadService.autoloadRequire(path)) {
// Do not finish autoloading by cyclic autoload
finishAutoload(context, symbol);
}
} catch (LoadError | RuntimeError lre) {
// reset ctx to null for a future attempt to load
Expand Down
33 changes: 33 additions & 0 deletions spec/ruby/core/kernel/autoload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,39 @@ def go
KernelSpecs::AutoloadMethod2::AutoloadFromIncludedModule2.loaded.should == :autoload_from_included_module2
end
end

describe "after the autoload was satisfied by requiring the file directly" do
before :each do
@path = fixture(__FILE__, "autoload_satisfied_by_require.rb")
Kernel.autoload :KSAutoloadSatisfiedByRequire, @path
ScratchPad.record []
end

after :each do
if Object.const_defined?(:KSAutoloadSatisfiedByRequire, false)
Object.send(:remove_const, :KSAutoloadSatisfiedByRequire)
end
end

it "defines a regular constant that no longer depends on $LOADED_FEATURES" do
require @path
ScratchPad.recorded.should == [:loaded]
Kernel.autoload?(:KSAutoloadSatisfiedByRequire).should be_nil
klass = KSAutoloadSatisfiedByRequire
data = Marshal.dump(klass.new)

$LOADED_FEATURES.replace(@loaded_features)
Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:loaded]
end

it "returns the constant from remove_const" do
require @path
klass = KSAutoloadSatisfiedByRequire

Object.send(:remove_const, :KSAutoloadSatisfiedByRequire).should equal(klass)
end
end
end

describe "Kernel.autoload?" do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ScratchPad << :loaded

class KSAutoloadSatisfiedByRequire
end
132 changes: 132 additions & 0 deletions spec/ruby/core/module/autoload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,138 @@ module ModuleSpecs::Autoload
end
end

describe "after the autoload was satisfied by requiring the file directly" do
before :each do
@path = fixture(__FILE__, "autoload_satisfied_by_require.rb")
ModuleSpecs::Autoload.autoload :SatisfiedByRequire, @path
@remove << :SatisfiedByRequire
ScratchPad.record []
end

it "defines a regular constant that no longer depends on $LOADED_FEATURES" do
require @path
ScratchPad.recorded.should == [:loaded]
ModuleSpecs::Autoload.autoload?(:SatisfiedByRequire).should be_nil
klass = ModuleSpecs::Autoload::SatisfiedByRequire
data = Marshal.dump(klass.new)

$LOADED_FEATURES.replace(@loaded_features)
Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:loaded]
end

it "defines a regular constant that no longer depends on $LOAD_PATH" do
ModuleSpecs::Autoload.autoload :SatisfiedByRequire, "autoload_satisfied_by_require"
$:.push File.dirname(@path)
begin
require "autoload_satisfied_by_require.rb"
ensure
$:.pop
end
ScratchPad.recorded.should == [:loaded]
klass = ModuleSpecs::Autoload::SatisfiedByRequire
data = Marshal.dump(klass.new)

Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:loaded]
end

it "returns the constant from remove_const" do
require @path
klass = ModuleSpecs::Autoload::SatisfiedByRequire
@remove.delete(:SatisfiedByRequire)

ModuleSpecs::Autoload.send(:remove_const, :SatisfiedByRequire).should equal(klass)
ModuleSpecs::Autoload.const_defined?(:SatisfiedByRequire).should be_false
end

it "can be registered as an autoload again after remove_const" do
require @path
klass = ModuleSpecs::Autoload::SatisfiedByRequire
ModuleSpecs::Autoload.send(:remove_const, :SatisfiedByRequire)
$LOADED_FEATURES.replace(@loaded_features)

ModuleSpecs::Autoload.autoload :SatisfiedByRequire, @path
ModuleSpecs::Autoload.autoload?(:SatisfiedByRequire).should == @path
ModuleSpecs::Autoload::SatisfiedByRequire.should_not equal(klass)
ScratchPad.recorded.should == [:loaded, :loaded]
end

it "keeps the constant defined by the file when the require raises afterwards" do
path = fixture(__FILE__, "autoload_satisfied_by_require_raise.rb")
ModuleSpecs::Autoload.autoload :SatisfiedByRequireRaise, path
@remove << :SatisfiedByRequireRaise

-> { require path }.should raise_error(RuntimeError, "raised after defining the constant")
ScratchPad.recorded.should == [:loaded]
ModuleSpecs::Autoload.autoload?(:SatisfiedByRequireRaise).should be_nil
klass = ModuleSpecs::Autoload::SatisfiedByRequireRaise
data = Marshal.dump(klass.new)

Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:loaded]
end

it "applies to an autoload the required file declares for a nested constant" do
nested = fixture(__FILE__, "autoload_satisfied_by_require_nested.rb")
inner = fixture(__FILE__, "autoload_satisfied_by_require_nested_inner.rb")
ModuleSpecs::Autoload.autoload :SatisfiedByRequireNested, nested
@remove << :SatisfiedByRequireNested

require nested
ModuleSpecs::Autoload::SatisfiedByRequireNested.autoload?(:Inner).should == inner
require inner
ModuleSpecs::Autoload::SatisfiedByRequireNested.autoload?(:Inner).should be_nil
klass = ModuleSpecs::Autoload::SatisfiedByRequireNested::Inner
data = Marshal.dump(klass.new)

$LOADED_FEATURES.replace(@loaded_features)
Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:nested_loaded, :inner_loaded]
end

it "applies when the file was loaded with require_relative" do
require fixture(__FILE__, "autoload_satisfied_by_require_relative.rb")
ScratchPad.recorded.should == [:loaded]
klass = ModuleSpecs::Autoload::SatisfiedByRequire
data = Marshal.dump(klass.new)

$LOADED_FEATURES.replace(@loaded_features)
Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:loaded]
end
end

describe "when one file defines several autoloaded constants" do
before :each do
@path = fixture(__FILE__, "autoload_siblings.rb")
ModuleSpecs::Autoload.autoload :SiblingA, @path
ModuleSpecs::Autoload.autoload :SiblingB, @path
@remove << :SiblingA << :SiblingB
ScratchPad.record []
end

it "defines every constant the file declares as a regular constant" do
ModuleSpecs::Autoload::SiblingA
ScratchPad.recorded.should == [:loaded]
ModuleSpecs::Autoload.autoload?(:SiblingB).should be_nil
klass = ModuleSpecs::Autoload::SiblingB
data = Marshal.dump(klass.new)

$LOADED_FEATURES.replace(@loaded_features)
Thread.new { Marshal.load(data).class }.value.should equal(klass)
ScratchPad.recorded.should == [:loaded]
end

it "returns the sibling constant from remove_const" do
ModuleSpecs::Autoload::SiblingA
klass = ModuleSpecs::Autoload::SiblingB
@remove.delete(:SiblingB)

ModuleSpecs::Autoload.send(:remove_const, :SiblingB).should equal(klass)
end
end

describe "after the autoload is triggered by require" do
before :each do
@path = tmp("autoload.rb")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ScratchPad << :loaded

module ModuleSpecs::Autoload
class SatisfiedByRequire
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ScratchPad << :nested_loaded

module ModuleSpecs::Autoload
class SatisfiedByRequireNested
autoload :Inner, File.expand_path("autoload_satisfied_by_require_nested_inner.rb", __dir__)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ScratchPad << :inner_loaded

module ModuleSpecs::Autoload
class SatisfiedByRequireNested
class Inner
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ScratchPad << :loaded

module ModuleSpecs::Autoload
class SatisfiedByRequireRaise
end
end

raise "raised after defining the constant"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative "autoload_satisfied_by_require"
9 changes: 9 additions & 0 deletions spec/ruby/core/module/fixtures/autoload_siblings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ScratchPad << :loaded

module ModuleSpecs::Autoload
class SiblingA
end

class SiblingB
end
end
3 changes: 3 additions & 0 deletions test/jruby/autoload_required/assigned.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$autoload_required_loads << __FILE__

TestAutoload::Assigned = Class.new
9 changes: 9 additions & 0 deletions test/jruby/autoload_required/circular_first.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$autoload_required_loads << __FILE__
require File.expand_path("circular_second", __dir__)

class TestAutoload
module Circular
class First
end
end
end
9 changes: 9 additions & 0 deletions test/jruby/autoload_required/circular_second.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$autoload_required_loads << __FILE__
require File.expand_path("circular_first", __dir__)

class TestAutoload
module Circular
class Second
end
end
end
4 changes: 4 additions & 0 deletions test/jruby/autoload_required/colon2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$autoload_required_loads << __FILE__

class TestAutoload::Colon2
end
6 changes: 6 additions & 0 deletions test/jruby/autoload_required/concurrent.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$autoload_required_loads << __FILE__

class TestAutoload
class Concurrent
end
end
8 changes: 8 additions & 0 deletions test/jruby/autoload_required/eager/alpha.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$autoload_required_loads << __FILE__

class TestAutoload
module Eager
class Alpha
end
end
end
8 changes: 8 additions & 0 deletions test/jruby/autoload_required/eager/beta.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$autoload_required_loads << __FILE__

class TestAutoload
module Eager
class Beta < Alpha
end
end
end
8 changes: 8 additions & 0 deletions test/jruby/autoload_required/eager/gamma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$autoload_required_loads << __FILE__

class TestAutoload
module Eager
module Gamma
end
end
end
7 changes: 7 additions & 0 deletions test/jruby/autoload_required/java_import.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$autoload_required_loads << __FILE__

class TestAutoload
module Imported
java_import java.util.ArrayList
end
end
6 changes: 6 additions & 0 deletions test/jruby/autoload_required/loaded.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$autoload_required_loads << __FILE__

class TestAutoload
class Loaded
end
end
11 changes: 11 additions & 0 deletions test/jruby/autoload_required/pair.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$autoload_required_loads << __FILE__

class TestAutoload
module Siblings
class PairA
end

class PairB
end
end
end
6 changes: 6 additions & 0 deletions test/jruby/autoload_required/private.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$autoload_required_loads << __FILE__

class TestAutoload
class Private
end
end
6 changes: 6 additions & 0 deletions test/jruby/autoload_required/table_slot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$autoload_required_loads << __FILE__

class TestAutoload
class TableSlot
end
end
Loading
Loading