Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
BEGIN LICENSE BLOCK ***** Version: EPL 1.0/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Eclipse Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.eclipse.org/legal/epl-v10.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyright (C) 2007 Charles Oliver Nutter <headius@headius.com> Alternatively, the contents of this file may be used under the terms of either of the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the EPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the EPL, the GPL or the LGPL. END LICENSE BLOCK ***
 
 package org.jruby.internal.runtime.methods;
 
 
 public abstract class CompiledMethod extends JavaMethod implements CloneablePositionAwareMethodArgs2 {
     protected Object $scriptObject;
     protected ISourcePosition position;
     
     public static class LazyCompiledMethod extends DynamicMethod implements CloneablePositionAwareMethodArgs2 {
         private final String rubyName;
         private final String javaName;
         private final Arity arity;
         private final StaticScope scope;
         private final Object scriptObject;
         private MethodFactory factory;
         private DynamicMethod compiledMethod;
         private final ISourcePosition position;
         private final String parameterDesc;
         private final String[] parameterList;
     
         public LazyCompiledMethod(
                 RubyModule implementationClass,
                 String rubyName,
                 String javaName,
                 Arity arity,
                 Visibility visibility,
                 StaticScope scope,
                 Object scriptObject,
                 CallConfiguration callConfig,
                 ISourcePosition position,
                 String parameterDesc,
                 MethodFactory factory) {
             
             super(implementationClassvisibilitycallConfig);
             this. = rubyName;
             this. = javaName;
             this. = arity;
             this. = scope;
             this. = scriptObject;
             this. = factory;
             this. = position;
             this. = parameterDesc;
             this. = parameterDesc.split(";");
         }
         
         private synchronized void initializeMethod() {
             if ( != nullreturn;
              = null;
         }
         
         @Override
         public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString name) {
             if ( == nullinitializeMethod();
             return .call(contextselfclazzname);
         }
         
         @Override
         public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0) {
             if ( == nullinitializeMethod();
             return .call(contextselfclazznamearg0);
         }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznamearg0arg1);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1IRubyObject arg2) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznamearg0arg1arg2);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject[] args) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznameargs);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameBlock block) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznameblock);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0Block block) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznamearg0block);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1Block block) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznamearg0arg1block);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg0IRubyObject arg1IRubyObject arg2Block block) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznamearg0arg1arg2block);
        }
        
        @Override
        public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject[] argsBlock block) {
            if ( == nullinitializeMethod();
            return .call(contextselfclazznameargsblock);
        }
        @Override
        public Arity getArity() {
            if ( == nullinitializeMethod();
            return .getArity();
        }
        @Override
        public CallConfiguration getCallConfig() {
            if ( == nullinitializeMethod();
            return .getCallConfig();
        }
        @Override
        public RubyModule getImplementationClass() {
            if ( == nullinitializeMethod();
            return .getImplementationClass();
        }
        @Override
        protected RubyModule getProtectedClass() {
            if ( == nullinitializeMethod();
            return .getProtectedClass();
        }
        @Override
        public DynamicMethod getRealMethod() {
            if ( == nullinitializeMethod();
            return .getRealMethod();
        }
        @Override
        public Visibility getVisibility() {
            if ( == nullinitializeMethod();
            return .getVisibility();
        }
        @Override
        public boolean isCallableFrom(IRubyObject callerCallType callType) {
            if ( == nullinitializeMethod();
            return .isCallableFrom(callercallType);
        }
        @Override
        public boolean isNative() {
            if ( == nullinitializeMethod();
            return .isNative();
        }
        @Override
        public void setCallConfig(CallConfiguration callConfig) {
            if ( == nullinitializeMethod();
            .setCallConfig(callConfig);
        }
        @Override
        public void setImplementationClass(RubyModule implClass) {
            if ( == nullinitializeMethod();
            .setImplementationClass(implClass);
        }
        @Override
        public void setVisibility(Visibility visibility) {
            if ( == nullinitializeMethod();
            .setVisibility(visibility);
        }
        @Override
        public DynamicMethod dup() {
            if ( == nullinitializeMethod();
            return .dup();
        }
        public String getFile() {
            if ( == nullinitializeMethod();
            return .getFile();
        }
        public int getLine() {
            if ( == nullinitializeMethod();
            return .getStartLine();
        }
        public String[] getParameterList() {
            if ( == nullinitializeMethod();
            return ;
        }
        
    }
    
    protected CompiledMethod() {}
    
    protected void init(
            RubyModule implementationClass,
            Arity arity,
            Visibility visibility,
            StaticScope staticScope,
            Object scriptObject,
            CallConfiguration callConfig,
            ISourcePosition position,
            String parameterDesc) {
        
        this. = scriptObject;
        this. = position;
        setParameterDesc(parameterDesc);
        super.init(implementationClassarityvisibilitystaticScopecallConfig);
    }
        
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString name) {
        return call(contextselfclazzname.);
    }
        
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg) {
        return call(contextselfclazznamearg.);
    }
        
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg1IRubyObject arg2) {
        return call(contextselfclazznamearg1arg2.);
    }
        
    @Override
    public IRubyObject call(ThreadContext contextIRubyObject selfRubyModule clazzString nameIRubyObject arg1IRubyObject arg2IRubyObject arg3) {
        return call(contextselfclazznamearg1arg2arg3.);
    }
    
    @Override
    public DynamicMethod dup() {
        try {
            CompiledMethod msm = (CompiledMethod)clone();
            return msm;
        } catch (CloneNotSupportedException cnse) {
            return null;
        }
    }
    @Override
    public boolean isNative() {
        return false;
    }
    public String getFile() {
        return .getFile();
    }
    public int getLine() {
        return .getStartLine();
    }
    public Object getScriptObject() {
        return ;
    }
}// SimpleInvocationMethod
New to GrepCode? Check out our FAQ X