only partially generified due to javac bug
351680
private static Collection<List<?>> cloneAltNames(Collection<List<?>> altNames) {
        boolean mustClone = false;
        for (List<?> nameEntry : altNames) {
            if (nameEntry.get(1) instanceof byte[]) {
                // must clone names
                mustClone = true;
            }
        }
        if (mustClone) {
            List<List<?>> namesCopy = new ArrayList<>();
            for (List<?> nameEntry : altNames) {
                Object nameObject = nameEntry.get(1);
                if (nameObject instanceof byte[]) {
                    List<Object> nameEntryCopy =
                                        new ArrayList<>(nameEntry);
                    nameEntryCopy.set(1, ((byte[])nameObject).clone());
                    namesCopy.add(Collections.unmodifiableList(nameEntryCopy));
                } else {
                    namesCopy.add(nameEntry);
                }
            }
            return Collections.unmodifiableCollection(namesCopy);
        } else {
            return altNames;
        }
    }

    /**
     * This method are the overridden implementation of
     * getSubjectAlternativeNames method in X509Certificate in the Sun
     * provider. It is better performance-wise since it returns cached
     * values.
     */
    public synchronized Collection<List<?>> getSubjectAlternativeNames()
        throws CertificateParsingException {
        // return cached value if we can
        if (readOnly && subjectAlternativeNames != null)  {
            return cloneAltNames(subjectAlternativeNames);
        }
        SubjectAlternativeNameExtension subjectAltNameExt =
            getSubjectAlternativeNameExtension();
        if (subjectAltNameExt == null) {
            return null;
        }
        GeneralNames names;
        try {
            names = subjectAltNameExt.get(
                    SubjectAlternativeNameExtension.SUBJECT_NAME);
        } catch (IOException ioe) {
            // should not occur
            return Collections.<List<?>>emptySet();
        }
        subjectAlternativeNames = makeAltNames(names);
        return subjectAlternativeNames;
    }

    /**
     * This static method is the default implementation of the
     * getSubjectAlternaitveNames method in X509Certificate. A
     * X509Certificate provider generally should overwrite this to
     * provide among other things caching for better performance.
     */
    public static Collection<List<?>> getSubjectAlternativeNames(X509Certificate cert)
        throws CertificateParsingException {
        try {
            byte[] ext = cert.getExtensionValue(SUBJECT_ALT_NAME_OID);
            if (ext == null) {
                return null;
            }
            DerValue val = new DerValue(ext);
            byte[] data = val.getOctetString();

            SubjectAlternativeNameExtension subjectAltNameExt =
                new SubjectAlternativeNameExtension(Boolean.FALSE,
                                                    data);

            GeneralNames names;
            try {
                names = subjectAltNameExt.get(
                        SubjectAlternativeNameExtension.SUBJECT_NAME);
            }  catch (IOException ioe) {
                // should not occur
                return Collections.<List<?>>emptySet();
            }
            return makeAltNames(names);
        } catch (IOException ioe) {
            throw new CertificateParsingException(ioe);
        }
    }

    /**
     * This method are the overridden implementation of
     * getIssuerAlternativeNames method in X509Certificate in the Sun
     * provider. It is better performance-wise since it returns cached
     * values.
     */
    public synchronized Collection<List<?>> getIssuerAlternativeNames()
        throws CertificateParsingException {
        // return cached value if we can
        if (readOnly && issuerAlternativeNames != null) {
            return cloneAltNames(issuerAlternativeNames);
        }
        IssuerAlternativeNameExtension issuerAltNameExt =
            getIssuerAlternativeNameExtension();
        if (issuerAltNameExt == null) {
            return null;
        }
        GeneralNames names;
        try {
            names = issuerAltNameExt.get(
                    IssuerAlternativeNameExtension.ISSUER_NAME);
        } catch (IOException ioe) {
            // should not occur
            return Collections.<List<?>>emptySet();
        }
        issuerAlternativeNames = makeAltNames(names);
        return issuerAlternativeNames;
    }

    /**
     * This static method is the default implementation of the
     * getIssuerAlternaitveNames method in X509Certificate. A
     * X509Certificate provider generally should overwrite this to
     * provide among other things caching for better performance.
     */
    public static Collection<List<?>> getIssuerAlternativeNames(X509Certificate cert)
        throws CertificateParsingException {
        try {
            byte[] ext = cert.getExtensionValue(ISSUER_ALT_NAME_OID);
            if (ext == null) {
                return null;
            }

            DerValue val = new DerValue(ext);
            byte[] data = val.getOctetString();

            IssuerAlternativeNameExtension issuerAltNameExt =
                new IssuerAlternativeNameExtension(Boolean.FALSE,
                                                    data);
            GeneralNames names;
            try {
                names = issuerAltNameExt.get(
                        IssuerAlternativeNameExtension.ISSUER_NAME);
            }  catch (IOException ioe) {
                // should not occur
                return Collections.<List<?>>emptySet();
            }
            return makeAltNames(names);
        } catch (IOException ioe) {
            throw new CertificateParsingException(ioe);
        }
    }

    public AuthorityInfoAccessExtension getAuthorityInfoAccessExtension() {
        return (AuthorityInfoAccessExtension)
            getExtension(PKIXExtensions.AuthInfoAccess_Id);
    }

    /************************************************************/

    /*
     * Cert is a SIGNED ASN.1 macro, a three elment sequence:
     *
     *  - Data to be signed (ToBeSigned) -- the "raw" cert
     *  - Signature algorithm (SigAlgId)
     *  - The signature bits
     *
     * This routine unmarshals the certificate, saving the signature
     * parts away for later verification.
     */
    private void parse(DerValue val)
    throws CertificateException, IOException {
        parse(
            val,
            null // use re-encoded form of val as the encoded form
            );
    }

    /*
     * Cert is a SIGNED ASN.1 macro, a three elment sequence:
     *
     *  - Data to be signed (ToBeSigned) -- the "raw" cert
     *  - Signature algorithm (SigAlgId)
     *  - The signature bits
     *
     * This routine unmarshals the certificate, saving the signature
     * parts away for later verification.
     */
    private void parse(DerValue val, byte[] originalEncodedForm)
    throws CertificateException, IOException {
        // check if can over write the certificate
        if (readOnly)
            throw new CertificateParsingException(
                      "cannot over-write existing certificate");

        if (val.data == null || val.tag != DerValue.tag_Sequence)
            throw new CertificateParsingException(
                      "invalid DER-encoded certificate data");

        signedCert =
                (originalEncodedForm != null)
                        ? originalEncodedForm : val.toByteArray();
        DerValue[] seq = new DerValue[3];

        seq[0] = val.data.getDerValue();
        seq[1] = val.data.getDerValue();
        seq[2] = val.data.getDerValue();

        if (val.data.available() != 0) {
            throw new CertificateParsingException("signed overrun, bytes = "
                                     + val.data.available());
        }
        if (seq[0].tag != DerValue.tag_Sequence) {
            throw new CertificateParsingException("signed fields invalid");
        }

        algId = AlgorithmId.parse(seq[1]);
        signature = seq[2].getBitString();

        if (seq[1].data.available() != 0) {
            throw new CertificateParsingException("algid field overrun");
        }
        if (seq[2].data.available() != 0)
            throw new CertificateParsingException("signed fields overrun");

        // The CertificateInfo
        info = new X509CertInfo(seq[0]);

        // the "inner" and "outer" signature algorithms must match
        AlgorithmId infoSigAlg = (AlgorithmId)info.get(
                                              CertificateAlgorithmId.NAME
                                              + DOT +
                                              CertificateAlgorithmId.ALGORITHM);
        if (! algId.equals(infoSigAlg))
            throw new CertificateException("Signature algorithm mismatch");
        readOnly = true;
    }
