text:
import {join} from 'path';
import {homedir} from 'os';
import {BaseEnvironment} from './BaseEnvironment';
export class DefaultEnvironment extends BaseEnvironment {
  constructor(variables?: any) {
    variables = variables || {};
    if(!variables.env) {
      switch (process.env.NODE_ENV) {
        case 'production':
          variables.env = 'production';
          break;
        case 'prepub':
          variables.env = 'prepub';
          break;
        case 'test':
        case 'unittest':
          variables.env = 'test';
          break;
        default:
          variables.env = 'development';
          break;
      }
    }
    if(!variables.pandoraLogsDir) {
      variables.pandoraLogsDir = join(homedir(), 'logs');
    }
    super(variables);
  }

  match(name: string): boolean {
    return this.get('env') === name;
  }
}


text:
package lockerfakes

import (
	"sync"
)

type FakeGitRepo struct {
	CloneOrPullStub        func() error
	cloneOrPullMutex       sync.RWMutex
	cloneOrPullArgsForCall []struct{}
	cloneOrPullReturns     struct {
		result1 error
	}
	cloneOrPullReturnsOnCall map[int]struct {
		result1 error
	}
	CommitAndPushStub        func(message, user string) error
	commitAndPushMutex       sync.RWMutex
	commitAndPushArgsForCall []struct {
		message string
		user    string
	}
	commitAndPushReturns struct {
		result1 error
	}
	commitAndPushReturnsOnCall map[int]struct {
		result1 error
	}
	DirStub        func() string
	dirMutex       sync.RWMutex
	dirArgsForCall []struct{}
	dirReturns     struct {
		result1 string
	}
	dirReturnsOnCall map[int]struct {
		result1 string
	}
	LatestCommitStub        func(pool string) (committer, date, message string, err error)
	latestCommitMutex       sync.RWMutex
	latestCommitArgsForCall []struct {
		pool string
	}
	latestCommitReturns struct {
		result1 string
		result2 string
		result3 string
		result4 error
	}
	latestCommitReturnsOnCall map[int]struct {
		result1 string
		result2 string
		result3 string
		result4 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeGitRepo) CloneOrPull() error {
	fake.cloneOrPullMutex.Lock()
	ret, specificReturn := fake.cloneOrPullReturnsOnCall[len(fake.cloneOrPullArgsForCall)]
	fake.cloneOrPullArgsForCall = append(fake.cloneOrPullArgsForCall, struct{}{})
	fake.recordInvocation("CloneOrPull", []interface{}{})
	fake.cloneOrPullMutex.Unlock()
	if fake.CloneOrPullStub != nil {
		return fake.CloneOrPullStub()
	}
	if specificReturn {
		return ret.result1
	}
	return fake.cloneOrPullReturns.result1
}

func (fake *FakeGitRepo) CloneOrPullCallCount() int {
	fake.cloneOrPullMutex.RLock()
	defer fake.cloneOrPullMutex.RUnlock()
	return len(fake.cloneOrPullArgsForCall)
}

func (fake *FakeGitRepo) CloneOrPullReturns(result1 error) {
	fake.CloneOrPullStub = nil
	fake.cloneOrPullReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeGitRepo) CloneOrPullReturnsOnCall(i int, result1 error) {
	fake.CloneOrPullStub = nil
	if fake.cloneOrPullReturnsOnCall == nil {
		fake.cloneOrPullReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.cloneOrPullReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeGitRepo) CommitAndPush(message string, user string) error {
	fake.commitAndPushMutex.Lock()
	ret, specificReturn := fake.commitAndPushReturnsOnCall[len(fake.commitAndPushArgsForCall)]
	fake.commitAndPushArgsForCall = append(fake.commitAndPushArgsForCall, struct {
		message string
		user    string
	}{message, user})
	fake.recordInvocation("CommitAndPush", []interface{}{message, user})
	fake.commitAndPushMutex.Unlock()
	if fake.CommitAndPushStub != nil {
		return fake.CommitAndPushStub(message, user)
	}
	if specificReturn {
		return ret.result1
	}
	return fake.commitAndPushReturns.result1
}

func (fake *FakeGitRepo) CommitAndPushCallCount() int {
	fake.commitAndPushMutex.RLock()
	defer fake.commitAndPushMutex.RUnlock()
	return len(fake.commitAndPushArgsForCall)
}

func (fake *FakeGitRepo) CommitAndPushArgsForCall(i int) (string, string) {
	fake.commitAndPushMutex.RLock()
	defer fake.commitAndPushMutex.RUnlock()
	return fake.commitAndPushArgsForCall[i].message, fake.commitAndPushArgsForCall[i].user
}

func (fake *FakeGitRepo) CommitAndPushReturns(result1 error) {
	fake.CommitAndPushStub = nil
	fake.commitAndPushReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeGitRepo) CommitAndPushReturnsOnCall(i int, result1 error) {
	fake.CommitAndPushStub = nil
	if fake.commitAndPushReturnsOnCall == nil {
		fake.commitAndPushReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.commitAndPushReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeGitRepo) Dir() string {
	fake.dirMutex.Lock()
	ret, specificReturn := fake.dirReturnsOnCall[len(fake.dirArgsForCall)]
	fake.dirArgsForCall = append(fake.dirArgsForCall, struct{}{})
	fake.recordInvocation("Dir", []interface{}{})
	fake.dirMutex.Unlock()
	if fake.DirStub != nil {
		return fake.DirStub()
	}
	if specificReturn {
		return ret.result1
	}
	return fake.dirReturns.result1
}

func (fake *FakeGitRepo) DirCallCount() int {
	fake.dirMutex.RLock()
	defer fake.dirMutex.RUnlock()
	return len(fake.dirArgsForCall)
}

func (fake *FakeGitRepo) DirReturns(result1 string) {
	fake.DirStub = nil
	fake.dirReturns = struct {
		result1 string
	}{result1}
}

func (fake *FakeGitRepo) DirReturnsOnCall(i int, result1 string) {
	fake.DirStub = nil
	if fake.dirReturnsOnCall == nil {
		fake.dirReturnsOnCall = make(map[int]struct {
			result1 string
		})
	}
	fake.dirReturnsOnCall[i] = struct {
		result1 string
	}{result1}
}

func (fake *FakeGitRepo) LatestCommit(pool string) (committer, date, message string, err error) {
	fake.latestCommitMutex.Lock()
	ret, specificReturn := fake.latestCommitReturnsOnCall[len(fake.latestCommitArgsForCall)]
	fake.latestCommitArgsForCall = append(fake.latestCommitArgsForCall, struct {
		pool string
	}{pool})
	fake.recordInvocation("LatestCommit", []interface{}{pool})
	fake.latestCommitMutex.Unlock()
	if fake.LatestCommitStub != nil {
		return fake.LatestCommitStub(pool)
	}
	if specificReturn {
		return ret.result1, ret.result2, ret.result3, ret.result4
	}
	return fake.latestCommitReturns.result1, fake.latestCommitReturns.result2, fake.latestCommitReturns.result3, fake.latestCommitReturns.result4
}

func (fake *FakeGitRepo) LatestCommitCallCount() int {
	fake.latestCommitMutex.RLock()
	defer fake.latestCommitMutex.RUnlock()
	return len(fake.latestCommitArgsForCall)
}

func (fake *FakeGitRepo) LatestCommitArgsForCall(i int) string {
	fake.latestCommitMutex.RLock()
	defer fake.latestCommitMutex.RUnlock()
	return fake.latestCommitArgsForCall[i].pool
}

func (fake *FakeGitRepo) LatestCommitReturns(result1 string, result2 string, result3 string, result4 error) {
	fake.LatestCommitStub = nil
	fake.latestCommitReturns = struct {
		result1 string
		result2 string
		result3 string
		result4 error
	}{result1, result2, result3, result4}
}

func (fake *FakeGitRepo) LatestCommitReturnsOnCall(i int, result1 string, result2 string, result3 string, result4 error) {
	fake.LatestCommitStub = nil
	if fake.latestCommitReturnsOnCall == nil {
		fake.latestCommitReturnsOnCall = make(map[int]struct {
			result1 string
			result2 string
			result3 string
			result4 error
		})
	}
	fake.latestCommitReturnsOnCall[i] = struct {
		result1 string
		result2 string
		result3 string
		result4 error
	}{result1, result2, result3, result4}
}

func (fake *FakeGitRepo) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.cloneOrPullMutex.RLock()
	defer fake.cloneOrPullMutex.RUnlock()
	fake.commitAndPushMutex.RLock()
	defer fake.commitAndPushMutex.RUnlock()
	fake.dirMutex.RLock()
	defer fake.dirMutex.RUnlock()
	fake.latestCommitMutex.RLock()
	defer fake.latestCommitMutex.RUnlock()
	return fake.invocations
}

func (fake *FakeGitRepo) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

redpajama_set_name: RedPajamaGithub


text:
<?php namespace System;

class Column
{
	protected static $instance = NULL;

	protected $id        = NULL;
	protected $header    = NULL;  // catre obiect Header (orice coloana are un Header)
	protected $orderable = false;
	protected $class     = NULL;
	protected $visible   = true;

	public function __construct($id)
	{
		$this->id = $id;
	}

	public static function make($id)
	{
		return self::$instance = new Column($id);
	}

	public function __call($method, $args)
	{
		if(! property_exists($this, $method))
		{
			throw new \Exception(__CLASS__ .'. Property ' . $method . ' unknown.');
		}
		if( isset($args[0]) )
		{
			$this->{$method} = $args[0];
			return $this;
		}
		return $this->{$method};
	}

	public function js()
	{
		if( ! $this->visible )
		{
			return '';
		}
		$result = " 'data':'" . $this->id . "', 'orderable':" . ($this->orderable ? 'true' : 'false') . ", 'className':'" . $this->class . "'";
		return "{" . $result . "}";
	}
}


text:
<?php

/**
 * Creates the appropriate Persistor based on a given type and spec.
 *
 * @since      Class available since Release 1.0.0
 */
class PHPUnit_Extensions_Database_DataSet_Persistors_Factory
{
    /**
     * Returns the persistor.
     *
     * @param  string                                           $type
     * @param  string                                           $spec
     * @return PHPUnit_Extensions_Database_DataSet_IPersistable
     */
    public function getPersistorBySpec($type, $spec)
    {
        switch (strtolower($type)) {
            case 'xml':
                $xmlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_Xml();
                $xmlPersistor->setFileName($spec);

                return $xmlPersistor;

            case 'flatxml':
                $flatXmlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_FlatXml();
                $flatXmlPersistor->setFileName($spec);

                return $flatXmlPersistor;

            case 'yaml':
                $yamlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_Yaml();
                $yamlPersistor->setFileName($spec);

                return $yamlPersistor;

            case 'mysqlxml':
                $mysqlXmlPersistor = new PHPUnit_Extensions_Database_DataSet_Persistors_MysqlXml();
                $mysqlXmlPersistor->setFileName($spec);

                return $mysqlXmlPersistor;

            default:
                throw new PHPUnit_Extensions_Database_Exception("I don't know what you want from me. PERSISTOR");
        }
    }
}


text:
static int verbose = 0;

extern void
local_align_field_list(FMFieldList field_list, int pointer_size);

void
do_test(FMContext c, char *name, FMFieldList fields)
{
    int i = 0;
    FMFieldList tmp = copy_field_list(fields);

    local_align_field_list(tmp, sizeof(char*));
    while(fields[i].field_name != NULL) {
	if (fields[i].field_offset != tmp[i].field_offset) {
	    printf("Failed alignment of field %s in format %s, got %d, expected %d\n",
		   fields[i].field_name, name, tmp[i].field_offset,
		   fields[i].field_offset);
	}
	i++;
    }
}

int
main(argc, argv)
int argc;
char **argv;
{
    FMContext c;
    do_test(c, "first format", field_list);
    do_test(c, "string format", field_list2);
    do_test(c, "two string format", field_list3);
    do_test(c, "internal array format", field_list4);
    do_test(c, "embedded", embedded_field_list);
    do_test(c, "structured array format", field_list5);
    do_test(c, "variant array format", field_list6);
    do_test(c, "later format", later_field_list);
    do_test(c, "nested format", nested_field_list);
    do_test(c, "EventVecElem", event_vec_elem_fields);
    do_test(c, "EventV", field_list9);
    do_test(c, "string_array", string_array_field_list);
    return 0;
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: xdata
 * Date: 12/11/16
 * Time: 12:23 PM
 */

/**
 * @param $intentList
 */

{
    include '../conexao/Call.php';
    include '../modelo/User.php';

    session_start();

    $intentList = array(
        "login-credential"=>function($post){login($post);},
        "load-menu-user"=> function () {loadMenuUser();},
        "load-page"=>function() {loadPage();}
    );

    executeIntent($intentList);

    //login();

    function login($post)
    {
        //$post = jsonObject($_POST);
        requireOnArray($_POST, POST_DATA);
        requireOnArray(postValue(POST_DATA), POST_ACCESSNAME, POST_PASSWORD);

        $call = new Call();
        $call->functionTable("funct_login", "*")
            ->addString($post->data->accessName)
            ->addString($post->data->password);

        $call->execute();

        $result = $call->getValors();

        if(count($result) == 1)
        {

            $data = $result[0];

            $user = new User();

            $user
                ->setId($data["ID"])
                ->setDomainId($data["DOMAIN.ID"])
                ->setName($data["USER.NAME"])
                ->setSurname($data["USER.SURNAME"])
                ->setDomaniType($data["DOMAIN.TYPE"])
                ->setAccessName($data["USER.ACCESSNAME"])
                ->setStateId($data["USER.ACCESS"])
                ->setStateDesc($data["USER.ACCESS-DESC"]);

            $_SESSION[SESSION_USER] = $user;
            $_SESSION[SESSION] = true;

            die(json_encode(
                array(
                    "result"=>true,
                    "data"=>[
                        "message"=>"successfully"
                    ]
                )
            ));
        }
    }

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Ann. Missouri Bot. Gard. 32:406. 1945

#### Original name
null

### Remarks
null


text:
from __future__ import print_function, unicode_literals

import errno
import os
import posixpath
import re
import sys
import shutil
from abc import ABCMeta, abstractmethod
try:
    from urlparse import urljoin
except ImportError:
    from urllib.parse import urljoin

import requests
from flask import safe_join

from .constants import (
    STYLE_URLS_SOURCE, STYLE_URLS_RE, STYLE_ASSET_URLS_RE,
    STYLE_ASSET_URLS_SUB_FORMAT)
from .vendor.six import add_metaclass

@add_metaclass(ABCMeta)
class ReadmeAssetManager(object):
    """
    Manages the style and font assets rendered with Readme pages.

    Set cache_path to None to disable caching.
    """
    def __init__(self, cache_path, style_urls=None):
        super(ReadmeAssetManager, self).__init__()
        self.cache_path = cache_path
        self.style_urls = list(style_urls) if style_urls else []
        self.styles = []

    def _stip_url_params(self, url):
        return url.rsplit('?', 1)[0].rsplit('#', 1)[0]

    def clear(self):
        """
        Clears the asset cache.
        """
        if self.cache_path and os.path.exists(self.cache_path):
            shutil.rmtree(self.cache_path)

    def cache_filename(self, url):
        """
        Gets a suitable relative filename for the specified URL.
        """
        # FUTURE: Use url exactly instead of flattening it here
        url = posixpath.basename(url)
        return self._stip_url_params(url)

    @abstractmethod
    def retrieve_styles(self, asset_url_path):
        """
        Get style URLs from the source HTML page and specified cached asset
        URL path.
        """
        pass

class GitHubAssetManager(ReadmeAssetManager):
    """
    Reads the styles used for rendering Readme pages.

    Set cache_path to None to disable caching.
    """
    def __init__(self, cache_path, style_urls=None):
        super(GitHubAssetManager, self).__init__(cache_path, style_urls)

    def _get_style_urls(self, asset_url_path):
        """
        Gets the specified resource and parses all style URLs and their
        assets in the form of the specified patterns.
        """
        # Check cache
        if self.cache_path:
            cached = self._get_cached_style_urls(asset_url_path)
            # Skip fetching styles if there's any already cached
            if cached:
                return cached

        # Find style URLs
        r = requests.get(STYLE_URLS_SOURCE)
        if not 200 <= r.status_code < 300:
            print('Warning: retrieving styles gave status code',
                  r.status_code, file=sys.stderr)
        urls = re.findall(STYLE_URLS_RE, r.text)

        # Cache the styles and their assets
        if self.cache_path:
            is_cached = self._cache_contents(urls, asset_url_path)
            if is_cached:
                urls = self._get_cached_style_urls(asset_url_path)

        return urls

    def _get_cached_style_urls(self, asset_url_path):
        """
        Gets the URLs of the cached styles.
        """
        try:
            cached_styles = os.listdir(self.cache_path)
        except IOError as ex:
            if ex.errno != errno.ENOENT and ex.errno != errno.ESRCH:
                raise
            return []
        except OSError:
            return []
        return [posixpath.join(asset_url_path, style)
                for style in cached_styles
                if style.endswith('.css')]

    def _cache_contents(self, style_urls, asset_url_path):
        """
        Fetches the given URLs and caches their contents
        and their assets in the given directory.
        """
        files = {}

        asset_urls = []
        for style_url in style_urls:
            print(' * Downloading style', style_url, file=sys.stderr)
            r = requests.get(style_url)
            if not 200 <= r.status_code < 300:
                print(' -> Warning: Style request responded with',
                      r.status_code, file=sys.stderr)
                files = None
                continue
            asset_content = r.text
            # Find assets and replace their base URLs with the cache directory
            for url in re.findall(STYLE_ASSET_URLS_RE, asset_content):
                asset_urls.append(urljoin(style_url, url))
            contents = re.sub(
                STYLE_ASSET_URLS_RE,
                STYLE_ASSET_URLS_SUB_FORMAT.format(asset_url_path.rstrip('/')),
                asset_content)
            # Prepare cache
            if files is not None:
                filename = self.cache_filename(style_url)
                files[filename] = contents.encode('utf-8')

        for asset_url in asset_urls:
            print(' * Downloading asset', asset_url, file=sys.stderr)
            # Retrieve binary file and show message
            r = requests.get(asset_url, stream=True)
            if not 200 <= r.status_code < 300:
                print(' -> Warning: Asset request responded with',
                      r.status_code, file=sys.stderr)
                files = None
                continue
            # Prepare cache
            if files is not None:
                filename = self.cache_filename(asset_url)
                files[filename] = r.raw.read(decode_content=True)

        # Skip caching if something went wrong to try again next time
        if not files:
            return False

        # Cache files if all downloads were successful
        cache = {}
        for relname in files:
            cache[safe_join(self.cache_path, relname)] = files[relname]
        if not os.path.exists(self.cache_path):
            os.makedirs(self.cache_path)
        for filename in cache:
            with open(filename, 'wb') as f:
                f.write(cache[filename])
        print(' * Cached all downloads in', self.cache_path, file=sys.stderr)
        return True

    def retrieve_styles(self, asset_url_path):
        """
        Get style URLs from the source HTML page and specified cached
        asset base URL.
        """
        if not asset_url_path.endswith('/'):
            asset_url_path += '/'
        self.style_urls.extend(self._get_style_urls(asset_url_path))


text:
package com.alibaba.fastjson.parser;

import java.io.Closeable;
import java.io.File;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicLongArray;
import java.util.regex.Pattern;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.asm.ASMException;
import com.alibaba.fastjson.parser.deserializer.ASMDeserializerFactory;
import com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ArrayDeserializer;
import com.alibaba.fastjson.parser.deserializer.ArrayListStringDeserializer;
import com.alibaba.fastjson.parser.deserializer.ArrayListStringFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.ArrayListTypeDeserializer;
import com.alibaba.fastjson.parser.deserializer.ArrayListTypeFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.AtomicIntegerArrayDeserializer;
import com.alibaba.fastjson.parser.deserializer.AtomicLongArrayDeserializer;
import com.alibaba.fastjson.parser.deserializer.AutowiredObjectDeserializer;
import com.alibaba.fastjson.parser.deserializer.BigDecimalDeserializer;
import com.alibaba.fastjson.parser.deserializer.BigIntegerDeserializer;
import com.alibaba.fastjson.parser.deserializer.BooleanDeserializer;
import com.alibaba.fastjson.parser.deserializer.BooleanFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.CalendarDeserializer;
import com.alibaba.fastjson.parser.deserializer.CharArrayDeserializer;
import com.alibaba.fastjson.parser.deserializer.CharacterDeserializer;
import com.alibaba.fastjson.parser.deserializer.CharsetDeserializer;
import com.alibaba.fastjson.parser.deserializer.ClassDerializer;
import com.alibaba.fastjson.parser.deserializer.CollectionDeserializer;
import com.alibaba.fastjson.parser.deserializer.ColorDeserializer;
import com.alibaba.fastjson.parser.deserializer.DateDeserializer;
import com.alibaba.fastjson.parser.deserializer.DateFormatDeserializer;
import com.alibaba.fastjson.parser.deserializer.DefaultFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.DefaultObjectDeserializer;
import com.alibaba.fastjson.parser.deserializer.EnumDeserializer;
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.FileDeserializer;
import com.alibaba.fastjson.parser.deserializer.FloatDeserializer;
import com.alibaba.fastjson.parser.deserializer.FontDeserializer;
import com.alibaba.fastjson.parser.deserializer.InetAddressDeserializer;
import com.alibaba.fastjson.parser.deserializer.InetSocketAddressDeserializer;
import com.alibaba.fastjson.parser.deserializer.IntegerDeserializer;
import com.alibaba.fastjson.parser.deserializer.IntegerFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.JSONArrayDeserializer;
import com.alibaba.fastjson.parser.deserializer.JSONObjectDeserializer;
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.JavaObjectDeserializer;
import com.alibaba.fastjson.parser.deserializer.LocaleDeserializer;
import com.alibaba.fastjson.parser.deserializer.LongDeserializer;
import com.alibaba.fastjson.parser.deserializer.LongFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.MapDeserializer;
import com.alibaba.fastjson.parser.deserializer.NumberDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.alibaba.fastjson.parser.deserializer.PatternDeserializer;
import com.alibaba.fastjson.parser.deserializer.PointDeserializer;
import com.alibaba.fastjson.parser.deserializer.RectangleDeserializer;
import com.alibaba.fastjson.parser.deserializer.SqlDateDeserializer;
import com.alibaba.fastjson.parser.deserializer.StackTraceElementDeserializer;
import com.alibaba.fastjson.parser.deserializer.StringDeserializer;
import com.alibaba.fastjson.parser.deserializer.StringFieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer;
import com.alibaba.fastjson.parser.deserializer.TimeDeserializer;
import com.alibaba.fastjson.parser.deserializer.TimeZoneDeserializer;
import com.alibaba.fastjson.parser.deserializer.TimestampDeserializer;
import com.alibaba.fastjson.parser.deserializer.URIDeserializer;
import com.alibaba.fastjson.parser.deserializer.URLDeserializer;
import com.alibaba.fastjson.parser.deserializer.UUIDDeserializer;
import com.alibaba.fastjson.util.ASMUtils;
import com.alibaba.fastjson.util.DeserializeBeanInfo;
import com.alibaba.fastjson.util.FieldInfo;
import com.alibaba.fastjson.util.IdentityHashMap;
import com.alibaba.fastjson.util.ServiceLoader;

/**
 * @author wenshao<szujobs@hotmail.com>
 */
public class ParserConfig {

    public static ParserConfig getGlobalInstance() {
        return global;
    }
    private final Set<Class<?>> primitiveClasses = new HashSet<Class<?>>();
    private static ParserConfig global = new ParserConfig();
    private final IdentityHashMap<Type, ObjectDeserializer> derializers = new IdentityHashMap<Type, ObjectDeserializer>();
    private DefaultObjectDeserializer defaultSerializer = new DefaultObjectDeserializer();
    private boolean asmEnable = !ASMUtils.isAndroid();
    protected final SymbolTable symbolTable = new SymbolTable();

    public DefaultObjectDeserializer getDefaultSerializer() {
        return defaultSerializer;
    }

    public ParserConfig() {
        primitiveClasses.add(boolean.class);
        primitiveClasses.add(Boolean.class);

        primitiveClasses.add(char.class);
        primitiveClasses.add(Character.class);

        primitiveClasses.add(byte.class);
        primitiveClasses.add(Byte.class);

        primitiveClasses.add(short.class);
        primitiveClasses.add(Short.class);

        primitiveClasses.add(int.class);
        primitiveClasses.add(Integer.class);

        primitiveClasses.add(long.class);
        primitiveClasses.add(Long.class);

        primitiveClasses.add(float.class);
        primitiveClasses.add(Float.class);

        primitiveClasses.add(double.class);
        primitiveClasses.add(Double.class);

        primitiveClasses.add(BigInteger.class);
        primitiveClasses.add(BigDecimal.class);

        primitiveClasses.add(String.class);
        primitiveClasses.add(java.util.Date.class);
        primitiveClasses.add(java.sql.Date.class);
        primitiveClasses.add(java.sql.Time.class);
        primitiveClasses.add(java.sql.Timestamp.class);

        derializers.put(SimpleDateFormat.class, DateFormatDeserializer.instance);
        derializers.put(java.sql.Timestamp.class, TimestampDeserializer.instance);
        derializers.put(java.sql.Date.class, SqlDateDeserializer.instance);
        derializers.put(java.sql.Time.class, TimeDeserializer.instance);
        derializers.put(java.util.Date.class, DateDeserializer.instance);
        derializers.put(Calendar.class, CalendarDeserializer.instance);

        derializers.put(JSONObject.class, JSONObjectDeserializer.instance);
        derializers.put(JSONArray.class, JSONArrayDeserializer.instance);

        derializers.put(Map.class, MapDeserializer.instance);
        derializers.put(HashMap.class, MapDeserializer.instance);
        derializers.put(LinkedHashMap.class, MapDeserializer.instance);
        derializers.put(TreeMap.class, MapDeserializer.instance);
        derializers.put(ConcurrentMap.class, MapDeserializer.instance);
        derializers.put(ConcurrentHashMap.class, MapDeserializer.instance);

        derializers.put(Collection.class, CollectionDeserializer.instance);
        derializers.put(List.class, CollectionDeserializer.instance);
        derializers.put(ArrayList.class, CollectionDeserializer.instance);

        derializers.put(Object.class, JavaObjectDeserializer.instance);
        derializers.put(String.class, StringDeserializer.instance);
        derializers.put(char.class, CharacterDeserializer.instance);
        derializers.put(Character.class, CharacterDeserializer.instance);
        derializers.put(byte.class, NumberDeserializer.instance);
        derializers.put(Byte.class, NumberDeserializer.instance);
        derializers.put(short.class, NumberDeserializer.instance);
        derializers.put(Short.class, NumberDeserializer.instance);
        derializers.put(int.class, IntegerDeserializer.instance);
        derializers.put(Integer.class, IntegerDeserializer.instance);
        derializers.put(long.class, LongDeserializer.instance);
        derializers.put(Long.class, LongDeserializer.instance);
        derializers.put(BigInteger.class, BigIntegerDeserializer.instance);
        derializers.put(BigDecimal.class, BigDecimalDeserializer.instance);
        derializers.put(float.class, FloatDeserializer.instance);
        derializers.put(Float.class, FloatDeserializer.instance);
        derializers.put(double.class, NumberDeserializer.instance);
        derializers.put(Double.class, NumberDeserializer.instance);
        derializers.put(boolean.class, BooleanDeserializer.instance);
        derializers.put(Boolean.class, BooleanDeserializer.instance);
        derializers.put(Class.class, ClassDerializer.instance);
        derializers.put(char[].class, CharArrayDeserializer.instance);

        derializers.put(UUID.class, UUIDDeserializer.instance);
        derializers.put(TimeZone.class, TimeZoneDeserializer.instance);
        derializers.put(Locale.class, LocaleDeserializer.instance);
        derializers.put(InetAddress.class, InetAddressDeserializer.instance);
        derializers.put(Inet4Address.class, InetAddressDeserializer.instance);
        derializers.put(Inet6Address.class, InetAddressDeserializer.instance);
        derializers.put(InetSocketAddress.class, InetSocketAddressDeserializer.instance);
        derializers.put(File.class, FileDeserializer.instance);
        derializers.put(URI.class, URIDeserializer.instance);
        derializers.put(URL.class, URLDeserializer.instance);
        derializers.put(Pattern.class, PatternDeserializer.instance);
        derializers.put(Charset.class, CharsetDeserializer.instance);
        derializers.put(Number.class, NumberDeserializer.instance);
        derializers.put(AtomicIntegerArray.class, AtomicIntegerArrayDeserializer.instance);
        derializers.put(AtomicLongArray.class, AtomicLongArrayDeserializer.instance);
        derializers.put(StackTraceElement.class, StackTraceElementDeserializer.instance);

        derializers.put(Serializable.class, defaultSerializer);
        derializers.put(Cloneable.class, defaultSerializer);
        derializers.put(Comparable.class, defaultSerializer);
        derializers.put(Closeable.class, defaultSerializer);

        try {
            derializers.put(Class.forName("java.awt.Point"), PointDeserializer.instance);
            derializers.put(Class.forName("java.awt.Font"), FontDeserializer.instance);
            derializers.put(Class.forName("java.awt.Rectangle"), RectangleDeserializer.instance);
            derializers.put(Class.forName("java.awt.Color"), ColorDeserializer.instance);
        } catch (Throwable e) {
            // skip
        }
    }

    public boolean isAsmEnable() {
        return asmEnable;
    }

    public void setAsmEnable(boolean asmEnable) {
        this.asmEnable = asmEnable;
    }

    public SymbolTable getSymbolTable() {
        return symbolTable;
    }

    public IdentityHashMap<Type, ObjectDeserializer> getDerializers() {
        return derializers;
    }

    public ObjectDeserializer getDeserializer(Type type) {
        ObjectDeserializer derializer = this.derializers.get(type);
        if (derializer != null) {
            return derializer;
        }

        if (type instanceof Class<?>) {
            return getDeserializer((Class<?>) type, type);
        }

        if (type instanceof ParameterizedType) {
            Type rawType = ((ParameterizedType) type).getRawType();
            if (rawType instanceof Class<?>) {
                return getDeserializer((Class<?>) rawType, type);
            } else {
                return getDeserializer(rawType);
            }
        }

        return this.defaultSerializer;
    }

    public ObjectDeserializer getDeserializer(Class<?> clazz, Type type) {
        ObjectDeserializer derializer = derializers.get(type);
        if (derializer != null) {
            return derializer;
        }

        if (type == null) {
            type = clazz;
        }

        derializer = derializers.get(type);
        if (derializer != null) {
            return derializer;
        }

        if (type instanceof WildcardType || type instanceof TypeVariable || type instanceof ParameterizedType) {
            derializer = derializers.get(clazz);
        }

        if (derializer != null) {
            return derializer;
        }

        final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        try {
            for (AutowiredObjectDeserializer autowired : ServiceLoader.load(AutowiredObjectDeserializer.class,
                    classLoader)) {
                for (Type forType : autowired.getAutowiredFor()) {
                    derializers.put(forType, autowired);
                }
            }
        } catch (Exception ex) {
            // skip
        }

        derializer = derializers.get(type);
        if (derializer != null) {
            return derializer;
        }

        if (clazz.isEnum()) {
            derializer = new EnumDeserializer(clazz);
        } else if (clazz.isArray()) {
            return ArrayDeserializer.instance;
        } else if (clazz == Set.class || clazz == HashSet.class || clazz == Collection.class || clazz == List.class
                || clazz == ArrayList.class) {
            if (type instanceof ParameterizedType) {
                Type itemType = ((ParameterizedType) type).getActualTypeArguments()[0];
                if (itemType == String.class) {
                    derializer = ArrayListStringDeserializer.instance;
                } else {
                    derializer = new ArrayListTypeDeserializer(clazz, itemType);
                }
            } else {
                derializer = CollectionDeserializer.instance;
            }
        } else if (Collection.class.isAssignableFrom(clazz)) {
            derializer = CollectionDeserializer.instance;
        } else if (Map.class.isAssignableFrom(clazz)) {
            derializer = MapDeserializer.instance;
        } else if (Throwable.class.isAssignableFrom(clazz)) {
            derializer = new ThrowableDeserializer(this, clazz);
        } else {
            derializer = createJavaBeanDeserializer(clazz, type);
        }

        putDeserializer(type, derializer);

        return derializer;
    }

    public ObjectDeserializer createJavaBeanDeserializer(Class<?> clazz, Type type) {
        if (clazz == Class.class) {
            return this.defaultSerializer;
        }

        boolean asmEnable = this.asmEnable;
        if (asmEnable && !Modifier.isPublic(clazz.getModifiers())) {
            asmEnable = false;
        }

        if (clazz.getTypeParameters().length != 0) {
            asmEnable = false;
        }

        if (ASMDeserializerFactory.getInstance().isExternalClass(clazz)) {
            asmEnable = false;
        }

        if (asmEnable) {
            DeserializeBeanInfo beanInfo = DeserializeBeanInfo.computeSetters(clazz, type);
            if (beanInfo.getFieldList().size() > 200) {
                asmEnable = false;
            }

            for (FieldInfo fieldInfo : beanInfo.getFieldList()) {
                if (fieldInfo.isGetOnly()) {
                    asmEnable = false;
                    break;
                }

                Class<?> fieldClass = fieldInfo.getFieldClass();
                if (!Modifier.isPublic(fieldClass.getModifiers())) {
                    asmEnable = false;
                    break;
                }

                if (fieldClass.isMemberClass() && !Modifier.isStatic(fieldClass.getModifiers())) {
                    asmEnable = false;
                }
            }
        }

        if (asmEnable) {
            if (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) {
                asmEnable = false;
            }
        }

        if (!asmEnable) {
            return new JavaBeanDeserializer(this, clazz, type);
        }

        try {
            return ASMDeserializerFactory.getInstance().createJavaBeanDeserializer(this, clazz, type);
//        } catch (VerifyError e) {
//            e.printStackTrace();
//            return new JavaBeanDeserializer(this, clazz, type);
        } catch (NoSuchMethodException e) {
            return new JavaBeanDeserializer(this, clazz, type);
        } catch (ASMException e) {
            return new JavaBeanDeserializer(this, clazz, type);
        } catch (Exception e) {
            throw new JSONException("create asm deserializer error, " + clazz.getName(), e);
        }
    }

    public FieldDeserializer createFieldDeserializer(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
        boolean asmEnable = this.asmEnable;

        if (!Modifier.isPublic(clazz.getModifiers())) {
            asmEnable = false;
        }

        if (fieldInfo.getFieldClass() == Class.class) {
            asmEnable = false;
        }

        if (ASMDeserializerFactory.getInstance().isExternalClass(clazz)) {
            asmEnable = false;
        }

        if (!asmEnable) {
            return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
        }

        try {
            return ASMDeserializerFactory.getInstance().createFieldDeserializer(mapping, clazz, fieldInfo);
        } catch (Throwable e) {
            // skip
        }

        return createFieldDeserializerWithoutASM(mapping, clazz, fieldInfo);
    }

    public FieldDeserializer createFieldDeserializerWithoutASM(ParserConfig mapping, Class<?> clazz, FieldInfo fieldInfo) {
        Class<?> fieldClass = fieldInfo.getFieldClass();

        if (fieldClass == boolean.class || fieldClass == Boolean.class) {
            return new BooleanFieldDeserializer(mapping, clazz, fieldInfo);
        }

        if (fieldClass == int.class || fieldClass == Integer.class) {
            return new IntegerFieldDeserializer(mapping, clazz, fieldInfo);
        }

        if (fieldClass == long.class || fieldClass == Long.class) {
            return new LongFieldDeserializer(mapping, clazz, fieldInfo);
        }

        if (fieldClass == String.class) {
            return new StringFieldDeserializer(mapping, clazz, fieldInfo);
        }

        if (fieldClass == List.class || fieldClass == ArrayList.class) {
            Type fieldType = fieldInfo.getFieldType();
            if (fieldType instanceof ParameterizedType) {
                Type itemType = ((ParameterizedType) fieldType).getActualTypeArguments()[0];
                if (itemType == String.class) {
                    return new ArrayListStringFieldDeserializer(mapping, clazz, fieldInfo);
                }
            }

            return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
        }

        return new DefaultFieldDeserializer(mapping, clazz, fieldInfo);
    }

    public void putDeserializer(Type type, ObjectDeserializer deserializer) {
        derializers.put(type, deserializer);
    }

    public ObjectDeserializer getDeserializer(FieldInfo fieldInfo) {
        return getDeserializer(fieldInfo.getFieldClass(), fieldInfo.getFieldType());
    }

    public boolean isPrimitive(Class<?> clazz) {
        return primitiveClasses.contains(clazz);
    }

    public static Field getField(Class<?> clazz, String fieldName) {
        for (Field item : clazz.getDeclaredFields()) {
            if (fieldName.equals(item.getName())) {
                return item;
            }
        }
        if (clazz.getSuperclass() != null && clazz.getSuperclass() != Object.class) {
            return getField(clazz.getSuperclass(), fieldName);
        }

        return null;
    }

    public Map<String, FieldDeserializer> getFieldDeserializers(Class<?> clazz) {
        ObjectDeserializer deserizer = getDeserializer(clazz);

        if (deserizer instanceof JavaBeanDeserializer) {
            return ((JavaBeanDeserializer) deserizer).getFieldDeserializerMap();
        } else if (deserizer instanceof ASMJavaBeanDeserializer) {
            return ((ASMJavaBeanDeserializer) deserizer).getInnterSerializer().getFieldDeserializerMap();
        } else {
            return Collections.emptyMap();
        }
    }
}


text:
IF (NOT WIN32)
  FIND_PACKAGE(PkgConfig)
  PKG_CHECK_MODULES(PKG_DIRECTFB QUIET directfb)

  SET(DIRECTFB_DEFINITIONS ${PKG_DIRECTFB_CFLAGS})

  FIND_PATH(DIRECTFB_INCLUDE_DIR  NAMES directfb.h HINTS ${PKG_DIRECTFB_INCLUDE_DIRS})

  FIND_LIBRARY(DIRECTFB_LIBRARIES NAMES directfb   HINTS ${PKG_DIRECTFB_LIBRARY_DIRS})

  include(FindPackageHandleStandardArgs)

  FIND_PACKAGE_HANDLE_STANDARD_ARGS(DIRECTFB DEFAULT_MSG DIRECTFB_LIBRARIES DIRECTFB_INCLUDE_DIR)

  MARK_AS_ADVANCED(DIRECTFB_INCLUDE_DIR DIRECTFB_LIBRARIES)
ENDIF ()


text:
// ========================================================================
// Copyright (c) 2009 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.annotations;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.jar.JarEntry;

import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.JarScanner;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.commons.EmptyVisitor;

/**
 * AnnotationParser
 *
 * Use asm to scan classes for annotations. A SAX-style parsing is done, with
 * a handler being able to be registered to handle each annotation type.
 */
public class AnnotationParser
{
    private static final Logger LOG = Log.getLogger(AnnotationParser.class);

    protected List<String> _parsedClassNames = new ArrayList<String>();
    protected Map<String, List<DiscoverableAnnotationHandler>> _annotationHandlers = new HashMap<String, List<DiscoverableAnnotationHandler>>();
    protected List<ClassHandler> _classHandlers = new ArrayList<ClassHandler>();
    protected List<MethodHandler> _methodHandlers = new ArrayList<MethodHandler>();
    protected List<FieldHandler> _fieldHandlers = new ArrayList<FieldHandler>();

    public static String normalize (String name)
    {
        if (name==null)
            return null;

        if (name.startsWith("L") && name.endsWith(";"))
            name = name.substring(1, name.length()-1);

        if (name.endsWith(".class"))
            name = name.substring(0, name.length()-".class".length());

        return name.replace('/', '.');
    }

    public abstract class Value
    {
        String _name;

        public Value (String name)
        {
            _name = name;
        }

        public String getName()
        {
            return _name;
        }

        public abstract Object getValue();

    }

    public class SimpleValue extends Value
    {
        Object _val;

        public SimpleValue(String name)
        {
            super(name);
        }

        public void setValue(Object val)
        {
            _val=val;
        }
        public Object getValue()
        {
            return _val;
        }

        public String toString()
        {
            return "("+getName()+":"+_val+")";
        }
    }

    public class ListValue extends Value
    {
        List<Value> _val;

        public ListValue (String name)
        {
            super(name);
            _val = new ArrayList<Value>();
        }

        public Object getValue()
        {
            return _val;
        }

        public List<Value> getList()
        {
            return _val;
        }

        public void addValue (Value v)
        {
            _val.add(v);
        }

        public int size ()
        {
            return _val.size();
        }

        public String toString()
        {
            StringBuffer buff = new StringBuffer();
            buff.append("(");
            buff.append(getName());
            buff.append(":");
            for (Value n: _val)
            {
                buff.append(" "+n.toString());
            }
            buff.append(")");

            return buff.toString();
        }
    }

    public interface DiscoverableAnnotationHandler
    {
        public void handleClass (String className, int version, int access,
                                 String signature, String superName, String[] interfaces,
                                 String annotation, List<Value>values);

        public void handleMethod (String className, String methodName, int access,
                                  String desc, String signature,String[] exceptions,
                                  String annotation, List<Value>values);

        public void handleField (String className, String fieldName,  int access,
                                 String fieldType, String signature, Object value,
                                 String annotation, List<Value>values);
    }

    public interface ClassHandler
    {
        public void handle (String className, int version, int access, String signature, String superName, String[] interfaces);
    }

    public interface MethodHandler
    {
        public void handle (String className, String methodName, int access,  String desc, String signature,String[] exceptions);
    }

    public interface FieldHandler
    {
        public void handle (String className, String fieldName, int access, String fieldType, String signature, Object value);
    }

    public class MyAnnotationVisitor implements AnnotationVisitor
    {
        List<Value> _annotationValues;
        String _annotationName;

        public MyAnnotationVisitor (String annotationName, List<Value> values)
        {
            _annotationValues = values;
            _annotationName = annotationName;
        }

        public List<Value> getAnnotationValues()
        {
            return _annotationValues;
        }

        /**
         * Visit a single-valued (name,value) pair for this annotation
         * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
         */
        public void visit(String aname, Object avalue)
        {
           SimpleValue v = new SimpleValue(aname);
           v.setValue(avalue);
           _annotationValues.add(v);
        }

        /**
         * Visit a (name,value) pair whose value is another Annotation
         * @see org.objectweb.asm.AnnotationVisitor#visitAnnotation(java.lang.String, java.lang.String)
         */
        public AnnotationVisitor visitAnnotation(String name, String desc)
        {
            String s = normalize(desc);
            ListValue v = new ListValue(s);
            _annotationValues.add(v);
            MyAnnotationVisitor visitor = new MyAnnotationVisitor(s, v.getList());
            return visitor;
        }

        /**
         * Visit an array valued (name, value) pair for this annotation
         * @see org.objectweb.asm.AnnotationVisitor#visitArray(java.lang.String)
         */
        public AnnotationVisitor visitArray(String name)
        {
            ListValue v = new ListValue(name);
            _annotationValues.add(v);
            MyAnnotationVisitor visitor = new MyAnnotationVisitor(null, v.getList());
            return visitor;
        }

        /**
         * Visit a enum-valued (name,value) pair for this annotation
         * @see org.objectweb.asm.AnnotationVisitor#visitEnum(java.lang.String, java.lang.String, java.lang.String)
         */
        public void visitEnum(String name, String desc, String value)
        {
            //TODO
        }

        public void visitEnd()
        {
        }
    }

    /**
     * MyClassVisitor
     *
     * ASM visitor for a class.
     */
    public class MyClassVisitor extends EmptyVisitor
    {
        String _className;
        int _access;
        String _signature;
        String _superName;
        String[] _interfaces;
        int _version;

        public void visit (int version,
                           final int access,
                           final String name,
                           final String signature,
                           final String superName,
                           final String[] interfaces)
        {
            _className = normalize(name);
            _access = access;
            _signature = signature;
            _superName = superName;
            _interfaces = interfaces;
            _version = version;

            _parsedClassNames.add(_className);
            //call all registered ClassHandlers
            String[] normalizedInterfaces = null;
            if (interfaces!= null)
            {
                normalizedInterfaces = new String[interfaces.length];
                int i=0;
                for (String s : interfaces)
                    normalizedInterfaces[i++] = normalize(s);
            }

            for (ClassHandler h : AnnotationParser.this._classHandlers)
            {
                h.handle(_className, _version, _access, _signature, normalize(_superName), normalizedInterfaces);
            }
        }

        public AnnotationVisitor visitAnnotation (String desc, boolean visible)
        {
            MyAnnotationVisitor visitor = new MyAnnotationVisitor(normalize(desc), new ArrayList<Value>())
            {
                public void visitEnd()
                {
                    super.visitEnd();

                    //call all AnnotationHandlers with classname, annotation name + values
                    List<DiscoverableAnnotationHandler> handlers = AnnotationParser.this._annotationHandlers.get(_annotationName);
                    if (handlers != null)
                    {
                        for (DiscoverableAnnotationHandler h:handlers)
                        {
                            h.handleClass(_className, _version, _access, _signature, _superName, _interfaces, _annotationName, _annotationValues);
                        }
                    }
                }
            };

            return visitor;
        }

        public MethodVisitor visitMethod (final int access,
                                          final String name,
                                          final String methodDesc,
                                          final String signature,
                                          final String[] exceptions)
        {

            return new EmptyVisitor ()
            {
                public AnnotationVisitor visitAnnotation(String desc, boolean visible)
                {
                    MyAnnotationVisitor visitor = new MyAnnotationVisitor (normalize(desc), new ArrayList<Value>())
                    {
                        public void visitEnd()
                        {
                            super.visitEnd();
                            //call all AnnotationHandlers with classname, method, annotation name + values
                            List<DiscoverableAnnotationHandler> handlers = AnnotationParser.this._annotationHandlers.get(_annotationName);
                            if (handlers != null)
                            {
                                for (DiscoverableAnnotationHandler h:handlers)
                                {
                                    h.handleMethod(_className, name, access, methodDesc, signature, exceptions, _annotationName, _annotationValues);
                                }
                            }
                        }
                    };

                    return visitor;
                }
            };
        }

        public FieldVisitor visitField (final int access,
                                        final String fieldName,
                                        final String fieldType,
                                        final String signature,
                                        final Object value)
        {

            return new EmptyVisitor ()
            {
                public AnnotationVisitor visitAnnotation(String desc, boolean visible)
                {
                    MyAnnotationVisitor visitor = new MyAnnotationVisitor(normalize(desc), new ArrayList<Value>())
                    {
                        public void visitEnd()
                        {
                            super.visitEnd();
                            List<DiscoverableAnnotationHandler> handlers = AnnotationParser.this._annotationHandlers.get(_annotationName);
                            if (handlers != null)
                            {
                                for (DiscoverableAnnotationHandler h:handlers)
                                {
                                    h.handleField(_className, fieldName, access, fieldType, signature, value, _annotationName, _annotationValues);
                                }
                            }
                        }
                    };
                    return visitor;
                }
            };
        }
    }

    /**
     * Register a handler that will be called back when the named annotation is
     * encountered on a class.
     *
     * @param annotationName
     * @param handler
     */
    public void registerAnnotationHandler (String annotationName, DiscoverableAnnotationHandler handler)
    {
        List<DiscoverableAnnotationHandler> handlers = _annotationHandlers.get(annotationName);
        if (handlers == null)
        {
            handlers = new ArrayList<DiscoverableAnnotationHandler>();
            _annotationHandlers.put(annotationName, handlers);
        }
        handlers.add(handler);
    }

    public List<DiscoverableAnnotationHandler> getAnnotationHandlers(String annotationName)
    {
        List<DiscoverableAnnotationHandler> handlers = _annotationHandlers.get(annotationName);
        if (handlers == null)
            return Collections.emptyList();
        return new ArrayList<DiscoverableAnnotationHandler>();
    }

    public List<DiscoverableAnnotationHandler> getAnnotationHandlers()
    {
        List<DiscoverableAnnotationHandler> allHandlers = new ArrayList<DiscoverableAnnotationHandler>();
        for (List<DiscoverableAnnotationHandler> list:_annotationHandlers.values())
            allHandlers.addAll(list);
        return allHandlers;
    }

    public void registerClassHandler (ClassHandler handler)
    {
        _classHandlers.add(handler);
    }

    public boolean isParsed (String className)
    {
        return _parsedClassNames.contains(className);
    }

    public void parse (String className, ClassNameResolver resolver)
    throws Exception
    {
        if (className == null)
            return;

        if (!resolver.isExcluded(className))
        {
            if (!isParsed(className) || resolver.shouldOverride(className))
            {
                className = className.replace('.', '/')+".class";
                URL resource = Loader.getResource(this.getClass(), className, false);
                if (resource!= null)
                    scanClass(resource.openStream());
            }
        }
    }

    public void parse (Class clazz, ClassNameResolver resolver, boolean visitSuperClasses)
    throws Exception
    {
        Class cz = clazz;
        while (cz != null)
        {
            if (!resolver.isExcluded(cz.getName()))
            {
                if (!isParsed(cz.getName()) || resolver.shouldOverride(cz.getName()))
                {
                    String nameAsResource = cz.getName().replace('.', '/')+".class";
                    URL resource = Loader.getResource(this.getClass(), nameAsResource, false);
                    if (resource!= null)
                        scanClass(resource.openStream());
                }
            }
            if (visitSuperClasses)
                cz = cz.getSuperclass();
            else
                cz = null;
        }
    }

    public void parse (String[] classNames, ClassNameResolver resolver)
    throws Exception
    {
        if (classNames == null)
            return;

        parse(Arrays.asList(classNames), resolver);
    }

    public void parse (List<String> classNames, ClassNameResolver resolver)
    throws Exception
    {
        for (String s:classNames)
        {
            if ((resolver == null) || (!resolver.isExcluded(s) &&  (!isParsed(s) || resolver.shouldOverride(s))))
            {
                s = s.replace('.', '/')+".class";
                URL resource = Loader.getResource(this.getClass(), s, false);
                if (resource!= null)
                    scanClass(resource.openStream());
            }
        }
    }

    public void parse (Resource dir, ClassNameResolver resolver)
    throws Exception
    {
        if (!dir.isDirectory() || !dir.exists())
            return;

        String[] files=dir.list();
        for (int f=0;files!=null && f<files.length;f++)
        {
            try
            {
                Resource res = dir.addPath(files[f]);
                if (res.isDirectory())
                    parse(res, resolver);
                String name = res.getName();
                if (name.endsWith(".class"))
                {
                    if ((resolver == null)|| (!resolver.isExcluded(name) && (!isParsed(name) || resolver.shouldOverride(name))))
                        scanClass(res.getURL().openStream());

                }
            }
            catch (Exception ex)
            {
                LOG.warn(Log.EXCEPTION,ex);
            }
        }
    }

    /**
     * Find annotations on classes in the supplied classloader.
     * Only class files in jar files will be scanned.
     * @param loader
     * @param visitParents
     * @param nullInclusive
     * @param resolver
     * @throws Exception
     */
    public void parse (ClassLoader loader, boolean visitParents, boolean nullInclusive, final ClassNameResolver resolver)
    throws Exception
    {
        if (loader==null)
            return;

        if (!(loader instanceof URLClassLoader))
            return; //can't extract classes?

        JarScanner scanner = new JarScanner()
        {
            public void processEntry(URI jarUri, JarEntry entry)
            {
                try
                {
                    String name = entry.getName();
                    if (name.toLowerCase().endsWith(".class"))
                    {
                        String shortName =  name.replace('/', '.').substring(0,name.length()-6);
                        if ((resolver == null)
                             ||
                            (!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
                        {

                            Resource clazz = Resource.newResource("jar:"+jarUri+"!/"+name);
                            scanClass(clazz.getInputStream());
                        }
                    }
                }
                catch (Exception e)
                {
                    LOG.warn("Problem processing jar entry "+entry, e);
                }
            }

        };

        scanner.scan(null, loader, nullInclusive, visitParents);
    }

    /**
     * Find annotations in classes in the supplied url of jar files.
     * @param uris
     * @param resolver
     * @throws Exception
     */
    public void parse (URI[] uris, final ClassNameResolver resolver)
    throws Exception
    {
        if (uris==null)
            return;

        JarScanner scanner = new JarScanner()
        {
            public void processEntry(URI jarUri, JarEntry entry)
            {
                try
                {
                    String name = entry.getName();
                    if (name.toLowerCase().endsWith(".class"))
                    {
                        String shortName =  name.replace('/', '.').substring(0,name.length()-6);

                        if ((resolver == null)
                             ||
                            (!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
                        {
                            Resource clazz = Resource.newResource("jar:"+jarUri+"!/"+name);
                            scanClass(clazz.getInputStream());

                        }
                    }
                }
                catch (Exception e)
                {
                    LOG.warn("Problem processing jar entry "+entry, e);
                }
            }

        };
        scanner.scan(null, uris, true);
    }

    public void parse (URI uri, final ClassNameResolver resolver)
    throws Exception
    {
        if (uri == null)
            return;
        URI[] uris = {uri};
        parse(uris, resolver);
    }

    protected void scanClass (InputStream is)
    throws IOException
    {
        ClassReader reader = new ClassReader(is);
        reader.accept(new MyClassVisitor(), ClassReader.SKIP_CODE|ClassReader.SKIP_DEBUG|ClassReader.SKIP_FRAMES);
    }
}


text:
<?php
namespace tests\acceptance\news;

use \WebGuy;
use tests\acceptance\pages\NewsPage;
use tests\acceptance\user\steps\UserSteps;

class NewsListCest
{
    public function tryToTestNewsListPage(WebGuy $I, $scenario)
    {
        $I->am('simple user');
        $I->amGoingTo('test news list page...');
        $I->amOnPage(NewsPage::URL);
        $I->see('Новости', 'h1');
        $I->seeLink('Первая опубликованная новость');
        $I->dontSeeLink('Третья новость только для авторизованных');
        $I->dontSeeLink('Вторая не опубликованная новость');

        $I->am('authorized user');
        $I = new UserSteps($scenario);
        $I->login('yupe@yupe.local', 'testpassword');
        $I->amGoingTo('test news list for authorized user...');
        $I->amOnPage(NewsPage::URL);
        $I->expectTo('see news list with protected news...');
        $I->seeLink('Первая опубликованная новость');
        $I->seeLink('Третья новость только для авторизованных');
        $I->dontSeeLink('Вторая не опубликованная новость');
    }
}


text:
package com.jj.game.boost.statusbar;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;

import com.jj.game.boost.R;
import com.jj.game.boost.utils.DimenUtils;

class StatusBarKitkatImpl implements IStatusBar {

    public void setStatusBarColor(Window window, int color, boolean lightStatusBar) {
        int flags = 0;
        flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
        window.addFlags(flags);

        ViewGroup decorViewGroup = (ViewGroup) window.getDecorView();
        View statusBarView = new View(window.getContext());
        int statusBarHeight = getStatusBarHeight(window.getContext());
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, statusBarHeight);
        params.gravity = Gravity.TOP;
        statusBarView.setLayoutParams(params);
        statusBarView.setBackgroundColor(color);
        decorViewGroup.addView(statusBarView);
        StatusBarCompat.setFitsSystemWindows(window, true);

        StatusBarCompatFlavorRom.setLightStatusBar(window, lightStatusBar);

        setForNavigationBar((Activity) window.getContext());
    }

    /**
     * 适配虚拟按键
     *
     * @param context
     * @return
     */
    @SuppressWarnings("JavaDoc")
    private static int getStatusBarHeight(Context context) {
        int statusBarHeight = 0;
        Resources res = context.getResources();
        int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            statusBarHeight = res.getDimensionPixelSize(resourceId);
        }
        return statusBarHeight;
    }

    private static void setForNavigationBar(Activity activity) {
        int navHeight = DimenUtils.getNavigationHeight(activity);
        Log.i("MyLog", "navHeight -> " + navHeight);
        if (navHeight > 0) {
            FrameLayout content = ((FrameLayout) activity.findViewById(android.R.id.content));
//            int childCount = content.getChildCount();
//            FrameLayout.LayoutParams layoutParams;
//            for (int i = 0; i < childCount; i++) {
//                View childView = content.getChildAt(i);
//
////                childView.setPadding(0, 0, 0, navHeight);
//                layoutParams = (FrameLayout.LayoutParams) childView.getLayoutParams();
//                layoutParams.bottomMargin = navHeight;
//            }

            FrameLayout.LayoutParams navBarLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    navHeight, Gravity.BOTTOM);
            View navBar = new View(activity);
            navBar.setBackgroundColor(activity.getResources().getColor(R.color.navigation_bar_color));
            content.addView(navBar, navBarLayoutParams);
        }
    }

}


text:
package hu.akarnokd.reactive.lowalloc;

import java.util.function.Function;

import io.reactivex.Observer;

public abstract class LcObservable<T> {

    public abstract void subscribe(Observer<? super T> observer);

    public static <T> LcObservable<T> just(T value) {
        return new LcObservableJust<T>(value);
    }

    public static LcObservable<Integer> range(int start, int count) {
        if (count == 1) {
            return just(start);
        }
        return new LcObservableRange(start, start + count);
    }

    public final <R> LcObservable<R> map(Function<T, R> mapper) {
        return new LcObservableMap<T, R>(this, mapper);
    }
}


text:
package org.jbpm.console.ng.cm.client.detailsmulti;

import static com.github.gwtbootstrap.client.ui.resources.ButtonSize.MINI;

import javax.enterprise.context.Dependent;

import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.RequiresResize;
import com.google.gwt.user.client.ui.Widget;

import org.jbpm.console.ng.gc.client.experimental.details.AbstractTabbedDetailsView;
import org.jbpm.console.ng.cm.client.details.CaseDetailsPresenter;
import org.jbpm.console.ng.ht.client.i18n.Constants;
import com.google.gwt.user.client.ui.ScrollPanel;

@Dependent
public class CaseDetailsMultiViewImpl extends AbstractTabbedDetailsView<CaseDetailsMultiPresenter>
        implements CaseDetailsMultiPresenter.CaseDetailsMultiView, RequiresResize {

    interface Binder
            extends
            UiBinder<Widget, CaseDetailsMultiViewImpl> {

    }

    private CaseDetailsPresenter caseDetailsPresenter;

    private ScrollPanel caseDetailsScrollPanel = new ScrollPanel();

    @Override
    public void init( final CaseDetailsMultiPresenter presenter ) {
        super.init( presenter );
    }

    @Override
    public void initTabs() {

        tabPanel.addTab( "Case Details", Constants.INSTANCE.Details() );

        caseDetailsScrollPanel.add(caseDetailsPresenter.getView());

        ( (HTMLPanel) tabPanel.getWidget( 0 ) ).add( caseDetailsScrollPanel );

        tabPanel.addSelectionHandler( new SelectionHandler<Integer>() {

            @Override
            public void onSelection( SelectionEvent<Integer> event ) {
                caseDetailsPresenter.refreshCase();
//                if ( event.getSelectedItem() == 0 ) {
//
//                }

            }
        } );
    }

    @Override
    public Button getCloseButton() {
        return new Button() {
            {
                setIcon( IconType.REMOVE );
                setTitle( Constants.INSTANCE.Close() );
                setSize( MINI );
                addClickHandler( new ClickHandler() {
                    @Override
                    public void onClick( ClickEvent event ) {
                        presenter.closeDetails();
                    }
                } );
            }
        };
    }

    @Override
    public void setupPresenters( final CaseDetailsPresenter taskDetailsPresenter) {
        this.caseDetailsPresenter = taskDetailsPresenter;
    }

    @Override
    public IsWidget getRefreshButton() {
        return new Button() {
            {
                setIcon( IconType.REFRESH );
                setTitle( Constants.INSTANCE.Refresh() );
                setSize( MINI );
                addClickHandler( new ClickHandler() {
                    @Override
                    public void onClick( ClickEvent event ) {
                        presenter.refresh();
                    }
                } );
            }
        };
    }

    @Override
    public void onResize() {
        super.onResize();
        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
               tabPanel.setHeight(CaseDetailsMultiViewImpl.this.getParent().getOffsetHeight()-30+"px");

               caseDetailsScrollPanel.setHeight(CaseDetailsMultiViewImpl.this.getParent().getOffsetHeight()-30+"px");

            }
        });
    }

}


text:
package com.amazonaws.services.cloudformation.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.cloudformation.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;

/**
 * UpdateStackInstancesRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateStackInstancesRequestMarshaller implements Marshaller<Request<UpdateStackInstancesRequest>, UpdateStackInstancesRequest> {

    public Request<UpdateStackInstancesRequest> marshall(UpdateStackInstancesRequest updateStackInstancesRequest) {

        if (updateStackInstancesRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<UpdateStackInstancesRequest> request = new DefaultRequest<UpdateStackInstancesRequest>(updateStackInstancesRequest, "AmazonCloudFormation");
        request.addParameter("Action", "UpdateStackInstances");
        request.addParameter("Version", "2010-05-15");
        request.setHttpMethod(HttpMethodName.POST);

        if (updateStackInstancesRequest.getStackSetName() != null) {
            request.addParameter("StackSetName", StringUtils.fromString(updateStackInstancesRequest.getStackSetName()));
        }

        if (updateStackInstancesRequest.getAccounts().isEmpty()
                && !((com.amazonaws.internal.SdkInternalList<String>) updateStackInstancesRequest.getAccounts()).isAutoConstruct()) {
            request.addParameter("Accounts", "");
        }
        if (!updateStackInstancesRequest.getAccounts().isEmpty()
                || !((com.amazonaws.internal.SdkInternalList<String>) updateStackInstancesRequest.getAccounts()).isAutoConstruct()) {
            com.amazonaws.internal.SdkInternalList<String> accountsList = (com.amazonaws.internal.SdkInternalList<String>) updateStackInstancesRequest
                    .getAccounts();
            int accountsListIndex = 1;

            for (String accountsListValue : accountsList) {
                if (accountsListValue != null) {
                    request.addParameter("Accounts.member." + accountsListIndex, StringUtils.fromString(accountsListValue));
                }
                accountsListIndex++;
            }
        }

        if (updateStackInstancesRequest.getRegions().isEmpty()
                && !((com.amazonaws.internal.SdkInternalList<String>) updateStackInstancesRequest.getRegions()).isAutoConstruct()) {
            request.addParameter("Regions", "");
        }
        if (!updateStackInstancesRequest.getRegions().isEmpty()
                || !((com.amazonaws.internal.SdkInternalList<String>) updateStackInstancesRequest.getRegions()).isAutoConstruct()) {
            com.amazonaws.internal.SdkInternalList<String> regionsList = (com.amazonaws.internal.SdkInternalList<String>) updateStackInstancesRequest
                    .getRegions();
            int regionsListIndex = 1;

            for (String regionsListValue : regionsList) {
                if (regionsListValue != null) {
                    request.addParameter("Regions.member." + regionsListIndex, StringUtils.fromString(regionsListValue));
                }
                regionsListIndex++;
            }
        }

        if (updateStackInstancesRequest.getParameterOverrides().isEmpty()
                && !((com.amazonaws.internal.SdkInternalList<Parameter>) updateStackInstancesRequest.getParameterOverrides()).isAutoConstruct()) {
            request.addParameter("ParameterOverrides", "");
        }
        if (!updateStackInstancesRequest.getParameterOverrides().isEmpty()
                || !((com.amazonaws.internal.SdkInternalList<Parameter>) updateStackInstancesRequest.getParameterOverrides()).isAutoConstruct()) {
            com.amazonaws.internal.SdkInternalList<Parameter> parameterOverridesList = (com.amazonaws.internal.SdkInternalList<Parameter>) updateStackInstancesRequest
                    .getParameterOverrides();
            int parameterOverridesListIndex = 1;

            for (Parameter parameterOverridesListValue : parameterOverridesList) {

                if (parameterOverridesListValue.getParameterKey() != null) {
                    request.addParameter("ParameterOverrides.member." + parameterOverridesListIndex + ".ParameterKey",
                            StringUtils.fromString(parameterOverridesListValue.getParameterKey()));
                }

                if (parameterOverridesListValue.getParameterValue() != null) {
                    request.addParameter("ParameterOverrides.member." + parameterOverridesListIndex + ".ParameterValue",
                            StringUtils.fromString(parameterOverridesListValue.getParameterValue()));
                }

                if (parameterOverridesListValue.getUsePreviousValue() != null) {
                    request.addParameter("ParameterOverrides.member." + parameterOverridesListIndex + ".UsePreviousValue",
                            StringUtils.fromBoolean(parameterOverridesListValue.getUsePreviousValue()));
                }

                if (parameterOverridesListValue.getResolvedValue() != null) {
                    request.addParameter("ParameterOverrides.member." + parameterOverridesListIndex + ".ResolvedValue",
                            StringUtils.fromString(parameterOverridesListValue.getResolvedValue()));
                }
                parameterOverridesListIndex++;
            }
        }

        {
            StackSetOperationPreferences operationPreferences = updateStackInstancesRequest.getOperationPreferences();
            if (operationPreferences != null) {

                if (operationPreferences.getRegionOrder().isEmpty()
                        && !((com.amazonaws.internal.SdkInternalList<String>) operationPreferences.getRegionOrder()).isAutoConstruct()) {
                    request.addParameter("OperationPreferences.RegionOrder", "");
                }
                if (!operationPreferences.getRegionOrder().isEmpty()
                        || !((com.amazonaws.internal.SdkInternalList<String>) operationPreferences.getRegionOrder()).isAutoConstruct()) {
                    com.amazonaws.internal.SdkInternalList<String> regionOrderList = (com.amazonaws.internal.SdkInternalList<String>) operationPreferences
                            .getRegionOrder();
                    int regionOrderListIndex = 1;

                    for (String regionOrderListValue : regionOrderList) {
                        if (regionOrderListValue != null) {
                            request.addParameter("OperationPreferences.RegionOrder.member." + regionOrderListIndex,
                                    StringUtils.fromString(regionOrderListValue));
                        }
                        regionOrderListIndex++;
                    }
                }

                if (operationPreferences.getFailureToleranceCount() != null) {
                    request.addParameter("OperationPreferences.FailureToleranceCount", StringUtils.fromInteger(operationPreferences.getFailureToleranceCount()));
                }

                if (operationPreferences.getFailureTolerancePercentage() != null) {
                    request.addParameter("OperationPreferences.FailureTolerancePercentage",
                            StringUtils.fromInteger(operationPreferences.getFailureTolerancePercentage()));
                }

                if (operationPreferences.getMaxConcurrentCount() != null) {
                    request.addParameter("OperationPreferences.MaxConcurrentCount", StringUtils.fromInteger(operationPreferences.getMaxConcurrentCount()));
                }

                if (operationPreferences.getMaxConcurrentPercentage() != null) {
                    request.addParameter("OperationPreferences.MaxConcurrentPercentage",
                            StringUtils.fromInteger(operationPreferences.getMaxConcurrentPercentage()));
                }
            }
        }

        request.addParameter("OperationId", IdempotentUtils.resolveString(updateStackInstancesRequest.getOperationId()));

        return request;
    }

}


text:
require File.dirname(__FILE__) + '/test_helper'

class TestApp < Test::Unit::TestCase
  attr_reader :base_folder, :target_folder

  def setup
    @base_folder    = File.dirname(__FILE__) + "/fixtures/sample_app"
    @target_folder = File.dirname(__FILE__) + "/unpack"
    FileUtils.mkdir_p target_folder
  end

  def teardown
    FileUtils.rm_rf target_folder
  end

  def test_pack_current_folder
    PastiePacker::API.any_instance.expects(:paste).
      with($complete_pastie_and_header, 'ruby', false).
      returns("http://pastie.caboo.se/123456")
    FileUtils.cd base_folder do
      PastiePacker.run
    end
  end

  def test_pack_with_file_names
    PastiePacker::API.any_instance.expects(:paste).
      with($some_files_and_header, 'ruby', false).
      returns("http://pastie.caboo.se/123456")
    files = ["README.txt\n", "lib/myapp.rb\n"]
    PastiePacker.any_instance.expects(:input_lines).returns(files)
    FileUtils.cd base_folder do
      PastiePacker.run
    end
  end

  def test_pack_with_extra_comment
    pastie = PastiePacker.new
    pastie.extra_message = 'This is a bonus comment.'
    PastiePacker::API.any_instance.expects(:paste).
      with($complete_pastie_and_header_and_comment, nil, nil).
      returns("http://pastie.caboo.se/123456")
    FileUtils.cd base_folder do
      pastie.do_pack
    end
  end

  def test_pack_but_output_to_stdout
    pastie = PastiePacker.new
    pastie.expects(:to_stdout?).returns(true)
    PastiePacker::API.any_instance.expects(:paste).never
    output = mock()
    output.expects(:puts).with($complete_pastie_and_header)
    pastie.stubs(:output_stream).returns(output)
    FileUtils.cd base_folder do
      pastie.do_pack
    end
  end

  def test_pack_but_no_header
    pastie = PastiePacker.new
    pastie.expects(:no_header?).returns(true)
    PastiePacker::API.any_instance.expects(:paste).
      with($complete_pastie, nil, nil).
      returns("http://pastie.caboo.se/123456")
    FileUtils.cd base_folder do
      pastie.do_pack
    end
  end

  def test_unpack_within_current_folder
    PastiePacker.any_instance.expects(:fetch_pastie).
      with("http://pastie.caboo.se/123456").
      returns($complete_pastie_and_header)
    PastiePacker.any_instance.expects(:parse_options)
    PastiePacker.any_instance.expects(:args).returns(["http://pastie.caboo.se/123456"])
    FileUtils.cd target_folder do
      PastiePacker.run("http://pastie.caboo.se/123456")
    end
    assert(File.directory?("#{target_folder}/123456"), "/123456 folder not created")
    diff = `diff -ur #{base_folder} #{target_folder}/123456`
    assert_equal("", diff)
  end

  def test_unpack_within_current_folder_raw_txt
    PastiePacker.any_instance.expects(:fetch_pastie).
      with("http://pastie.caboo.se/123456").
      returns($complete_pastie_and_header)
    PastiePacker.any_instance.expects(:parse_options)
    PastiePacker.any_instance.expects(:args).returns(["http://pastie.caboo.se/123456.txt"])
    FileUtils.cd target_folder do
      PastiePacker.run("http://pastie.caboo.se/123456.txt")
    end
    assert(File.directory?("#{target_folder}/123456"), "/123456 folder not created")
    diff = `diff -ur #{base_folder} #{target_folder}/123456`
    assert_equal("", diff)
  end

  def test_unpack_private_pastie
    PastiePacker.any_instance.expects(:args).
      returns(["http://pastie.caboo.se/private/5hwfheniddqmyasmfcxaw"])
    private_pastie_html = open(File.dirname(__FILE__) + "/fixtures/private_pastie.html")
    PastiePacker.any_instance.expects(:fetch_pastie).
      with("http://pastie.caboo.se/private/5hwfheniddqmyasmfcxaw").
      returns(private_pastie_html)
    PastiePacker.any_instance.expects(:fetch_pastie).
      with("http://pastie.caboo.se/175214.txt?key=5hwfheniddqmyasmfcxaw").
      returns($complete_pastie_and_header)
    PastiePacker.any_instance.expects(:parse_options)
    FileUtils.cd target_folder do
      PastiePacker.run("http://pastie.caboo.se/private/5hwfheniddqmyasmfcxaw")
    end
    assert(File.directory?("#{target_folder}/5hwfheniddqmyasmfcxaw"), "/5hwfheniddqmyasmfcxaw folder not created")
    diff = `diff -ur #{base_folder} #{target_folder}/5hwfheniddqmyasmfcxaw`
    assert_equal("", diff)
  end
end


text:
package org.neo4j.driver.internal.messaging;

import java.io.IOException;

import static java.lang.String.format;

/**
 * ACK_FAILURE request message
 *

 * Sent by clients to acknowledge receipt of failures sent by the server. This is required to
 * allow optimistic sending of multiple messages before responses have been received - pipelining.
 *

 * When something goes wrong, we want the server to stop processing our already sent messages,
 * but the server cannot tell the difference between what was sent before and after we saw the
 * error.
 *

 * This message acts as a barrier after an error, informing the server that we've seen the error
 * message, and that messages that follow this one are safe to execute.
 */
public class AckFailureMessage implements Message
{
    public static final AckFailureMessage ACK_FAILURE = new AckFailureMessage();

    @Override
    public void dispatch( MessageHandler handler ) throws IOException
    {
        handler.handleAckFailureMessage();
    }

    @Override
    public String toString()
    {
        return format( "[ACK_FAILURE]" );
    }

    @Override
    public boolean equals( Object obj )
    {
        return obj != null && obj.getClass() == getClass();
    }

    @Override
    public int hashCode()
    {
        return 1;
    }
}