LoaderMethodVisitor and LoaderMonitor.
551914
private boolean isMonitorAccessibleFromClassLoader(ClassLoader loader) {
        if (loader == null) {
            return false;
        }
        boolean isMonitorAccessible = true;
        InputStream monitorInputStream = null;
        try {
            monitorInputStream = loader.getResourceAsStream(COVERAGE_MONITOR_RESOURCE);
            if (monitorInputStream == null) {
                isMonitorAccessible = false;
            }
        } catch (Exception ex1) {
            isMonitorAccessible = false;
            try {
                if (monitorInputStream != null) {
                    monitorInputStream.close();
                }
            } catch (IOException ex2) {
                // do nothing
            }
        }
        return isMonitorAccessible;
    }
1205273
public void classLoaderInit(DynamicClassLoader loader)
  {
    EnvLoaderListener listener = _listenerRef.get();
    
    if (listener != null)
      listener.classLoaderInit(loader);
  }
1139300
function load(method, config) {
  return function(patterns, options) {
    var opts = mergeOptions(this, config, options);
    var loader = createLoader(opts, this[method]);
    return loader.apply(this, arguments);
  };
}
960204
public void createInitialPerformanceMonitors() {
        if (packageScanBase != null) {
            AnnotatedMethodScanner methodScanner = new AnnotatedMethodScanner();
            for (Method m : methodScanner.findAnnotatedMethods(packageScanBase, org.fishwife.jrugged.aspects.PerformanceMonitor.class)) {
                org.fishwife.jrugged.aspects.PerformanceMonitor performanceMonitorAnnotation = m.getAnnotation(org.fishwife.jrugged.aspects.PerformanceMonitor.class);
                initialPerformanceMonitorList.add(performanceMonitorAnnotation.value());
            }
        }
        for (String name: initialPerformanceMonitorList) {
            createPerformanceMonitor(name);
        }
    }
466925
private void initHighlightingHandler() {

        addMouseOverHandler(CmsValueFocusHandler.getInstance());
        addMouseOutHandler(CmsValueFocusHandler.getInstance());
        addMouseDownHandler(CmsValueFocusHandler.getInstance());
    }
558509
private void addLoader(ClassLoader loader)
  {
    for (int i = _loaders.size() - 1; i >= 0; i--) {
      WeakReference<ClassLoader> ref = _loaders.get(i);
      ClassLoader refLoader = ref.get();

      if (refLoader == null)
        _loaders.remove(i);

      if (refLoader == loader)
        return;
    }

    _loaders.add(new WeakReference<ClassLoader>(loader));
    EnvLoader.addClassLoaderListener(this, loader);
  }
