Package org.jruby.common

Examples of org.jruby.common.RubyWarnings.warn()


    }

    private static void cmpFailed(ThreadContext context) {
        RubyWarnings warnings = context.runtime.getWarnings();

        warnings.warn("Comparable#== will no more rescue exceptions of #<=> in the next release.");
        warnings.warn("Return nil in #<=> if the comparison is inappropriate or avoid such comparison.");
    }

    /** cmp_gt
     *
 
View Full Code Here


    private static void cmpFailed(ThreadContext context) {
        RubyWarnings warnings = context.runtime.getWarnings();

        warnings.warn("Comparable#== will no more rescue exceptions of #<=> in the next release.");
        warnings.warn("Return nil in #<=> if the comparison is inappropriate or avoid such comparison.");
    }

    /** cmp_gt
     *
     */
 
View Full Code Here

        IRubyObject savedError = context.runtime.getGlobalVariables().get("$!");
        try {
            result = coerceBody(context, other);
        } catch (RaiseException e) {
            RubyWarnings warnings = context.runtime.getWarnings();
            warnings.warn("Numerical comparison operators will no more rescue exceptions of #coerce");
            warnings.warn("in the next release. Return nil in #coerce if the coercion is impossible.");
            if (err) {
                coerceFailed(context, other);
            } else {
                context.runtime.getGlobalVariables().set("$!", savedError);
View Full Code Here

        try {
            result = coerceBody(context, other);
        } catch (RaiseException e) {
            RubyWarnings warnings = context.runtime.getWarnings();
            warnings.warn("Numerical comparison operators will no more rescue exceptions of #coerce");
            warnings.warn("in the next release. Return nil in #coerce if the coercion is impossible.");
            if (err) {
                coerceFailed(context, other);
            } else {
                context.runtime.getGlobalVariables().set("$!", savedError);
            }
View Full Code Here

        if (!(result instanceof RubyArray) || ((RubyArray) result).getLength() != 2) {
            if (err) {
                throw context.runtime.newTypeError("coerce must return [x, y]");
            } else if (!result.isNil()) {
                RubyWarnings warnings = context.runtime.getWarnings();
                warnings.warn("Bad return value for #coerce, called by numerical comparison operators.");
                warnings.warn("#coerce must return [x, y]. The next release will raise an error for this.");
            }
            return null;
        }
        return (RubyArray) result;
View Full Code Here

            if (err) {
                throw context.runtime.newTypeError("coerce must return [x, y]");
            } else if (!result.isNil()) {
                RubyWarnings warnings = context.runtime.getWarnings();
                warnings.warn("Bad return value for #coerce, called by numerical comparison operators.");
                warnings.warn("#coerce must return [x, y]. The next release will raise an error for this.");
            }
            return null;
        }
        return (RubyArray) result;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.