1340117
@Override
    public void mutate(StaticBuffer key, List<Entry> additions, List<StaticBuffer> deletions, StoreTransaction txh) throws BackendException {
        ExpectedValueCheckingTransaction etx = (ExpectedValueCheckingTransaction)txh;
        boolean hasAtLeastOneLock = etx.prepareForMutations();
        if (hasAtLeastOneLock) {
            // Force all mutations on this transaction to use strong consistency
            store.mutate(key, additions, deletions, getConsistentTx(txh));
        } else {
            store.mutate(key, additions, deletions, unwrapTx(txh));
        }
    }
932660
@Override
    public void visitClassContext(ClassContext classContext) {
        if (cloneableClass == null) {
            return;
        }

        try {
            JavaClass cls = classContext.getJavaClass();
            if (cls.implementationOf(cloneableClass)) {
                stack = new OpcodeStack();
                super.visitClassContext(classContext);
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            stack = null;
        }
    }
582635
@Override
    public void visitCode(Code obj) {
        Method method = getMethod();
        if (prescreen(method)) {
            stack.resetForMethodEntry(this);
            regPriorities.clear();
            int[] parmRegs = RegisterUtils.getParameterRegisters(method);
            for (int reg : parmRegs) {
                regPriorities.put(Integer.valueOf(reg), Values.NORMAL_BUG_PRIORITY);
            }
            if (!method.isStatic()) {
                regPriorities.put(Values.ZERO, Values.LOW_BUG_PRIORITY);
            }
            super.visitCode(obj);
        }
    }
204934
function () {
            // do nothing if there is no saved states
            if (this._matrixStack.length !== 0) {
                var color = this._colorStack.pop();
                var matrix = this._matrixStack.pop();

                // restore the previous context
                this.currentColor.copy(color);
                this.currentTransform.copy(matrix);

                // recycle objects
                me.pool.push(color);
                me.pool.push(matrix);
            }

            if (this._scissorStack.length !== 0) {
                // FIXME : prevent `scissor` object realloc and GC
                this.currentScissor.set(this._scissorStack.pop());
            } else {
                // turn off scissor test
                this.gl.disable(this.gl.SCISSOR_TEST);
                this.currentScissor[0] = 0;
                this.currentScissor[1] = 0;
                this.currentScissor[2] = this.backBufferCanvas.width;
                this.currentScissor[3] = this.backBufferCanvas.height;
            }
        }
126459
void initInputsByIdMap() {
    inputsById.clear();
    for (CompilerInput input : externs) {
      InputId id = input.getInputId();
      CompilerInput previous = putCompilerInput(id, input);
      if (previous != null) {
        report(JSError.make(DUPLICATE_EXTERN_INPUT, input.getName()));
      }
    }
    for (CompilerInput input : moduleGraph.getAllInputs()) {
      InputId id = input.getInputId();
      CompilerInput previous = putCompilerInput(id, input);
      if (previous != null) {
        report(JSError.make(DUPLICATE_INPUT, input.getName()));
      }
    }
  }
422575
@Override
    public void sawOpcode(int seen) {
        try {
            stack.precomputation(this);

            if ((seen != Const.INVOKEVIRTUAL) || !"wait".equals(getNameConstantOperand()) || stack.getStackDepth() == 0) {
                return;
            }
            JavaClass cls = stack.getStackItem(0).getJavaClass();
            if (cls != null) {
                String clsName = cls.getClassName();
                if (concurrentAwaitClasses.contains(clsName)) {
                    bugReporter.reportBug(new BugInstance(this, BugType.SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT.name(), NORMAL_PRIORITY).addClass(this)
                            .addMethod(this).addSourceLine(this));
                }
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
690120
private static @CheckForNull
    IJavaElement getJavaElement(BugInstance bug, IJavaProject project) throws JavaModelException {

        SourceLineAnnotation primarySourceLineAnnotation = bug.getPrimarySourceLineAnnotation();
        String qualifiedClassName = primarySourceLineAnnotation.getClassName();

//        if (Reporter.DEBUG) {
//            System.out.println("Looking up class: " + packageName + ", " + qualifiedClassName);
//        }

        Matcher m = fullName.matcher(qualifiedClassName);
        IType type;
        String innerName = null;
        if (m.matches() && m.group(2).length() > 0) {

            String outerQualifiedClassName = m.group(1).replace('$', '.');
            innerName = m.group(2).substring(1);
            // second argument is required to find also secondary types
            type = project.findType(outerQualifiedClassName, (IProgressMonitor) null);

            /*
             * code below only points to the first line of inner class even if
             * this is not a class bug but field bug
             */
            if (type != null && !hasLineInfo(primarySourceLineAnnotation)) {
                completeInnerClassInfo(qualifiedClassName, innerName, type, bug);
            }
        } else {
            // second argument is required to find also secondary types
            type = project.findType(qualifiedClassName.replace('$', '.'), (IProgressMonitor) null);

            // for inner classes, some detectors does not properly report source
            // lines:
            // instead of reporting the first line of inner class, they report
            // first line of parent class
            // in this case we will try to fix this here and point to the right
            // start line
            if (type != null && type.isMember()) {
                if (!hasLineInfo(primarySourceLineAnnotation)) {
                    completeInnerClassInfo(qualifiedClassName, type.getElementName(), type, bug);
                }
            }
        }

        // reassign it as it may be changed for inner classes
        primarySourceLineAnnotation = bug.getPrimarySourceLineAnnotation();

        /*
         * Eclipse can help us find the line number for fields => we trying to
         * add line info for fields here
         */
        int startLine = primarySourceLineAnnotation.getStartLine();
        // TODO don't use "1", use "0" ?
        if (startLine <= 1 && type != null) {
            FieldAnnotation primaryField = bug.getPrimaryField();
            if(primaryField != null) {
                completeFieldInfo(qualifiedClassName, type, bug, primaryField);
            }
        }

        return type;
    }
1321977
protected void makeRunnerIfNeeded() {
    // We don't need to make a SVG runner when there are no pending updates.
    boolean stop = true;
    for(WeakReference<UpdateRunner> wur : updaterunner) {
      UpdateRunner ur = wur.get();
      if(ur == null) {
        updaterunner.remove(wur);
      }
      else if(!ur.isEmpty()) {
        stop = false;
      }
    }
    if(stop) {
      return;
    }
    // We only need a new runner when we don't have one in the queue yet!
    if(pending.get() != null) {
      return;
    }
    // We need a component
    JSVGComponent component = this.cref.get();
    if(component == null) {
      return;
    }
    // Synchronize with all layers:
    synchronized(this) {
      synchronized(component) {
        UpdateManager um = component.getUpdateManager();
        if(um != null) {
          synchronized(um) {
            if(um.isRunning()) {
              // Create and insert a runner.
              Runnable newrunner = new Runnable() {
                @Override
                public void run() {
                  if(pending.compareAndSet(this, null)) {
                    // Wake up all runners
                    for(WeakReference<UpdateRunner> wur : updaterunner) {
                      UpdateRunner ur = wur.get();
                      if(ur == null || ur.isEmpty()) {
                        continue;
                      }
                      ur.runQueue();
                    }
                  }
                }
              };
              pending.set(newrunner);
              um.getUpdateRunnableQueue().invokeLater(newrunner);
              return;
            }
          }
        }
      }
    }
  }
434006
public static void main(String[] args) throws Exception {
    BinaryProblem problem = new OneMax(1024) ;

    MutationOperator<BinarySolution> mutationOperator =
        new BitFlipMutation(1.0 / problem.getNumberOfBits(0)) ;

    int improvementRounds = 10000 ;

    Comparator<BinarySolution> comparator = new DominanceComparator<>(0) ;

    LocalSearchOperator<BinarySolution> localSearch = new BasicLocalSearch<>(
            improvementRounds,
            mutationOperator,
            comparator,
            problem) ;

    BinarySolution solution = problem.createSolution() ;

    BinarySolution newSolution = localSearch.execute(solution) ;

    JMetalLogger.logger.info("Fitness: " + newSolution.getObjective(0)) ;
    JMetalLogger.logger.info("Solution: " + newSolution.getVariableValueString(0)) ;
  }
551276
@Override
    public void visitCode(Code obj) {

        stack.resetForMethodEntry(this);
        localSpecialObjects.clear();
        sawTernary = false;
        super.visitCode(obj);

        for (Integer pc : localSpecialObjects.values()) {
            bugReporter.reportBug(
                    makeLocalBugInstance().addClass(this).addMethod(this).addSourceLine(this, pc.intValue()));
        }
    }
955209
private void tidySerialization(Class<?> reloadedClass) {
		//		if (true) return;
		try {
			Class<?> clazz = Class.forName("java.io.ObjectStreamClass$Caches");
			Field localDescsField = clazz.getDeclaredField("localDescs");
			localDescsField.setAccessible(true);
			ConcurrentMap cm = (ConcurrentMap) localDescsField.get(null);
			// TODO [serialization] a bit extreme to wipe out everything
			cm.clear();
			// For some reason clearing the reflectors damages serialization - is it not a true cache?
			//			Field reflectorsField = clazz.getDeclaredField("reflectors");
			//			reflectorsField.setAccessible(true);
			//			cm = (ConcurrentMap)reflectorsField.get(null);
			//			cm.clear();
		}
		catch (ClassNotFoundException e) {
			throw new IllegalStateException(e);
		}
		catch (NoSuchFieldException e) {
			throw new IllegalStateException(e);
		}
		catch (SecurityException e) {
			throw new IllegalStateException(e);
		}
		catch (IllegalArgumentException e) {
			throw new IllegalStateException(e);
		}
		catch (IllegalAccessException e) {
			throw new IllegalStateException(e);
		}


		//		private static class Caches {
		//	        /** cache mapping local classes -> descriptors */
		//	        static final ConcurrentMap<WeakClassKey,Reference<?>> localDescs =
		//	            new ConcurrentHashMap<>();
		//
		//	        /** cache mapping field group/local desc pairs -> field reflectors */
		//	        static final ConcurrentMap<FieldReflectorKey,Reference<?>> reflectors =
		//	            new ConcurrentHashMap<>();
		//
		//	        /** queue for WeakReferences to local classes */
		//	        private static final ReferenceQueue<Class<?>> localDescsQueue =
		//	            new ReferenceQueue<>();
		//	        /** queue for WeakReferences to field reflectors keys */
		//	        private static final ReferenceQueue<Class<?>> reflectorsQueue =
		//	            new ReferenceQueue<>();
		//	    }
	}
131413
def _needs_java(data):
    
    vc = dd.get_variantcaller(data)
    if isinstance(vc, dict):
        out = {}
        for k, v in vc.items():
            if not isinstance(v, (list, tuple)):
                v = [v]
            out[k] = v
        vc = out
    elif not isinstance(vc, (list, tuple)):
        vc = [vc]
    if "mutect" in vc or ("somatic" in vc and "mutect" in vc["somatic"]):
        return True
    if "gatk" in vc or "gatk-haplotype" in vc or ("germline" in vc and "gatk-haplotype" in vc["germline"]):
        pass
        # runner = broad.runner_from_config(data["config"])
        # version = runner.get_gatk_version()
        # if LooseVersion(version) < LooseVersion("3.6"):
        #     return True
    return False
627375
private void flush() {

        if (pendingAbsoluteValueBug != null) {
            absoluteValueAccumulator.accumulateBug(pendingAbsoluteValueBug, pendingAbsoluteValueBugSourceLine);
            pendingAbsoluteValueBug = null;
            pendingAbsoluteValueBugSourceLine = null;
        }
        accumulator.reportAccumulatedBugs();
        if (sawLoadOfMinValue) {
            absoluteValueAccumulator.clearBugs();
        } else {
            absoluteValueAccumulator.reportAccumulatedBugs();
        }
        if (gcInvocationBugReport != null && !sawCurrentTimeMillis) {
            // Make sure the GC invocation is not in an exception handler
            // for OutOfMemoryError.
            boolean outOfMemoryHandler = false;
            for (CodeException handler : exceptionTable) {
                if (gcInvocationPC < handler.getHandlerPC() || gcInvocationPC > handler.getHandlerPC() + OOM_CATCH_LEN) {
                    continue;
                }
                int catchTypeIndex = handler.getCatchType();
                if (catchTypeIndex > 0) {
                    ConstantPool cp = getThisClass().getConstantPool();
                    Constant constant = cp.getConstant(catchTypeIndex);
                    if (constant instanceof ConstantClass) {
                        String exClassName = (String) ((ConstantClass) constant).getConstantValue(cp);
                        if ("java/lang/OutOfMemoryError".equals(exClassName)) {
                            outOfMemoryHandler = true;
                            break;
                        }
                    }
                }
            }

            if (!outOfMemoryHandler) {
                bugReporter.reportBug(gcInvocationBugReport);
            }
        }

        sawCurrentTimeMillis = false;
        gcInvocationBugReport = null;

        exceptionTable = null;
    }
1292644
private void checkIDEGeneratedParmNames(JavaClass cls) {
		for (Method m : cls.getMethods()) {
			if (isIDEGeneratedMethodWithCode(m)) {
				bugReporter.reportBug(
						new BugInstance(this, BugType.IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES.name(),
								NORMAL_PRIORITY).addClass(cls).addMethod(cls, m));
				return;
			}
		}
	}
1160597
public void removeTangoUserListener(ITangoUserListener listener) 
                throws DevFailed
    {
        event_listeners.remove(ITangoUserListener.class,listener);
        if ( event_listeners.size() == 0 )
           unsubscribe_event(event_identifier);

    }
770689
@GwtIncompatible("Unnecessary")
  private List<SourceFile> createSourceInputs(
      List<JsModuleSpec> jsModuleSpecs,
      List<FlagEntry<JsSourceType>> files,
      List<JsonFileSpec> jsonFiles,
      List<String> moduleRoots)
      throws IOException {
    if (isInTestMode()) {
      return inputsSupplierForTesting != null ? inputsSupplierForTesting.get()
          : null;
    }
    if (files.isEmpty() && jsonFiles == null) {
      // Request to read from stdin.
      files = ImmutableList.of(new FlagEntry<JsSourceType>(JsSourceType.JS, "-"));
    }

    for (JSError error : deduplicateIjsFiles(files, moduleRoots, !jsModuleSpecs.isEmpty())) {
      compiler.report(error);
    }

    try {
      if (jsonFiles != null) {
        return createInputs(files, jsonFiles, jsModuleSpecs);
      } else {
        return createInputs(files, true, jsModuleSpecs);
      }
    } catch (FlagUsageException e) {
      throw new FlagUsageException("Bad --js flag. " + e.getMessage());
    }
  }