Package-private for testing.
16881
static boolean patchShadedLibraryId(InputStream in, OutputStream out, String originalName, String name)
            throws IOException {
        byte[] buffer = new byte[8192];
        int length;
        // We read the whole native lib into memory to make it easier to monkey-patch the id.
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(in.available());

        while ((length = in.read(buffer)) > 0) {
            byteArrayOutputStream.write(buffer, 0, length);
        }
        byteArrayOutputStream.flush();
        byte[] bytes = byteArrayOutputStream.toByteArray();
        byteArrayOutputStream.close();

        final boolean patched;
        // Try to patch the library id.
        if (!patchShadedLibraryId(bytes, originalName, name)) {
            // We did not find the Id, check if we used a originalName that has the os and arch as suffix.
            // If this is the case we should also try to patch with the os and arch suffix removed.
            String os = PlatformDependent.normalizedOs();
            String arch = PlatformDependent.normalizedArch();
            String osArch = "_" + os + "_" + arch;
            if (originalName.endsWith(osArch)) {
                patched = patchShadedLibraryId(bytes,
                        originalName.substring(0, originalName.length() - osArch.length()), name);
            } else {
                patched = false;
            }
        } else {
            patched = true;
        }
        out.write(bytes, 0, bytes.length);
        return patched;
    }
467041
public void process(String packageNames) {

		if (packageNames == null) {
			processPackage("", true);
			return;
		}

		String[] pkgs = packageNames.split(",");
		for (int i = 0; i < pkgs.length; i++) {

			String pkg = pkgs[i].trim().replace('.', '/');

			boolean recurse = false;
			if (pkg.endsWith("**")) {
				recurse = true;
				pkg = pkg.substring(0, pkg.length() - 2);
			} else if (pkg.endsWith("*")) {
				recurse = true;
				pkg = pkg.substring(0, pkg.length() - 1);
			}
			
			pkg = trimSlash(pkg);

			processPackage(pkg, recurse);
		}
	}
344930
public void check()
    {
        for (AnnotationTypeDeclaration atd : _atds)
        {
            Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
            for (Declaration decl : decls)
            {
                check(decl);
            }
        }
    }
829122
private synchronized void compile(Token tok) {
		if (this.operations != null)
			return;
		this.numberOfClosures = 0;
		this.operations = this.compile(tok, null, false);
	}
153050
private void dble() {
            Assert.check(shared == 0);
            Entry[] oldtable = table;
            Entry[] newtable = new Entry[oldtable.length * 2];
            for (ScopeImpl s = this; s != null; s = s.next) {
                if (s.table == oldtable) {
                    Assert.check(s == this || s.shared != 0);
                    s.table = newtable;
                    s.hashMask = newtable.length - 1;
                }
            }
            int n = 0;
            for (int i = oldtable.length; --i >= 0; ) {
                Entry e = oldtable[i];
                if (e != null && e != sentinel) {
                    table[getIndex(e.sym.name)] = e;
                    n++;
                }
            }
            // We don't need to update nelems for shared inherited scopes,
            // since that gets handled by leave().
            nelems = n;
        }
771385
private void mergeInstantFields() {
        if (fieldValues.containsKey(INSTANT_SECONDS)) {
            if (zone != null) {
                mergeInstantFields0(zone);
            } else {
                Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
                if (offsetSecs != null) {
                    ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
                    mergeInstantFields0(offset);
                }
            }
        }
    }
463048
@Execute
    public void process() throws Exception {
        if (!concatOr(outCb == null, doReset)) {
            return;
        }
        checkNull(inRaster1);
        RenderedImage map1RI = inRaster1.getRenderedImage();
        RenderedImage map2RI = null;
        if (inRaster2 == null) {
            map2RI = map1RI;
        } else {
            map2RI = inRaster2.getRenderedImage();
        }

        outCb = new CoupledFieldsMoments().process(map1RI, map2RI, pBins, pFirst, pLast, pm, binmode);
    }
336528
private boolean hasPrintedPackageIndex(PackageElement pkg) {
        for (PackageElement printedPkg : printedPackageHeaders) {
            if (utils.getPackageName(pkg).startsWith(utils.parsePackageName(printedPkg))) {
                return true;
            }
        }
        return false;
    }
426365
function() {
      while (JSLitmus._queue.length) {
        var test = JSLitmus._queue.shift();
        JSLitmus.renderTest(test);
      }
    }
270189
public void scan(List<? extends JCTree> trees) {
        if (trees != null)
        for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
            scan(l.head);
    }


/* ***************************************************************************
 * Visitor methods
 ****************************************************************************/

    public void visitTopLevel(JCCompilationUnit tree) {
        scan(tree.packageAnnotations);
        scan(tree.pid);
        scan(tree.defs);
    }

    public void visitImport(JCImport tree) {
        scan(tree.qualid);
    }

    public void visitClassDef(JCClassDecl tree) {
        scan(tree.mods);
        scan(tree.typarams);
        scan(tree.extending);
        scan(tree.implementing);
        scan(tree.defs);
    }

    public void visitMethodDef(JCMethodDecl tree) {
        scan(tree.mods);
        scan(tree.restype);
        scan(tree.typarams);
        scan(tree.recvparam);
        scan(tree.params);
        scan(tree.thrown);
        scan(tree.defaultValue);
        scan(tree.body);
    }

    public void visitVarDef(JCVariableDecl tree) {
        scan(tree.mods);
        scan(tree.vartype);
        scan(tree.nameexpr);
        scan(tree.init);
    }

    public void visitSkip(JCSkip tree) {
    }
