Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3b1f9ebf6d4e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 15d5c202a60b
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Jan 2, 2016

  1. Copy the full SHA
    e7b3b6b View commit details
  2. Copy the full SHA
    093a59e View commit details
  3. Copy the full SHA
    15d5c20 View commit details
Showing with 14 additions and 37 deletions.
  1. +11 −31 core/src/main/java/org/jruby/RubyModule.java
  2. +3 −6 spec/java_integration/spec_helper.rb
42 changes: 11 additions & 31 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -37,13 +37,6 @@
***** END LICENSE BLOCK *****/
package org.jruby;

import org.jruby.internal.runtime.methods.AttrWriterMethod;
import org.jruby.internal.runtime.methods.AttrReaderMethod;

import static org.jruby.anno.FrameField.VISIBILITY;
import static org.jruby.runtime.Visibility.*;
import static org.jruby.CompatVersion.*;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -116,22 +109,7 @@
import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

import static org.jruby.CompatVersion.*;
import static org.jruby.anno.FrameField.VISIBILITY;
import static org.jruby.runtime.Visibility.*;

@@ -2687,10 +2665,6 @@ public IRubyObject const_get_2_0(ThreadContext context, IRubyObject[] args) {
@JRubyMethod(name = "const_set", required = 2)
public IRubyObject const_set(IRubyObject symbol, IRubyObject value) {
IRubyObject constant = setConstant(validateConstant(symbol.asJavaString()).intern(), value);

if (constant instanceof RubyModule) {
((RubyModule)constant).calculateName();
}
return constant;
}

@@ -3159,23 +3133,29 @@ private IRubyObject setConstantCommon(String name, IRubyObject value, boolean wa
if (warn) {
getRuntime().getWarnings().warn(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + name);
}
setParentForModule(name, value);
storeConstant(name, value);
}
} else {
}
else {
setParentForModule(name, value);
storeConstant(name, value);
}

invalidateConstantCache(name);
return value;
}

private void setParentForModule(final String name, final IRubyObject value) {
// if adding a module under a constant name, set that module's basename to the constant name
if (value instanceof RubyModule) {
RubyModule module = (RubyModule)value;
if ( value instanceof RubyModule ) {
RubyModule module = (RubyModule) value;
if (module != this && module.getBaseName() == null) {
module.setBaseName(name);
module.setParent(this);
}
module.calculateName();
}
return value;
}

@Deprecated
9 changes: 3 additions & 6 deletions spec/java_integration/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -2,12 +2,9 @@
$CLASSPATH << File.expand_path('../../../test/target/test-classes', __FILE__)
require 'rspec'

unless $is_rspec_reconfigured
RSpec.configure do |config|
require File.expand_path('../../../test/test_helper', __FILE__)
config.include TestHelper
end
$is_rspec_reconfigured = true
RSpec.configure do |config|
require File.expand_path('../../../test/test_helper', __FILE__)
config.include TestHelper
end

# Works like 'should include('str1', 'str2') but for arrays of