372522
protected void initEventAdaptors()
    {
        if ( _clientDecl == null || _clientDecl.getMethods() == null )
            return;
        
        for (MethodDeclaration clientMethod : _clientDecl.getMethods())
        {
            //
            // Do a quick check for the presence of the EventHandler annotation on methods
            //
            if (clientMethod.getAnnotation(EventHandler.class) == null ||
                clientMethod.toString().equals("<clinit>()"))
                continue;

            //
            // EventHandler annotations on private methods cause compilation error.
            //
            if (isPrivateMethod(clientMethod))
            {
                _ap.printError( clientMethod, "eventhandler.method.is.private");
                continue;
            }

            //
            // If found, we must actually read the value using an AnnotationMirror, since it
            // contains a Class element (eventSet) that cannot be loaded
            //
            AnnotationMirror handlerMirror = null;
            for (AnnotationMirror annot : clientMethod.getAnnotationMirrors())
            {
                if ( annot == null ||
                    annot.getAnnotationType() == null ||
                    annot.getAnnotationType().getDeclaration() == null ||
                    annot.getAnnotationType().getDeclaration().getQualifiedName() == null )
                    return;

                if ( annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
                        "org.apache.beehive.controls.api.events.EventHandler"))
                {
                    handlerMirror = annot;
                    break;
                }
            }
            if (handlerMirror == null)
            {
                throw new CodeGenerationException("Unable to find EventHandler annotation on " +
                                                  clientMethod);
            }

            AptAnnotationHelper handlerAnnot = new AptAnnotationHelper(handlerMirror);

            //
            // Locate the EventField based upon the field element value
            //
            String fieldName = (String)handlerAnnot.getObjectValue("field");
            AptEventField eventField = (AptEventField)getField(fieldName);
            if (eventField == null)
            {
                // Deliberately not issuing a diagnostic if an event handler specifies
                // a field that isn't a control.  Other annotation processors also
                // handle event handlers, so delegate diagnostic responsibility to them.
                continue;
            }

            //
            // Locate the EventSet based upon the eventSet element value
            //
            Object tmo = handlerAnnot.getObjectValue("eventSet");
            if (!(tmo instanceof TypeMirror))
                continue;
            
            TypeMirror tm = (TypeMirror)tmo;
            String setName = tm.toString();

            AptControlInterface controlIntf = eventField.getControlInterface();
            AptEventSet eventSet = controlIntf.getEventSet(setName);

            // todo: remove workaround once bug has been resolved.
            /* Workaround JIRA issue BEEHIVE-1143, eventset name may
               contain a '$' seperator between the outer class and inner class.
               Should be a '.' seperator. Only applies to Eclipse APT. This
               workaround is also present in AptControlImplementation.initEventAdapters
             */
            if (tm.getClass().getName().startsWith("org.eclipse.")) {
                setName = setName.replace('$', '.');
            }
            // end of workaround

            if (eventSet == null)
            {
                _ap.printError( clientMethod, "eventhandler.eventset.not.found", setName );
                continue;
            }

            //
            // Register a new EventAdaptor for the EventSet, if none exists already
            //
            EventAdaptor adaptor = eventField.getEventAdaptor(eventSet);
            if (adaptor == null)
            {
                adaptor = new EventAdaptor(eventField, eventSet);
                eventField.addEventAdaptor(eventSet, adaptor);
            }

            //
            // Locate the EventSet method based upon the eventName element value.  Once
            // found, add a new AptEventHandler to the adaptor for this event.
            //
            boolean found = false;
            String eventName = (String)handlerAnnot.getObjectValue("eventName");
            AptMethod handlerMethod = new AptMethod(clientMethod, _ap);

            //
            // Will start at the currrent event set and look up through any ones it
            // extends to try and find a matching event
            //
            while (eventSet != null)
            {
                for (AptEvent controlEvent : eventSet.getEvents())
                {
                    if (controlEvent == null || 
                        controlEvent.getName() == null || 
                        !controlEvent.getName().equals(eventName))
                        continue;

                    if ( controlEvent.getArgTypes() == null )
                        continue;

                    //
                    // BUGBUG: If the arguments are parameterized, then the event handler
                    // might declare a specific bound version of the type, so a direct
                    // comparison will fail.  If parameterized, we don't validate.
                    //
                    if (controlEvent.hasParameterizedArguments() ||
                        (controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()) &&
                         controlEvent.getReturnType().equals(handlerMethod.getReturnType())
                        )
                       )
                    {
                        HashSet<String> throwSet = new HashSet<String>(controlEvent.getThrowsList());
                        ArrayList<String> handlerThrows = handlerMethod.getThrowsList();
                        boolean throwsMatches = true;
                        for ( String t : handlerThrows )
                        {
                            if ( !throwSet.contains(t) )
                                throwsMatches = false;
                        }
                    
                        if ( !throwsMatches )
                        {
                            _ap.printError( clientMethod, "eventhandler.throws.mismatch", handlerMethod.getName() );
                        }

                        adaptor.addHandler(controlEvent, 
                                       new AptEventHandler(controlEvent, clientMethod, _ap ));
                        found = true;
                        break;
                    }
                }
                if (found)  // outer loop too
                    break;

                //
                // Look up on the super event set if not found at the current level
                //
                eventSet = eventSet.getSuperEventSet();
            }
            if (!found)
            {
                _ap.printError( clientMethod, "eventhandler.method.not.found", setName );
            }
        } 
    }
609131
@Override
    public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
        // Add to observed methods list
        visitedMethods.add(new Method(name, descriptor));

        // Make sure the class is annotated.
        ensureAnnotated();

        // Chain to the appropriate RAS method adapter
        MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions);
        if (isInstrumentableClass() && isInstrumentableMethod(access, name, descriptor)) {
            MethodVisitor rasMethodAdapter = createRasMethodAdapter(mv, access, name, descriptor, signature, exceptions);
            mv = (rasMethodAdapter != null) ? rasMethodAdapter : mv;
        }
        return mv;
    }
635755
private void processWatcher(MethodSpec.Builder createdMethodBuilder, ExecutableElement method) {
    Watch watch = method.getAnnotation(Watch.class);

    String exposedMethodName = exposeExistingJavaMethodToJs(method);
    String watcherTriggerMethodName = addNewMethodToProto();

    MethodSpec.Builder watcherMethodBuilder = MethodSpec
        .methodBuilder(watcherTriggerMethodName)
        .addModifiers(Modifier.PUBLIC)
        .addAnnotation(JsMethod.class)
        .returns(Object.class);

    String[] valueSplit = watch.value().split("\\.");

    String currentExpression = "";
    for (int i = 0; i < valueSplit.length - 1; i++) {
      currentExpression += valueSplit[i];
      watcherMethodBuilder.addStatement("if ($L == null) return null", currentExpression);
      currentExpression += ".";
    }

    watcherMethodBuilder.addStatement("return $L", watch.value());

    componentExposedTypeBuilder.addMethod(watcherMethodBuilder.build());

    createdMethodBuilder
        .addStatement("vue().$L(p.$L, p.$L, $T.of($L, $L))", "$watch",
            watcherTriggerMethodName, exposedMethodName, WatchOptions.class, watch.isDeep(),
            watch.isImmediate());
  }