614911
public void build(final PackageBuildContext context,
                      final ReturnValueConstraintEvaluator constraintNode,
                      final ReturnValueDescr descr,
                      final ContextResolver contextResolver) {

        final String className = getClassName(context);
        
        AnalysisResult analysis = getAnalysis(context, descr);

        if ( analysis == null ) {
            // not possible to get the analysis results
            return;
        }

        buildReturnValueEvaluator(context, 
                                  constraintNode, 
                                  descr, 
                                  contextResolver, 
                                  className, 
                                  analysis);
    }
684911
private void lazyInit() {

    if (mStartSpace != null) {
      return;
    }

    Map<String, Integer> mStartSpace = new HashMap<>();
    Map<String, Integer> mStartNoSpace = new HashMap<>();
    Map<String, String> mFull = new HashMap<>();

    try (InputStream stream = JLanguageTool.getDataBroker().getFromResourceDirAsStream(filename)) {
      List<String> posTokens = loadWords(stream);
      for (String posToken : posTokens) {
        String[] tokenAndTag = posToken.split("\t");
        if (tokenAndTag.length != 2) {
          throw new RuntimeException("Invalid format in " + filename + ": '" + posToken + "', expected two tab-separated parts");
        }
        boolean containsSpace = tokenAndTag[0].indexOf(' ') > 0;
        String firstToken;
        String[] firstTokens;
        if (!containsSpace) {
          firstTokens = new String[tokenAndTag[0].length()];
          firstToken = tokenAndTag[0].substring(0, 1);
          for (int i = 1; i < tokenAndTag[0].length(); i++) {
            firstTokens[i] = tokenAndTag[0].substring(i - 1, i);
          }
          if (mStartNoSpace.containsKey(firstToken)) {
            if (mStartNoSpace.get(firstToken) < firstTokens.length) {
              mStartNoSpace.put(firstToken, firstTokens.length);
            }
          } else {
            mStartNoSpace.put(firstToken, firstTokens.length);
          }
        } else {
          firstTokens = tokenAndTag[0].split(" ");
          firstToken = firstTokens[0];

          if (mStartSpace.containsKey(firstToken)) {
            if (mStartSpace.get(firstToken) < firstTokens.length) {
              mStartSpace.put(firstToken, firstTokens.length);
            }
          } else {
            mStartSpace.put(firstToken, firstTokens.length);
          }
        }
        mFull.put(tokenAndTag[0], tokenAndTag[1]);
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    this.mStartSpace = mStartSpace;
    this.mStartNoSpace = mStartNoSpace;
    this.mFull = mFull;
  }
599836
private boolean checkPathAndPackage(Path dir, JCTree pkgName) {
        Iterator<String> pathIter = new ParentIterator(dir);
        Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName);
        while (pathIter.hasNext() && pkgIter.hasNext()) {
            if (!pathIter.next().equals(pkgIter.next()))
                return false;
        }
        return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */
    }
189778
private void merge(ExecutionStatistics otherStatistics) {
        for (String s : otherStatistics.executionInfo.keySet())
        {
            TimingData thisStats = this.executionInfo.get(s);
            TimingData otherStats = otherStatistics.executionInfo.get(s);
            if(thisStats == null) {
                this.executionInfo.put(s,otherStats);
            } else {
                thisStats.merge(otherStats);
            }

        }
    }
1159772
@Override
  public void process(Node externs, Node root) {
    checkState(compiler.getLifeCycleStage().isNormalized());
    if (!allowRemovalOfExternProperties) {
      referencedPropertyNames.addAll(compiler.getExternProperties());
    }
    traverseAndRemoveUnusedReferences(root);
    // This pass may remove definitions of getter or setter properties.
    GatherGettersAndSetterProperties.update(compiler, externs, root);
  }
1262855
@Override
    public void process(final NeedleContext context) {
        Set<String> objectsUnderTestIds = context.getObjectsUnderTestIds();
        for (String objectUnderTestId : objectsUnderTestIds) {
            ObjectUnderTest objectUnderTestAnnotation = context.getObjectUnderTestAnnotation(objectUnderTestId);
            if (objectUnderTestAnnotation != null && objectUnderTestAnnotation.postConstruct()) {
                try {
                    process(context.getObjectUnderTest(objectUnderTestId));
                } catch (ObjectUnderTestInstantiationException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
291875
private static void getParameterizedTypePackageNames(ParameterizedType type,
      Map<String, Class<?>> packageNames) {
    for (Type argumentType : type.getActualTypeArguments()) {
      getTypePackageNames(argumentType, packageNames);
    }

    getTypePackageNames(type.getRawType(), packageNames);
    Type ownerType = type.getOwnerType();
    if (ownerType != null) {
      getTypePackageNames(ownerType, packageNames);
    }
  }