Get the class of the top-most stack element representing a script.
@return The class of the top-most script in the current stack,
or null if no script is currently running
192144
protected Class<?> getCurrentScriptClass() {
        Class<?>[] context = getClassContext();
        for (Class<?> c : context) {
            if (c != InterpretedFunction.class && NativeFunction.class.isAssignableFrom(c) ||
                    PolicySecurityController.SecureCaller.class.isAssignableFrom(c)) {
                return c;
            }
        }
        return null;
    }
1317852
public java.lang.String getJavaClass() {
    java.lang.Object ref = javaClass_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        javaClass_ = s;
      }
      return s;
    }
  }
115246
public Class<I> getImplClass() {
    return _impl_class != null ? _impl_class : (_impl_class = ReflectionUtils.findActualClassParameter(this.getClass(), 0));
  }
17143
private function classGet()
    {
        return isset( $this->class )
            ? $this->class
            : (
                  ( $firstElement = $this->firstElementGet() )
                ? ( $this->class = get_class( $firstElement ) )
                : null
              )
            ;
    }
244222
protected ScriptEngine getEngine()
    {
        if (engine == null)
        {
            ScriptEngineManager factory = new ScriptEngineManager();
            engine = factory.getEngineByName("JavaScript");
            engine.put("proc", this);
            
            //rhino compatibility workaround, println should be replaced by print in all occurences
            try
            {
                engine.eval("if (typeof println == 'undefined') this.println = print;");
            } catch (ScriptException e) {
                e.printStackTrace();
            }
            
            Map<String, ScriptObject> scriptObjects = ServiceManager.findScriptObjects();
            for (Map.Entry<String, ScriptObject> obj : scriptObjects.entrySet())
            {
                engine.put(obj.getKey(), obj.getValue());
            }
        }
        return engine;
    }
1271627
public java.lang.String getScript() {
    java.lang.Object ref = script_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      script_ = s;
      return s;
    }
  }
821991
public ClassNode getClassNode() {
        if (classNode == null && GroovyObject.class.isAssignableFrom(theClass)) {
            // let's try load it from the classpath
            String groovyFile = theClass.getName();
            int idx = groovyFile.indexOf('$');
            if (idx > 0) {
                groovyFile = groovyFile.substring(0, idx);
            }
            groovyFile = groovyFile.replace('.', '/') + ".groovy";

            //System.out.println("Attempting to load: " + groovyFile);
            URL url = theClass.getClassLoader().getResource(groovyFile);
            if (url == null) {
                url = Thread.currentThread().getContextClassLoader().getResource(groovyFile);
            }
            if (url != null) {
                try {

                    /*
                     * todo there is no CompileUnit in scope so class name
                     * checking won't work but that mostly affects the bytecode
                     * generation rather than viewing the AST
                     */
                    CompilationUnit.ClassgenCallback search = new CompilationUnit.ClassgenCallback() {
                        public void call(ClassVisitor writer, ClassNode node) {
                            if (node.getName().equals(theClass.getName())) {
                                MetaClassImpl.this.classNode = node;
                            }
                        }
                    };

                    CompilationUnit unit = new CompilationUnit();
                    unit.setClassgenCallback(search);
                    unit.addSource(url);
                    unit.compile(Phases.CLASS_GENERATION);
                }
                catch (Exception e) {
                    throw new GroovyRuntimeException("Exception thrown parsing: " + groovyFile + ". Reason: " + e, e);
                }
            }

        }
        return classNode;
    }
687654
public ClassSymbol outermostClass() {
        Symbol sym = this;
        Symbol prev = null;
        while (sym.kind != PCK) {
            prev = sym;
            sym = sym.owner;
        }
        return (ClassSymbol) prev;
    }
419931
public ClassInfo getSuperclass() {
        final Set<ClassInfo> superClasses = relatedClasses.get(RelType.SUPERCLASSES);
        if (superClasses == null || superClasses.isEmpty()) {
            return null;
        } else if (superClasses.size() > 2) {
            throw new IllegalArgumentException("More than one superclass: " + superClasses);
        } else {
            final ClassInfo superclass = superClasses.iterator().next();
            if (superclass.getName().equals("java.lang.Object")) {
                return null;
            } else {
                return superclass;
            }
        }
    }
1323172
@SuppressWarnings("unchecked")
	public static <T> Class<T> getClass(T obj) {
		return ((null == obj) ? null : (Class<T>) obj.getClass());
	}
524500
@Nonnull
  public ClassLoader getClassLoader ()
  {
    return m_aBestCandidate == null ? Thread.currentThread ().getContextClassLoader ()
                                    : m_aBestCandidate.getClassLoader ();
  }
740945
public static String getScriptName(Class<?> clazz) {
        return clazz == null ? null : getScriptName(clazz.getName());
    }
957234
@SuppressWarnings("unchecked")
    public static StackFinder getInstance() {
        if (finder == null) {
            AccessController.doPrivileged(new PrivilegedAction() {
                public Object run() {
                    finder = new StackFinder();
                    return null;
                }
            });
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.StackFinder");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.Messages");
//            finder.hpelClasses.add("java.util.logging.Logger");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.TraceNLSResolver");
//
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.HpelLogFormatter");
//
//            finder.hpelClasses.add("com.ibm.ws.logging.hpel.WsLogger");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.handlers.LogRecordTextHandler");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.handlers.LogRecordTextHandler$2");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.handlers.LogRecordTextHandler$SerializationBuffer");
//
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.handlers.LogRecordHandler$SerializationBuffer");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.handlers.LogRecordHandler$2");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.handlers.LogRecordHandler");
//            
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.ras.impl.BinaryLogRecordSerializerImpl");
//            finder.hpelClasses.add("com.ibm.ejs.ras.hpel.messages.ras.impl.BinaryLogRecordSerializerImpl$3");
        }


        return finder;
    }
1228106
public Class<?> getClassType() {
        try {
            return Class.forName(getType(), true, ClassLoaderHolder.getClassLoader());
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException(e);
        }
    }
906968
public static String getClass(String element) {
        Preconditions.checkNotNull(element,"argument 'element' can not be null");
        return element.substring(element.lastIndexOf('.') + 1);
    }
681566
public int getClassDepth() {
        int depth = 0;

        ClassFile outer = mOuterClass;
        while (outer != null) {
            depth++;
            outer = outer.mOuterClass;
        }

        return depth;
    }
440467
@Benchmark
	@BenchmarkMode(Mode.Throughput)
	public StackFrame stackWalkerWithAnonymousClass() {
		return StackWalker.getInstance().walk(new Function<Stream<StackFrame>, StackFrame>() {
			@Override
			public StackFrame apply(final Stream<StackFrame> stream) {
				return stream.skip(1).findFirst().get();
			}
		});
	}