990300
function (methods) {
    this.lazyLoaders();
    var loaders = this.loaders;
    var self = this;

    utils.arrayify(methods).forEach(function (method) {
      self.define(method, function() {
        return loaders[method].apply(loaders, arguments);
      });
    });
  }
836705
@Override
	public void showErrorIndicators(final List<Diagnostic> diags) {
		WComponent visibleComponent = getVisible();
		visibleComponent.showErrorIndicators(diags);
	}
835730
@DefaultVisibilityForTesting
  static TraceComponent loadTraceComponent(@Nullable ClassLoader classLoader) {
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName(
              "io.opencensus.impl.trace.TraceComponentImpl", /*initialize=*/ true, classLoader),
          TraceComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load full implementation for TraceComponent, now trying to load lite "
              + "implementation.",
          e);
    }
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName(
              "io.opencensus.impllite.trace.TraceComponentImplLite",
              /*initialize=*/ true,
              classLoader),
          TraceComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load lite implementation for TraceComponent, now using "
              + "default implementation for TraceComponent.",
          e);
    }
    return TraceComponent.newNoopTraceComponent();
  }
533330
private static function _checkLoaded()
    {
        $cls = get_called_class();
        if (!array_key_exists($cls, self::$_loaded)) {
            self::$_loaded[$cls] = false;
        }
        if (!self::$_loaded[$cls]) {
            self::_loadColumns();
        }
    }
82876
public static void logMethodCalls() {
    Logger logger = Logger.getLogger(Datastore.class.getName());
    logger.setLevel(Level.FINE);
    if (!Arrays.asList(logger.getHandlers()).contains(getStreamHandler())) {
      logger.addHandler(getStreamHandler());
    }
  }
90765
private static void handleRealModule(final Object module, final Set<Object> visitedModules,
            final ClassLoader classLoader, final ClasspathOrder classpathOrderOut, final ScanSpec scanSpec,
            final LogNode log) {
        if (!visitedModules.add(module)) {
            // Avoid extracting paths from the same module more than once
            return;
        }
        ClassLoader moduleLoader = (ClassLoader) ReflectionUtils.invokeMethod(module, "getClassLoader", false);
        if (moduleLoader == null) {
            moduleLoader = classLoader;
        }
        // type VFSResourceLoader[]
        final Object vfsResourceLoaders = ReflectionUtils.invokeMethod(moduleLoader, "getResourceLoaders", false);
        if (vfsResourceLoaders != null) {
            for (int i = 0, n = Array.getLength(vfsResourceLoaders); i < n; i++) {
                // type JarFileResourceLoader for jars, VFSResourceLoader for exploded jars, PathResourceLoader
                // for resource directories, or NativeLibraryResourceLoader for (usually non-existent) native
                // library "lib/" dirs adjacent to the jarfiles that they were presumably extracted from.
                final Object resourceLoader = Array.get(vfsResourceLoaders, i);
                // Could skip NativeLibraryResourceLoader instances altogether, but testing for their existence
                // only seems to add about 3% to the total scan time.
                // if (!resourceLoader.getClass().getSimpleName().equals("NativeLibraryResourceLoader")) {
                handleResourceLoader(resourceLoader, moduleLoader, classpathOrderOut, scanSpec, log);
                //}
            }
        }
    }
1137721
private void initListeners()
  {
    ClassLoader parent = getParent();

    for (; parent != null; parent = parent.getParent()) {
      if (parent instanceof EnvironmentClassLoader) {
        EnvironmentClassLoader loader = (EnvironmentClassLoader) parent;

        if (_stopListener == null)
          _stopListener = new WeakStopListener(this);

        loader.addListener(_stopListener);

        return;
      }
    }
  }
1224823
protected void initialize(ConfigurableEnvironment environment,
			ClassLoader classLoader) {
		new LoggingSystemProperties(environment).apply();
		LogFile logFile = LogFile.get(environment);
		if (logFile != null) {
			logFile.applyToSystemProperties();
		}
		initializeEarlyLoggingLevel(environment);
		initializeSystem(environment, this.loggingSystem, logFile);
		initializeFinalLoggingLevels(environment, this.loggingSystem);
		registerShutdownHookIfNecessary(environment, this.loggingSystem);
	}