text:
#ifndef _NETINET6_ND6_H_
#define _NETINET6_ND6_H_

/* see net/route.h, or net/if_inarp.h */
#ifndef RTF_ANNOUNCE
#define RTF_ANNOUNCE	RTF_PROTO2
#endif

#include <sys/queue.h>
#include <sys/callout.h>

struct llentry;

#define ND6_LLINFO_NOSTATE	-2
/*
 * We don't need the WAITDELETE state any more, but we keep the definition
 * in a comment line instead of removing it. This is necessary to avoid
 * unintentionally reusing the value for another purpose, which might
 * affect backward compatibility with old applications.
 * (20000711 jinmei@kame.net)
 */
/* #define ND6_LLINFO_WAITDELETE	-1 */
#define ND6_LLINFO_INCOMPLETE	0
#define ND6_LLINFO_REACHABLE	1
#define ND6_LLINFO_STALE	2
#define ND6_LLINFO_DELAY	3
#define ND6_LLINFO_PROBE	4

#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
#define ND6_LLINFO_PERMANENT(n) (((n)->la_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))

struct nd_ifinfo {
	u_int32_t linkmtu;		/* LinkMTU */
	u_int32_t maxmtu;		/* Upper bound of LinkMTU */
	u_int32_t basereachable;	/* BaseReachableTime */
	u_int32_t reachable;		/* Reachable Time */
	u_int32_t retrans;		/* Retrans Timer */
	u_int32_t flags;		/* Flags */
	int recalctm;			/* BaseReacable re-calculation timer */
	u_int8_t chlim;			/* CurHopLimit */
	u_int8_t initialized; /* Flag to see the entry is initialized */
	/* the following 3 members are for privacy extension for addrconf */
	u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */
	u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */
	u_int8_t randomid[8];	/* current random ID */
};

#define ND6_IFF_PERFORMNUD	0x1
#define ND6_IFF_ACCEPT_RTADV	0x2
#define ND6_IFF_PREFER_SOURCE	0x4 /* XXX: not related to ND. */
#define ND6_IFF_IFDISABLED	0x8 /* IPv6 operation is disabled due to
				     * DAD failure.  (XXX: not ND-specific)
				     */
#define ND6_IFF_DONT_SET_IFROUTE	0x10
#define ND6_IFF_AUTO_LINKLOCAL	0x20
#define	ND6_IFF_NO_RADR		0x40
#define ND6_IFF_NO_PREFER_IFACE	0x80 /* XXX: not related to ND. */

#define	ND6_CREATE		LLE_CREATE
#define	ND6_EXCLUSIVE		LLE_EXCLUSIVE

#ifdef _KERNEL
#define ND_IFINFO(ifp) \
	(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)
#define IN6_LINKMTU(ifp) \
	((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
	    ? ND_IFINFO(ifp)->linkmtu \
	    : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \
		? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))
#endif

struct in6_nbrinfo {
	char ifname[IFNAMSIZ];	/* if name, e.g. "en0" */
	struct in6_addr addr;	/* IPv6 address of the neighbor */
	long	asked;		/* number of queries already sent for this addr */
	int	isrouter;	/* if it acts as a router */
	int	state;		/* reachability state */
	int	expire;		/* lifetime for NDP state transition */
};

#define DRLSTSIZ 10
#define PRLSTSIZ 10
struct	in6_drlist {
	char ifname[IFNAMSIZ];
	struct {
		struct	in6_addr rtaddr;
		u_char	flags;
		u_short	rtlifetime;
		u_long	expire;
		u_short if_index;
	} defrouter[DRLSTSIZ];
};

struct	in6_defrouter {
	struct	sockaddr_in6 rtaddr;
	u_char	flags;
	u_short	rtlifetime;
	u_long	expire;
	u_short if_index;
};

#ifdef _KERNEL
struct	in6_oprlist {
	char ifname[IFNAMSIZ];
	struct {
		struct	in6_addr prefix;
		struct prf_ra raflags;
		u_char	prefixlen;
		u_char	origin;
		u_long vltime;
		u_long pltime;
		u_long expire;
		u_short if_index;
		u_short advrtrs; /* number of advertisement routers */
		struct	in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
	} prefix[PRLSTSIZ];
};
#endif

struct	in6_prlist {
	char ifname[IFNAMSIZ];
	struct {
		struct	in6_addr prefix;
		struct prf_ra raflags;
		u_char	prefixlen;
		u_char	origin;
		u_int32_t vltime;
		u_int32_t pltime;
		time_t expire;
		u_short if_index;
		u_short advrtrs; /* number of advertisement routers */
		struct	in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
	} prefix[PRLSTSIZ];
};

struct in6_prefix {
	struct	sockaddr_in6 prefix;
	struct prf_ra raflags;
	u_char	prefixlen;
	u_char	origin;
	u_int32_t vltime;
	u_int32_t pltime;
	time_t expire;
	u_int32_t flags;
	int refcnt;
	u_short if_index;
	u_short advrtrs; /* number of advertisement routers */
	/* struct sockaddr_in6 advrtr[] */
};

#ifdef _KERNEL
struct	in6_ondireq {
	char ifname[IFNAMSIZ];
	struct {
		u_int32_t linkmtu;	/* LinkMTU */
		u_int32_t maxmtu;	/* Upper bound of LinkMTU */
		u_int32_t basereachable; /* BaseReachableTime */
		u_int32_t reachable;	/* Reachable Time */
		u_int32_t retrans;	/* Retrans Timer */
		u_int32_t flags;	/* Flags */
		int recalctm;		/* BaseReacable re-calculation timer */
		u_int8_t chlim;		/* CurHopLimit */
		u_int8_t receivedra;
	} ndi;
};
#endif

struct	in6_ndireq {
	char ifname[IFNAMSIZ];
	struct nd_ifinfo ndi;
};

struct	in6_ndifreq {
	char ifname[IFNAMSIZ];
	u_long ifindex;
};

/* Prefix status */
#define NDPRF_ONLINK		0x1
#define NDPRF_DETACHED		0x2

/* protocol constants */
#define MAX_RTR_SOLICITATION_DELAY	1	/* 1sec */
#define RTR_SOLICITATION_INTERVAL	4	/* 4sec */
#define MAX_RTR_SOLICITATIONS		3

#define ND6_INFINITE_LIFETIME		0xffffffff

#ifdef _KERNEL
/* node constants */
#define MAX_REACHABLE_TIME		3600000	/* msec */
#define REACHABLE_TIME			30000	/* msec */
#define RETRANS_TIMER			1000	/* msec */
#define MIN_RANDOM_FACTOR		512	/* 1024 * 0.5 */
#define MAX_RANDOM_FACTOR		1536	/* 1024 * 1.5 */
#define DEF_TEMP_VALID_LIFETIME		604800	/* 1 week */
#define DEF_TEMP_PREFERRED_LIFETIME	86400	/* 1 day */
#define TEMPADDR_REGEN_ADVANCE		5	/* sec */
#define MAX_TEMP_DESYNC_FACTOR		600	/* 10 min */
#define ND_COMPUTE_RTIME(x) \
		(((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \
		((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)

TAILQ_HEAD(nd_drhead, nd_defrouter);
struct	nd_defrouter {
	TAILQ_ENTRY(nd_defrouter) dr_entry;
	struct	in6_addr rtaddr;
	u_char	flags;		/* flags on RA message */
	u_short	rtlifetime;
	u_long	expire;
	struct  ifnet *ifp;
	int	installed;	/* is installed into kernel routing table */
};

struct nd_prefixctl {
	struct ifnet *ndpr_ifp;

	/* prefix */
	struct sockaddr_in6 ndpr_prefix;
	u_char	ndpr_plen;

	u_int32_t ndpr_vltime;	/* advertised valid lifetime */
	u_int32_t ndpr_pltime;	/* advertised preferred lifetime */

	struct prf_ra ndpr_flags;
};

struct nd_prefix {
	struct ifnet *ndpr_ifp;
	LIST_ENTRY(nd_prefix) ndpr_entry;
	struct sockaddr_in6 ndpr_prefix;	/* prefix */
	struct in6_addr ndpr_mask; /* netmask derived from the prefix */

	u_int32_t ndpr_vltime;	/* advertised valid lifetime */
	u_int32_t ndpr_pltime;	/* advertised preferred lifetime */

	time_t ndpr_expire;	/* expiration time of the prefix */
	time_t ndpr_preferred;	/* preferred time of the prefix */
	time_t ndpr_lastupdate; /* reception time of last advertisement */

	struct prf_ra ndpr_flags;
	u_int32_t ndpr_stateflags; /* actual state flags */
	/* list of routers that advertise the prefix: */
	LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
	u_char	ndpr_plen;
	int	ndpr_refcnt;	/* reference couter from addresses */
};

#define ndpr_raf		ndpr_flags
#define ndpr_raf_onlink		ndpr_flags.onlink
#define ndpr_raf_auto		ndpr_flags.autonomous
#define ndpr_raf_router		ndpr_flags.router

/*
 * Message format for use in obtaining information about prefixes
 * from inet6 sysctl function
 */
struct inet6_ndpr_msghdr {
	u_short	inpm_msglen;	/* to skip over non-understood messages */
	u_char	inpm_version;	/* future binary compatibility */
	u_char	inpm_type;	/* message type */
	struct in6_addr inpm_prefix;
	u_long	prm_vltim;
	u_long	prm_pltime;
	u_long	prm_expire;
	u_long	prm_preferred;
	struct in6_prflags prm_flags;
	u_short	prm_index;	/* index for associated ifp */
	u_char	prm_plen;	/* length of prefix in bits */
};

#define prm_raf_onlink		prm_flags.prf_ra.onlink
#define prm_raf_auto		prm_flags.prf_ra.autonomous

#define prm_statef_onlink	prm_flags.prf_state.onlink

#define prm_rrf_decrvalid	prm_flags.prf_rr.decrvalid
#define prm_rrf_decrprefd	prm_flags.prf_rr.decrprefd

struct nd_pfxrouter {
	LIST_ENTRY(nd_pfxrouter) pfr_entry;
	struct nd_defrouter *router;
};

LIST_HEAD(nd_prhead, nd_prefix);

/* nd6.c */
VNET_DECLARE(int, nd6_prune);
VNET_DECLARE(int, nd6_delay);
VNET_DECLARE(int, nd6_umaxtries);
VNET_DECLARE(int, nd6_mmaxtries);
VNET_DECLARE(int, nd6_useloopback);
VNET_DECLARE(int, nd6_maxnudhint);
VNET_DECLARE(int, nd6_gctimer);
VNET_DECLARE(struct nd_drhead, nd_defrouter);
VNET_DECLARE(struct nd_prhead, nd_prefix);
VNET_DECLARE(int, nd6_debug);
VNET_DECLARE(int, nd6_onlink_ns_rfc4861);
#define	V_nd6_prune			VNET(nd6_prune)
#define	V_nd6_delay			VNET(nd6_delay)
#define	V_nd6_umaxtries			VNET(nd6_umaxtries)
#define	V_nd6_mmaxtries			VNET(nd6_mmaxtries)
#define	V_nd6_useloopback		VNET(nd6_useloopback)
#define	V_nd6_maxnudhint		VNET(nd6_maxnudhint)
#define	V_nd6_gctimer			VNET(nd6_gctimer)
#define	V_nd_defrouter			VNET(nd_defrouter)
#define	V_nd_prefix			VNET(nd_prefix)
#define	V_nd6_debug			VNET(nd6_debug)
#define	V_nd6_onlink_ns_rfc4861		VNET(nd6_onlink_ns_rfc4861)

#define nd6log(x)	do { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0)

VNET_DECLARE(struct callout, nd6_timer_ch);
#define	V_nd6_timer_ch			VNET(nd6_timer_ch)

/* nd6_rtr.c */
VNET_DECLARE(int, nd6_defifindex);
VNET_DECLARE(int, ip6_desync_factor);	/* seconds */
VNET_DECLARE(u_int32_t, ip6_temp_preferred_lifetime); /* seconds */
VNET_DECLARE(u_int32_t, ip6_temp_valid_lifetime); /* seconds */
VNET_DECLARE(int, ip6_temp_regen_advance); /* seconds */
#define	V_nd6_defifindex		VNET(nd6_defifindex)
#define	V_ip6_desync_factor		VNET(ip6_desync_factor)
#define	V_ip6_temp_preferred_lifetime	VNET(ip6_temp_preferred_lifetime)
#define	V_ip6_temp_valid_lifetime	VNET(ip6_temp_valid_lifetime)
#define	V_ip6_temp_regen_advance	VNET(ip6_temp_regen_advance)

union nd_opts {
	struct nd_opt_hdr *nd_opt_array[8];	/* max = target address list */
	struct {
		struct nd_opt_hdr *zero;
		struct nd_opt_hdr *src_lladdr;
		struct nd_opt_hdr *tgt_lladdr;
		struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */
		struct nd_opt_rd_hdr *rh;
		struct nd_opt_mtu *mtu;
		struct nd_opt_hdr *search;	/* multiple opts */
		struct nd_opt_hdr *last;	/* multiple opts */
		int done;
		struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
	} nd_opt_each;
};
#define nd_opts_src_lladdr	nd_opt_each.src_lladdr
#define nd_opts_tgt_lladdr	nd_opt_each.tgt_lladdr
#define nd_opts_pi		nd_opt_each.pi_beg
#define nd_opts_pi_end		nd_opt_each.pi_end
#define nd_opts_rh		nd_opt_each.rh
#define nd_opts_mtu		nd_opt_each.mtu
#define nd_opts_search		nd_opt_each.search
#define nd_opts_last		nd_opt_each.last
#define nd_opts_done		nd_opt_each.done

/* XXX: need nd6_var.h?? */
/* nd6.c */
void nd6_init(void);
#ifdef VIMAGE
void nd6_destroy(void);
#endif
struct nd_ifinfo *nd6_ifattach(struct ifnet *);
void nd6_ifdetach(struct nd_ifinfo *);
int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *);
void nd6_option_init(void *, int, union nd_opts *);
struct nd_opt_hdr *nd6_option(union nd_opts *);
int nd6_options(union nd_opts *);
struct	llentry *nd6_lookup(struct in6_addr *, int, struct ifnet *);
void nd6_setmtu(struct ifnet *);
void nd6_llinfo_settimer(struct llentry *, long);
void nd6_llinfo_settimer_locked(struct llentry *, long);
void nd6_timer(void *);
void nd6_purge(struct ifnet *);
void nd6_nud_hint(struct rtentry *, struct in6_addr *, int);
int nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *,
	struct sockaddr *, u_char *);
void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
int nd6_ioctl(u_long, caddr_t, struct ifnet *);
struct llentry *nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
	char *, int, int, int);
int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *,
	struct sockaddr_in6 *, struct rtentry *);
int nd6_output_lle(struct ifnet *, struct ifnet *, struct mbuf *,
	struct sockaddr_in6 *, struct rtentry *, struct llentry *,
	struct mbuf **);
int nd6_output_flush(struct ifnet *, struct ifnet *, struct mbuf *,
	struct sockaddr_in6 *, struct route *);
int nd6_need_cache(struct ifnet *);
int nd6_storelladdr(struct ifnet *, struct mbuf *,
	struct sockaddr *, u_char *, struct llentry **);

/* nd6_nbr.c */
void nd6_na_input(struct mbuf *, int, int);
void nd6_na_output(struct ifnet *, const struct in6_addr *,
	const struct in6_addr *, u_long, int, struct sockaddr *);
void nd6_ns_input(struct mbuf *, int, int);
void nd6_ns_output(struct ifnet *, const struct in6_addr *,
	const struct in6_addr *, struct llentry *, int);
caddr_t nd6_ifptomac(struct ifnet *);
void nd6_dad_start(struct ifaddr *, int);
void nd6_dad_stop(struct ifaddr *);
void nd6_dad_duplicated(struct ifaddr *);

/* nd6_rtr.c */
void nd6_rs_input(struct mbuf *, int, int);
void nd6_ra_input(struct mbuf *, int, int);
void prelist_del(struct nd_prefix *);
void defrouter_reset(void);
void defrouter_select(void);
void defrtrlist_del(struct nd_defrouter *);
void prelist_remove(struct nd_prefix *);
int nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *,
	struct nd_prefix **);
void pfxlist_onlink_check(void);
struct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *);
struct nd_prefix *nd6_prefix_lookup(struct nd_prefixctl *);
void rt6_flush(struct in6_addr *, struct ifnet *);
int nd6_setdefaultiface(int);
int in6_tmpifadd(const struct in6_ifaddr *, int, int);

#endif /* _KERNEL */

#endif /* _NETINET6_ND6_H_ */


text:
namespace TestAssembly.Lifetimes.TestObjects
{
    internal interface IPerRequestFoo { }
    internal class PerRequestFoo : IPerRequestFoo { }

    internal interface IPerRequestBar
    {
        IPerRequestFoo PerRequestFoo { get; }
    }

    internal class PerRequestBar : IPerRequestBar
    {
        public PerRequestBar(IPerRequestFoo perRequestFoo)
        {
            PerRequestFoo = perRequestFoo;
        }

        public IPerRequestFoo PerRequestFoo { get; }
    }

    internal interface IPerRequestDependencies
    {
        IPerRequestFoo Foo { get; }
        IPerRequestBar Bar { get; }
    }

    internal class PerRequestDependencies : IPerRequestDependencies
    {
        public PerRequestDependencies(
            IPerRequestFoo foo,
            IPerRequestBar bar)
        {
            Foo = foo;
            Bar = bar;
        }

        public IPerRequestFoo Foo { get; }
        public IPerRequestBar Bar { get; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace accuracy_tips {
namespace features {

// Additional parameters for safe_browsing::kAccuracyTipsFeature.

// URL that triggers an AccuracyTip for testing purposes.
extern const base::FeatureParam<std::string> kSampleUrl;

// Disables the UI but still queries SB and records metrics. Used for
// dark-launch and to create a control group.
extern const base::FeatureParam<bool> kDisableUi;

// URL that the "Learn more" button links to.
extern const base::FeatureParam<std::string> kLearnMoreUrl;

// Amount of time that has to pass between two accuracy prompts.
extern const base::FeatureParam<base::TimeDelta> kTimeBetweenPrompts;

// Number of prompts that are shown with an "ignore" button instead of an
// opt-out.
extern const base::FeatureParam<int> kNumIgnorePrompts;

// Amount of site-enagegement score that would suppress an accuracy tip.
extern const base::FeatureParam<int> kMaxSiteEngagementScore;

// Controls whether accuracy tips survey should be enabled.
extern const base::Feature kAccuracyTipsSurveyFeature;

// A minimal amount of time that has to pass after showing accuracy tip before
// trying to show a survey.
extern const base::FeatureParam<base::TimeDelta> kMinTimeToShowSurvey;

// A maximal amount of time, that passed after showing accuracy tip, during
// which we can show a survey.
extern const base::FeatureParam<base::TimeDelta> kMaxTimeToShowSurvey;

// A minimal count of accuracy tips shown, after which survey might be shown.
extern const base::FeatureParam<int> kMinPromptCountRequiredForSurvey;

}  // namespace features
}  // namespace accuracy_tips

#endif  // COMPONENTS_ACCURACY_TIPS_FEATURES_H_


text:
/**
 *
 */
package org.cdlib.xtf.xslt;

/*
 * Copyright (c) 2007, Regents of the University of California
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * - Neither the name of the University of California nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

import java.io.IOException;
import java.util.Stack;

import org.cdlib.xtf.servletBase.DTDSuppressingXMLReader;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.ext.LexicalHandler;

/**
 * Like a normal XMLReader, except that it stops processing when the first
 * end-element tag is encountered. This reads in the first part of an XML file,
 * which is like a "stub" version of the file. Also, we jump through very
 * special hoops to make the DTD declaration available (it's not normally
 * part of Saxon's data model.)
 *
 * This file created November 1, 2007 by Martin Haye
 */
class XMLStubReader extends DTDSuppressingXMLReader
{
  /** Thrown after the first element end marker is found */
  private class GetOut extends RuntimeException { }

  /**
   * Establish the content handler that will receive events. We wrap it
   * to perform special processing.
   */
  public void setContentHandler(ContentHandler handler) {
    StubContentHandler stubHandler = new StubContentHandler(handler);
    super.setContentHandler(stubHandler);
  }

  /**
   * Catch requests to set the "lexical handler". We insert a stub handler
   * in the chain so we can catch the DTD declaration.
   */
  public void setProperty(String name, Object value)
    throws SAXNotRecognizedException, SAXNotSupportedException
  {
    if (name.equals("http://xml.org/sax/properties/lexical-handler")) {
      StubLexicalHandler stubHandler = new StubLexicalHandler((LexicalHandler)value);
      super.setProperty(name, stubHandler);
    }
    else
      super.setProperty(name, value);
  }

  /** Parse the input document, but stop at the first end-element marker */
  public void parse (InputSource input)
    throws IOException, SAXException
  {
    try {
      super.parse(input);
    }
    catch (GetOut g) {
      // This is normal: do nothing.
    }
  }

  /**
   * Handles 'lexical' events. We mainly need to catch the start of the DTD
   * and turn that even into an unparsed entity declaration so that Saxon will
   * keep a record of it.
   */
  private class StubLexicalHandler implements LexicalHandler
  {
    private LexicalHandler out;

    public StubLexicalHandler(LexicalHandler out) {
      this.out = out;
    }

    ////////////////// Special delegate methods /////////////////

    public void startDTD(String name, String publicId, String systemId)
    throws SAXException
    {
      out.startDTD(name, publicId, systemId);
      if (out instanceof DTDHandler && systemId != null)
        ((DTDHandler)out).unparsedEntityDecl(name, publicId, systemId, null);
    }

    /////////////// Pass-through delegate methods /////////////////

    public void endDTD() throws SAXException {
      out.endDTD();
    }

    public void startEntity(String name) throws SAXException {
      out.startEntity(name);
    }

    public void endEntity(String name) throws SAXException {
      out.endEntity(name);
    }

    public void comment(char[] ch, int start, int length) throws SAXException {
      out.comment(ch, start, length);
    }

    public void startCDATA() throws SAXException {
      out.startCDATA();
    }

    public void endCDATA() throws SAXException {
      out.endCDATA();
    }
  }

  /**
   * Handles content events from the XML parser.
   */
  private class StubContentHandler implements ContentHandler
  {
    private ContentHandler out;
    private Stack<String[]> eventStack = new Stack<String[]>();

    /** Construct the content handler, passing events to 'out' */
    public StubContentHandler(ContentHandler out) {
      this.out = out;
    }

    ///////////// Special delegate methods /////////////

    public void startElement(String uri, String localName, String name,
        Attributes atts) throws SAXException
    {
      // Keep track of which elements have been started, so we can auto-close
      // them later.
      //
      eventStack.push(new String[] { "element", uri, localName, name });
      out.startElement(uri, localName, name, atts);
    }

    public void endElement(String uri, String localName, String name)
      throws SAXException
    {
      // We've reached the first end-element. Let's simulate the situation that
      // the document just ends here. So we unwind the event stack, closing all
      // elements and prefix mappings.
      //
      while (!eventStack.isEmpty()) {
        String[] event = eventStack.pop();
        if (event[0].equals("element"))
          out.endElement(event[1], event[2], event[3]);
        else if (event[0].equals("prefix"))
          out.endPrefixMapping(event[1]);
        else
          assert false;
      }

      // All done. End the document, and abort the rest of the parse().
      out.endDocument();
      throw new GetOut();
    }

    public void startPrefixMapping(String prefix, String uri)
      throws SAXException
    {
      // Keep track of open prefix mappings so we can auto-close them later.
      eventStack.push(new String[] { "prefix", prefix });
      out.startPrefixMapping(prefix, uri);
    }

    public void endPrefixMapping(String prefix) throws SAXException {
      out.endPrefixMapping(prefix);
      String[] event = eventStack.pop();
      assert event[0].equals("prefix");
      assert event[1].equals(prefix);
    }

    /////////// Pass-through delegate methods ///////////

    public void startDocument() throws SAXException {
      out.startDocument();
    }

    public void endDocument() throws SAXException {
      out.endDocument();
    }

    public void characters(char[] ch, int start, int length)
      throws SAXException
    {
      out.characters(ch, start, length);
    }

    public void ignorableWhitespace(char[] ch, int start, int length)
      throws SAXException
    {
      out.ignorableWhitespace(ch, start, length);
    }

    public void processingInstruction(String target, String data)
      throws SAXException
    {
      out.processingInstruction(target, data);
    }

    public void setDocumentLocator(Locator locator) {
      out.setDocumentLocator(locator);
    }

    public void skippedEntity(String name) throws SAXException {
      out.skippedEntity(name);
    }

  }
}


text:
package com.acme.ecards.api.email.impl;

import com.acme.ecards.api.common.ProviderFactory;
import com.acme.ecards.api.config.AppConfig;
import com.acme.ecards.api.email.support.SessionService;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.mail.Session;
import org.jvnet.hk2.annotations.Service;

/**
 * Provides javamail session object based on mandrill configuration.
 *
 * @author Sharmarke Aden (saden1)
 */
@Service
public class MandrillSessionProvider implements ProviderFactory<Session> {

    private final Map<String, Object> config;
    private final SessionService sessionFactory;

    /**
     *
     * @param config
     */
    @Inject
    MandrillSessionProvider(@AppConfig Map<String, Object> config, SessionService sessionFactory) {
        this.config = config;
        this.sessionFactory = sessionFactory;
    }

    @Named("mandrill")
    @Singleton
    @Override
    public Session provide() {
        @SuppressWarnings("unchecked")
        Map<String, Map<String, Object>> emailServices = (Map) config.get("email-services");
        Map<String, Object> mandrill = emailServices.get("mandrill");

        return sessionFactory.newSession(mandrill);
    }

}


text:
import type {
  Attributes,
  CreationAttributes,
  CreationOptional,
  ForeignKey,
  InferAttributes,
  InferCreationAttributes,
  NonAttribute,
} from '@sequelize/core';
import {
  DataTypes,
  Model,
  Sequelize,
} from '@sequelize/core';
import { expectTypeOf } from 'expect-type';

class Project extends Model<InferAttributes<Project>> {
  declare id: number;
}

class User extends Model<InferAttributes<User, { omit: 'omittedAttribute' | 'omittedAttributeArray' }>,
  InferCreationAttributes<User, { omit: 'omittedAttribute' | 'omittedAttributeArray' }>> {
  declare optionalAttribute: CreationOptional<number>;
  declare mandatoryAttribute: string;

  declare optionalArrayAttribute: CreationOptional<string[]>;
  declare mandatoryArrayAttribute: string[];

  // note: using CreationOptional here is unnecessary, but we still ensure that it works.
  declare nullableOptionalAttribute: CreationOptional<string | null>;

  declare nonAttribute: NonAttribute<string>;
  declare nonAttributeArray: NonAttribute<string[]>;
  declare nonAttributeNestedArray: NonAttribute<string[][]>;

  declare omittedAttribute: number;
  declare omittedAttributeArray: number[];

  declare joinedEntity?: NonAttribute<Project>;
  declare projectId: CreationOptional<ForeignKey<number>>;

  instanceMethod() {}

  static staticMethod() {}
}

User.init({
  mandatoryArrayAttribute: DataTypes.ARRAY(DataTypes.STRING),
  mandatoryAttribute: DataTypes.STRING,
  // projectId is omitted but still works, because it is branded with 'ForeignKey'
  nullableOptionalAttribute: DataTypes.STRING,
  optionalArrayAttribute: DataTypes.ARRAY(DataTypes.STRING),
  optionalAttribute: DataTypes.INTEGER,
}, { sequelize: new Sequelize() });

type UserAttributes = Attributes<User>;
type UserCreationAttributes = CreationAttributes<User>;

expectTypeOf<UserAttributes>().not.toBeAny();
expectTypeOf<UserCreationAttributes>().not.toBeAny();

expectTypeOf<UserAttributes['optionalAttribute']>().not.toBeNullable();
expectTypeOf<UserCreationAttributes['optionalAttribute']>().toBeNullable();

expectTypeOf<UserAttributes['mandatoryAttribute']>().not.toBeNullable();
expectTypeOf<UserCreationAttributes['mandatoryAttribute']>().not.toBeNullable();

expectTypeOf<UserAttributes['optionalArrayAttribute']>().not.toBeNullable();
expectTypeOf<UserCreationAttributes['optionalArrayAttribute']>().toBeNullable();

type NonUndefined<T> = T extends undefined ? never : T;

expectTypeOf<UserCreationAttributes['nullableOptionalAttribute']>().not.toEqualTypeOf<NonUndefined<UserCreationAttributes['nullableOptionalAttribute']>>();

expectTypeOf<UserAttributes['mandatoryArrayAttribute']>().not.toBeNullable();
expectTypeOf<UserCreationAttributes['mandatoryArrayAttribute']>().not.toBeNullable();

expectTypeOf<UserAttributes>().not.toHaveProperty('nonAttribute');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('nonAttribute');

expectTypeOf<UserAttributes>().not.toHaveProperty('nonAttributeArray');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('nonAttributeArray');

expectTypeOf<UserAttributes>().not.toHaveProperty('nonAttributeNestedArray');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('nonAttributeNestedArray');

expectTypeOf<UserAttributes>().not.toHaveProperty('omittedAttribute');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('omittedAttribute');

expectTypeOf<UserAttributes>().not.toHaveProperty('omittedAttributeArray');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('omittedAttributeArray');

expectTypeOf<UserAttributes>().not.toHaveProperty('instanceMethod');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('instanceMethod');

expectTypeOf<UserAttributes>().not.toHaveProperty('staticMethod');
expectTypeOf<UserCreationAttributes>().not.toHaveProperty('staticMethod');

// brands:

{
  const user = User.build({ mandatoryArrayAttribute: [], mandatoryAttribute: '' });

  // ensure branding does not break arrays.
  const brandedArray: NonAttribute<string[]> = user.nonAttributeArray;
  const anArray: string[] = user.nonAttributeArray;
  const item: boolean = user.nonAttributeArray[0].endsWith('');
}

{
  // ensure branding does not break objects
  const brandedObject: NonAttribute<Record<string, string>> = {};
  const anObject: Record<string, string> = brandedObject;
  const item: string = brandedObject.key;
}

{
  // ensure branding does not break primitives
  const brandedString: NonAttribute<string> = '';
  const aString: string = brandedString;
}

{
  const user = User.build({ mandatoryArrayAttribute: [], mandatoryAttribute: '' });
  const project: Project = user.joinedEntity!;

  // ensure branding does not break objects
  const id = project.id;
}

{
  // ensure branding does not break null
  const brandedString: NonAttribute<string | null> = null;
}

{
  class User2 extends Model<InferAttributes<User2>, InferCreationAttributes<User2>> {
    declare nullableAttribute: string | null;
  }

  // this should work, all null attributes are optional in Model.create
  User2.create({});
}


text:
#include "NexVariable.h"

NexVariable::NexVariable(uint8_t pid, uint8_t cid, const char *name)
    :NexTouch(pid, cid, name)
{
}

uint32_t NexVariable::getValue(uint32_t *number)
{
    String cmd = String("get ");
    cmd += getObjName();
    cmd += ".val";
    sendCommand(cmd.c_str());
    return recvRetNumber(number);
}

bool NexVariable::setValue(uint32_t number)
{
    char buf[10] = {0};
    String cmd;

    utoa(number, buf, 10);
    cmd += getObjName();
    cmd += ".val=";
    cmd += buf;

    sendCommand(cmd.c_str());
    return recvRetCommandFinished();
}

uint32_t NexVariable::getText(char *buffer, uint32_t len)
{
    String cmd;
    cmd += "get ";
    cmd += getObjName();
    cmd += ".txt";
    sendCommand(cmd.c_str());
    return recvRetString(buffer,len);
}

bool NexVariable::setText(const char *buffer)
{
    String cmd;
    cmd += getObjName();
    cmd += ".txt=\"";
    cmd += buffer;
    cmd += "\"";
    sendCommand(cmd.c_str());
    return recvRetCommandFinished();
}


text:
cd $PBS_O_WORKDIR
echo "Hello World" > output_file

echo "Created output file with 'Hello World'"


text:
import numpy as np

def select_topr(vct_input, r):
    """
    Returns the R-th greatest elements indices
    in input vector and store them in idxs_n.
    Here, we're using this function instead of
    a complete sorting one, where it's more efficient
    than complete sorting function in real big data application
    parameters
    ----------
    vct_input : array, shape (T)
        indicating the input vector which is a
        vector we aimed to find the Rth greatest
        elements. After finding those elements we
        will store the indices of those specific
        elements in output vector.
    r : integer
        indicates Rth greatest elemnts which we
        are seeking for.
    Returns
    -------
    idxs_n : array, shape (R)
        a vector in which the Rth greatest elements
        indices will be stored and returned as major
        output of the function.
    """
    temp = np.argpartition(-vct_input, r)
    idxs_n = temp[:r]
    return idxs_n


text:
Dank je voor het aanmelden bij !!sitename!!. Je lidmaatschap is nu actief.

Hieronder vind je informatie over je lidmaatschap.

Account: !!display_name!! (!!user_email!!)

Type lidmaatschap: !!membership_level_name!!

Kosten: !!membership_cost!!

!!membership_expiration!! !!discount_code!!

	Factuurgegevens:

	!!billing_address!!

	!!cardtype!!: !!accountnumber!!

	Verlooopt: !!expirationmonth!!/!!expirationyear!!

Log hier in om naar je account te gaan: !!login_link!!


text:
package net.violet.platform.datamodel.mock;

import java.util.ArrayList;
import java.util.List;

import net.violet.db.records.AbstractMockRecord;
import net.violet.platform.datamodel.Feed;
import net.violet.platform.datamodel.FeedItem;
import net.violet.platform.datamodel.Files;
import net.violet.platform.datamodel.factories.Factories;

public class FeedItemMock extends AbstractMockRecord<FeedItem, FeedItemMock> implements FeedItem {

	private final long feedId;
	private final List<Files> contents;
	private final String title;
	private final String link;
	private final String uri;

	public FeedItemMock(long feedId, List<Files> contents, String title, String link, String uri) {
		super(0);
		this.feedId = feedId;
		this.contents = contents;
		this.title = title;
		this.link = link;
		this.uri = uri;
	}

	public List<Files> getContents() {
		return new ArrayList<Files>(this.contents);
	}

	public Feed getFeed() {
		return Factories.FEED.find(this.feedId);
	}

	public String getLink() {
		return this.link;
	}

	public String getTitle() {
		return this.title;
	}

	public String getUri() {
		return this.uri;
	}

}


text:
Reports anonymous classes which could be transformed to constructor or factory method call accepting lambda expression.

The following classes are reported by this inspection:

ThreadLocal anonymous classes having initialValue() method (could be replaced with ThreadLocal.withInitial)

Thread anonymous classes having run() method (could be replaced with new Thread(Runnable)

New in 2016.3


text:
<?xml version="1.0" encoding="utf-8"?>
<cruise xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="cruise-config.xsd" schemaVersion="95">
  <server artifactsdir="artifacts" agentAutoRegisterKey="331d13eb-7134-4826-982f-6ae3c787f21c" webhookSecret="b27bf6ad-a13e-4aa1-bdfd-80b5cda85745" commandRepositoryLocation="default" serverId="8e0df64a-f96f-4e3f-8d12-799fcff6f964" />
  <pipelines group="dokumentation">
    <pipeline name="Netzwerkdokumentation">
      <materials>
        <git url="https://github.com/noldeni/gocd-test-repo.git" />
      </materials>
      <stage name="Build" cleanWorkingDir="true">
        <jobs>
          <job name="build">
            <tasks>
              <exec command="./change_release_no.sh" />
              <exec command="cat">
                <arg>source/conf.py</arg>
                <runif status="passed" />
              </exec>
              <exec command="pwd">
                <runif status="passed" />
              </exec>
              <exec command="id">
                <runif status="passed" />
              </exec>
              <exec command="./build.sh">
                <arg>--html</arg>
                <runif status="passed" />
              </exec>
            </tasks>
            <tabs>
              <tab name="Result" path="build/html/Index.html" />
            </tabs>
            <resources>
              <resource>docker-local</resource>
            </resources>
            <artifacts>
              <artifact src="build" />
            </artifacts>
          </job>
        </jobs>
      </stage>
      <stage name="Check" fetchMaterials="false">
        <jobs>
          <job name="check">
            <tasks>
              <fetchartifact pipeline="Netzwerkdokumentation" stage="Build" job="build" srcdir="build">
                <runif status="passed" />
              </fetchartifact>
              <exec command="ls">
                <arg>-lR</arg>
                <runif status="passed" />
              </exec>
            </tasks>
            <tabs>
              <tab name="Result" path="build/html/Index.html" />
            </tabs>
          </job>
        </jobs>
      </stage>
      <stage name="Deploy" fetchMaterials="false">
        <jobs>
          <job name="deploy">
            <environmentvariables>
              <variable name="user">
                <value>noldeni</value>
              </variable>
            </environmentvariables>
            <tasks>
              <fetchartifact pipeline="Netzwerkdokumentation" stage="Build" job="build" srcdir="build">
                <runif status="passed" />
              </fetchartifact>
              <exec command="ls">
                <arg>-lR</arg>
                <runif status="passed" />
              </exec>
              <exec command="env">
                <runif status="passed" />
              </exec>
              <exec command="/bin/bash">
                <arg>-c</arg>
                <arg>scp -r build/html ${user}@213.168.71.42:~/gotest</arg>
                <runif status="passed" />
              </exec>
            </tasks>
          </job>
        </jobs>
      </stage>
    </pipeline>
  </pipelines>
  <agents>
    <agent hostname="3b475b71e126" ipaddress="172.19.0.3" uuid="af211c4f-9a0d-4d93-8558-2930a15bdc89">
      <resources>
        <resource>java</resource>
        <resource>python</resource>
        <resource>test</resource>
      </resources>
    </agent>
    <agent hostname="galadriel" ipaddress="127.0.0.1" uuid="82af4a6e-e8f8-4718-8337-f19328228aa7">
      <resources>
        <resource>docker-local</resource>
        <resource>java</resource>
        <resource>python</resource>
        <resource>test</resource>
      </resources>
    </agent>
    <agent hostname="8177688b891e" ipaddress="172.19.0.2" uuid="ffb490ed-c858-4b82-8383-ba6db4f0f9cb">
      <resources>
        <resource>java</resource>
        <resource>python</resource>
        <resource>test</resource>
      </resources>
    </agent>
    <agent hostname="7ef204995d98" ipaddress="172.19.0.3" uuid="48245a31-49d9-4028-8aa4-a422c0702177">
      <resources>
        <resource>java</resource>
        <resource>python</resource>
        <resource>test</resource>
      </resources>
    </agent>
  </agents>
</cruise>


text:
import operator
import fileinput
f = fileinput.input()

def left(n):
    """Is node n a left descendant of the root in a zero-indexed boolean tree?"""
    while n > 2:
        n = (n-1)//2
    return n == 1

class BooleanTree:
    def __init__(self,nodeinfo,debug=False,adamsize=None):
        self.leaf = (len(nodeinfo) == 1)
        if self.leaf:
            self.value = nodeinfo[0]
        self.adamsize = adamsize if adamsize else len(nodeinfo)
        self.solutions = dict()
        if debug:
            print nodeinfo
        if not self.leaf:
            self.gate,self.changeable = nodeinfo[0]
            self.left = BooleanTree([x for (i,x) in enumerate(nodeinfo) if left(i)],adamsize=self.adamsize)
            self.right = BooleanTree([x for (i,x) in enumerate(nodeinfo) if i>0 and not left(i)],adamsize=self.adamsize)

    def ma(self,V):
        """What is the minimum number of gates that can be changed to make the root of this boolean tree evaluate to V? Return a number greater than the number of nodes M if not possible."""
        try:
            return self.solutions[V]
        except KeyError:
            pass

        if self.leaf:
            self.solutions[V] = 0 if self.value == V else self.adamsize+1
            return self.solutions[V]

        possibles = [self.adamsize+1]
        for logic in (operator.or_, operator.and_):
            for i in (0,1):
                for j in (0,1):
                    if logic(i,j)==V:
                        if self.gate == logic:
                            penalty = 0
                        elif self.changeable:
                            penalty = 1
                        else:
                            # penalty = self.adamsize+1
                            continue
                        l = self.left.ma(i)
                        r = self.right.ma(j)
                        possibles.append(penalty+l+r)

        self.solutions[V] = min(possibles)
        return self.solutions[V]

T = int(f.readline())

for i in range(1,T+1):
    M, V = [int(x) for x in f.readline().split()]
    assert M % 2 == 1
    assert V in (0,1)
    nodeinfo = list()
    #The first (M-1)/2 lines describe the interior nodes. Each line contains G and C, each being either 0 or 1. If G is 1 then the gate for this node is an AND gate, otherwise it is an OR gate. If C is 1 then the gate for this node is changeable, otherwise it is not. Interior node X has nodes 2X and 2X+1 as children.
    for j in range( (M-1)//2 ):
        G, C = [int(x) for x in f.readline().split()]
        C = bool(C)
        G = operator.and_ if G == 1 else operator.or_
        nodeinfo.append((G,C))
    #The next (M+1)/2 lines describe the leaf nodes. Each line contains one value I, 0 or 1, the value of the leaf node.
    for j in range( (M+1)//2 ):
        I = int(f.readline())
        nodeinfo.append(I)
    T = BooleanTree(nodeinfo,debug=False)
    x = T.ma(V)
    answer = "IMPOSSIBLE" if x > M else x
    print "Case #%d: %s" % (i,answer)


text:
package com.yx.platform.core.support.scheduler;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.plugins.Page;
import com.yx.platform.core.base.BaseService;
import com.yx.platform.core.util.InstanceUtil;
import com.yx.platform.mapper.TaskFireLogMapper;
import com.yx.platform.model.TaskFireLog;

import springfox.documentation.annotations.Cacheable;

public class SchedulerService implements ApplicationContextAware
{
    @Autowired
    private TaskFireLogMapper logMapper;

    @Autowired
    private SchedulerManager schedulerManager;

    protected ApplicationContext applicationContext;

    public void setApplicationContext(ApplicationContext applicationContext)
    {
        this.applicationContext = applicationContext;
    }

    // 获取所有作业
    public List<TaskScheduled> getAllTaskDetail()
    {
        return schedulerManager.getAllJobDetail();
    }

    // 执行作业
    public void execTask(TaskScheduled taskScheduler)
    {
        schedulerManager.runJob(taskScheduler);
    }

    // 恢复作业
    public void openTask(TaskScheduled taskScheduled)
    {
        schedulerManager.resumeJob(taskScheduled);
    }

    // 暂停作业
    public void closeTask(TaskScheduled taskScheduled)
    {
        schedulerManager.stopJob(taskScheduled);
    }

    // 删除作业
    public void delTask(TaskScheduled taskScheduled)
    {
        schedulerManager.delJob(taskScheduled);
    }

    // 修改任务
    public void updateTask(TaskScheduled taskScheduled)
    {
        schedulerManager.updateTask(taskScheduled);
    }

    @Cacheable("taskFireLog")
    public TaskFireLog getFireLogById(Long id)
    {
        return logMapper.selectById(id);
    }

    @Transactional
    @CachePut("taskFireLog")
    public TaskFireLog updateLog(TaskFireLog record)
    {
        if (record.getId() == null)
        {
            logMapper.insert(record);
        }
        else
        {
            logMapper.updateById(record);
        }
        return record;
    }

    public Page<TaskFireLog> queryLog(Map<String, Object> params)
    {
        Page<Long> ids = BaseService.getPage(params);
        ids.setRecords(logMapper.selectIdByMap(ids, params));
        Page<TaskFireLog> page = new Page<TaskFireLog>(ids.getCurrent(), ids.getSize());
        page.setTotal(ids.getTotal());
        if (ids != null)
        {
            List<TaskFireLog> records = InstanceUtil.newArrayList();
            for (Long id : ids.getRecords())
            {
                records.add(applicationContext.getBean(getClass()).getFireLogById(id));
            }
            page.setRecords(records);
        }
        return page;
    }
}


text:
layout: post
catalog: true
title: "Kotlin问题汇总"
description: ""
category: kotlin
subhead: ''
tags: [kotlin,reference]

---

### 与Spring AOP结合

在`默认`情况下,kotlin定义的非抽象class是final类型,字段也是一样;而在Spring中,AOP是不能代理final的类或者成员变量的,
final的类代理会报异常,而final的成员变量代理后是`null`。目前这是个很隐蔽的坑,有的时候在运行时才能发现。解决方法就是在类或者成员变量上加上`open`修饰。

````
@Service
open class OrderPersistFun {
    @Resource
    open var orderPayAssembleFun: OrderPayAssembleFun? = null
    @Resource
    open var orderManager: OrderManager? = null
}

````

### 与Java混编

在IntelliJ IDEA中安装kotlin插件后,对于kotlin项目idea会自动提示配合kotlin,通常会自动把pom文件加入kotlin的依赖和编译插件。
当项目有java和kotlin同时存在的时候,maven编译会报错:在Java文件中找不到kotlin的类或者包。解决方法是加入maven compiler插件。

````
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <executions>
        <execution>
            <id>default-compile</id>
            <phase>none</phase>
        </execution>
        <execution>
            <id>default-testCompile</id>
            <phase>none</phase>
        </execution>
        <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
        <execution>
            <id>testCompile</id>
            <phase>test-compile</phase>
            <goals>
                <goal>testCompile</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <target>${maven.compiler.target}</target>
        <source>${maven.compiler.source}</source>
        <encoding>${project.build.sourceEncoding}</encoding>
    </configuration>
</plugin>

````


text:
import platform

import nova.context
import nova.db
from nova.image import glance
from nova.network import minidns
from nova.openstack.common import cfg

CONF = cfg.CONF
CONF.import_opt('use_ipv6', 'nova.config')

def get_test_admin_context():
    return nova.context.get_admin_context()

def get_test_image_info(context, instance_ref):
    if not context:
        context = get_test_admin_context()

    image_ref = instance_ref['image_ref']
    image_service, image_id = glance.get_remote_image_service(context,
                                                              image_ref)
    return image_service.show(context, image_id)

def get_test_instance_type(context=None):
    if not context:
        context = get_test_admin_context()

    test_instance_type = {'name': 'kinda.big',
                          'flavorid': 'someid',
                          'memory_mb': 2048,
                          'vcpus': 4,
                          'root_gb': 40,
                          'ephemeral_gb': 80,
                          'swap': 1024}

    instance_type_ref = nova.db.instance_type_create(context,
            test_instance_type)
    return instance_type_ref

def get_test_instance(context=None):
    if not context:
        context = get_test_admin_context()

    test_instance = {'memory_kb': '1024000',
                     'basepath': '/some/path',
                     'bridge_name': 'br100',
                     'vcpus': 2,
                     'root_gb': 10,
                     'project_id': 'fake',
                     'bridge': 'br101',
                     'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175',
                     'instance_type_id': '5'}  # m1.small

    instance_ref = nova.db.instance_create(context, test_instance)
    return instance_ref

def get_test_network_info(count=1):
    ipv6 = CONF.use_ipv6
    fake = 'fake'
    fake_ip = '0.0.0.0/0'
    fake_ip_2 = '0.0.0.1/0'
    fake_ip_3 = '0.0.0.1/0'
    fake_vlan = 100
    fake_bridge_interface = 'eth0'
    network = {'bridge': fake,
               'cidr': fake_ip,
               'cidr_v6': fake_ip,
               'vlan': fake_vlan,
               'bridge_interface': fake_bridge_interface,
               'injected': False}
    mapping = {'mac': fake,
               'dhcp_server': fake,
               'gateway': fake,
               'gateway_v6': fake,
               'ips': [{'ip': fake_ip}, {'ip': fake_ip}]}
    if ipv6:
        mapping['ip6s'] = [{'ip': fake_ip},
                           {'ip': fake_ip_2},
                           {'ip': fake_ip_3}]
    return [(network, mapping) for x in xrange(0, count)]

def is_osx():
    return platform.mac_ver()[0] != ''

test_dns_managers = []

def dns_manager():
    global test_dns_managers
    manager = minidns.MiniDNS()
    test_dns_managers.append(manager)
    return manager

def cleanup_dns_managers():
    global test_dns_managers
    for manager in test_dns_managers:
        manager.delete_dns_file()
    test_dns_managers = []


text:
#include "core/workers/DedicatedWorkerThread.h"

#include "core/workers/DedicatedWorkerGlobalScope.h"
#include "core/workers/InProcessWorkerObjectProxy.h"
#include "core/workers/WorkerBackingThread.h"
#include "core/workers/WorkerThreadStartupData.h"
#include "wtf/PtrUtil.h"
#include <memory>

namespace blink {

std::unique_ptr<DedicatedWorkerThread> DedicatedWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin)
{
    return wrapUnique(new DedicatedWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin));
}

DedicatedWorkerThread::DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin)
    : WorkerThread(workerLoaderProxy, workerObjectProxy)
    , m_workerBackingThread(WorkerBackingThread::create("DedicatedWorker Thread"))
    , m_workerObjectProxy(workerObjectProxy)
    , m_timeOrigin(timeOrigin)
{
}

DedicatedWorkerThread::~DedicatedWorkerThread()
{
}

WorkerOrWorkletGlobalScope* DedicatedWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData)
{
    return DedicatedWorkerGlobalScope::create(this, std::move(startupData), m_timeOrigin);
}

void DedicatedWorkerThread::postInitialize()
{
    // Notify the parent object of our current active state before the event
    // loop starts processing tasks.
    m_workerObjectProxy.reportPendingActivity(false);
}

} // namespace blink


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.docs.v1.model;

/**
 * Represents the styling that can be applied to text.
 *
 * Inherited text styles are represented as unset fields in this message. A text style's parent
 * depends on where the text style is defined:
 *
 *   * The TextStyle of text in a Paragraph     inherits from the paragraph's corresponding named
 * style type.   * The TextStyle on a named style     inherits from the normal text named style.   *
 * The TextStyle of the normal text named style inherits     from the default text style in the Docs
 * editor.   * The TextStyle on a Paragraph element     that is contained in a table may inherit its
 * text style from the table     style.
 *
 * If the text style does not inherit from a parent, unsetting fields will revert the style to a
 * value matching the defaults in the Docs editor.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Google Docs API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class TextStyle extends com.google.api.client.json.GenericJson {

  /**
   * The background color of the text. If set, the color is either an RGB color or transparent,
   * depending on the `color` field.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private OptionalColor backgroundColor;

  /**
   * The text's vertical offset from its normal position.
   *
   * Text with `SUPERSCRIPT` or `SUBSCRIPT` baseline offsets is automatically rendered in a smaller
   * font size, computed based on the `font_size` field. The `font_size` itself is not affected by
   * changes in this field.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String baselineOffset;

  /**
   * Whether or not the text is rendered as bold.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean bold;

  /**
   * The size of the text's font.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Dimension fontSize;

  /**
   * The foreground color of the text. If set, the color is either an RGB color or transparent,
   * depending on the `color` field.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private OptionalColor foregroundColor;

  /**
   * Whether or not the text is italicized.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean italic;

  /**
   * The hyperlink destination of the text. If unset, there is no link. Links are not inherited from
   * parent text.
   *
   * Changing the link in an update request causes some other changes to the text style of the
   * range:
   *
   * * When setting a link, the text foreground color will be updated to the   default link color
   * and the text will be underlined. If these fields are   modified in the same request, those
   * values will be used instead of the   link defaults. * Setting a link on a text range that
   * overlaps with an existing link will   also update the existing link to point to the new URL. *
   * Links are not settable on newline characters. As a result, setting a link   on a text range
   * that crosses a paragraph boundary, such as `"ABC\n123"`,   will separate the newline
   * character(s) into their own text runs. The   link will be applied separately to the runs before
   * and after the newline. * Removing a link will update the text style of the range to match the
   * style of the preceding text (or the default text styles if the preceding   text is another
   * link) unless different styles are being set in the same   request.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Link link;

  /**
   * Whether or not the text is in small capital letters.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean smallCaps;

  /**
   * Whether or not the text is struck through.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean strikethrough;

  /**
   * Whether or not the text is underlined.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean underline;

  /**
   * The font family and rendered weight of the text.
   *
   * If an update request specifies values for both `weighted_font_family` and `bold`, the
   * `weighted_font_family` is applied first, then `bold`.
   *
   * If `weighted_font_family#weight` is not set, it defaults to `400`.
   *
   * If `weighted_font_family` is set, then `weighted_font_family#font_family` must also be set with
   * a non-empty value. Otherwise, a 400 bad request error is returned.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private WeightedFontFamily weightedFontFamily;

  /**
   * The background color of the text. If set, the color is either an RGB color or transparent,
   * depending on the `color` field.
   * @return value or {@code null} for none
   */
  public OptionalColor getBackgroundColor() {
    return backgroundColor;
  }

  /**
   * The background color of the text. If set, the color is either an RGB color or transparent,
   * depending on the `color` field.
   * @param backgroundColor backgroundColor or {@code null} for none
   */
  public TextStyle setBackgroundColor(OptionalColor backgroundColor) {
    this.backgroundColor = backgroundColor;
    return this;
  }

  /**
   * The text's vertical offset from its normal position.
   *
   * Text with `SUPERSCRIPT` or `SUBSCRIPT` baseline offsets is automatically rendered in a smaller
   * font size, computed based on the `font_size` field. The `font_size` itself is not affected by
   * changes in this field.
   * @return value or {@code null} for none
   */
  public java.lang.String getBaselineOffset() {
    return baselineOffset;
  }

  /**
   * The text's vertical offset from its normal position.
   *
   * Text with `SUPERSCRIPT` or `SUBSCRIPT` baseline offsets is automatically rendered in a smaller
   * font size, computed based on the `font_size` field. The `font_size` itself is not affected by
   * changes in this field.
   * @param baselineOffset baselineOffset or {@code null} for none
   */
  public TextStyle setBaselineOffset(java.lang.String baselineOffset) {
    this.baselineOffset = baselineOffset;
    return this;
  }

  /**
   * Whether or not the text is rendered as bold.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getBold() {
    return bold;
  }

  /**
   * Whether or not the text is rendered as bold.
   * @param bold bold or {@code null} for none
   */
  public TextStyle setBold(java.lang.Boolean bold) {
    this.bold = bold;
    return this;
  }

  /**
   * The size of the text's font.
   * @return value or {@code null} for none
   */
  public Dimension getFontSize() {
    return fontSize;
  }

  /**
   * The size of the text's font.
   * @param fontSize fontSize or {@code null} for none
   */
  public TextStyle setFontSize(Dimension fontSize) {
    this.fontSize = fontSize;
    return this;
  }

  /**
   * The foreground color of the text. If set, the color is either an RGB color or transparent,
   * depending on the `color` field.
   * @return value or {@code null} for none
   */
  public OptionalColor getForegroundColor() {
    return foregroundColor;
  }

  /**
   * The foreground color of the text. If set, the color is either an RGB color or transparent,
   * depending on the `color` field.
   * @param foregroundColor foregroundColor or {@code null} for none
   */
  public TextStyle setForegroundColor(OptionalColor foregroundColor) {
    this.foregroundColor = foregroundColor;
    return this;
  }

  /**
   * Whether or not the text is italicized.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getItalic() {
    return italic;
  }

  /**
   * Whether or not the text is italicized.
   * @param italic italic or {@code null} for none
   */
  public TextStyle setItalic(java.lang.Boolean italic) {
    this.italic = italic;
    return this;
  }

  /**
   * The hyperlink destination of the text. If unset, there is no link. Links are not inherited from
   * parent text.
   *
   * Changing the link in an update request causes some other changes to the text style of the
   * range:
   *
   * * When setting a link, the text foreground color will be updated to the   default link color
   * and the text will be underlined. If these fields are   modified in the same request, those
   * values will be used instead of the   link defaults. * Setting a link on a text range that
   * overlaps with an existing link will   also update the existing link to point to the new URL. *
   * Links are not settable on newline characters. As a result, setting a link   on a text range
   * that crosses a paragraph boundary, such as `"ABC\n123"`,   will separate the newline
   * character(s) into their own text runs. The   link will be applied separately to the runs before
   * and after the newline. * Removing a link will update the text style of the range to match the
   * style of the preceding text (or the default text styles if the preceding   text is another
   * link) unless different styles are being set in the same   request.
   * @return value or {@code null} for none
   */
  public Link getLink() {
    return link;
  }

  /**
   * The hyperlink destination of the text. If unset, there is no link. Links are not inherited from
   * parent text.
   *
   * Changing the link in an update request causes some other changes to the text style of the
   * range:
   *
   * * When setting a link, the text foreground color will be updated to the   default link color
   * and the text will be underlined. If these fields are   modified in the same request, those
   * values will be used instead of the   link defaults. * Setting a link on a text range that
   * overlaps with an existing link will   also update the existing link to point to the new URL. *
   * Links are not settable on newline characters. As a result, setting a link   on a text range
   * that crosses a paragraph boundary, such as `"ABC\n123"`,   will separate the newline
   * character(s) into their own text runs. The   link will be applied separately to the runs before
   * and after the newline. * Removing a link will update the text style of the range to match the
   * style of the preceding text (or the default text styles if the preceding   text is another
   * link) unless different styles are being set in the same   request.
   * @param link link or {@code null} for none
   */
  public TextStyle setLink(Link link) {
    this.link = link;
    return this;
  }

  /**
   * Whether or not the text is in small capital letters.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getSmallCaps() {
    return smallCaps;
  }

  /**
   * Whether or not the text is in small capital letters.
   * @param smallCaps smallCaps or {@code null} for none
   */
  public TextStyle setSmallCaps(java.lang.Boolean smallCaps) {
    this.smallCaps = smallCaps;
    return this;
  }

  /**
   * Whether or not the text is struck through.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getStrikethrough() {
    return strikethrough;
  }

  /**
   * Whether or not the text is struck through.
   * @param strikethrough strikethrough or {@code null} for none
   */
  public TextStyle setStrikethrough(java.lang.Boolean strikethrough) {
    this.strikethrough = strikethrough;
    return this;
  }

  /**
   * Whether or not the text is underlined.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getUnderline() {
    return underline;
  }

  /**
   * Whether or not the text is underlined.
   * @param underline underline or {@code null} for none
   */
  public TextStyle setUnderline(java.lang.Boolean underline) {
    this.underline = underline;
    return this;
  }

  /**
   * The font family and rendered weight of the text.
   *
   * If an update request specifies values for both `weighted_font_family` and `bold`, the
   * `weighted_font_family` is applied first, then `bold`.
   *
   * If `weighted_font_family#weight` is not set, it defaults to `400`.
   *
   * If `weighted_font_family` is set, then `weighted_font_family#font_family` must also be set with
   * a non-empty value. Otherwise, a 400 bad request error is returned.
   * @return value or {@code null} for none
   */
  public WeightedFontFamily getWeightedFontFamily() {
    return weightedFontFamily;
  }

  /**
   * The font family and rendered weight of the text.
   *
   * If an update request specifies values for both `weighted_font_family` and `bold`, the
   * `weighted_font_family` is applied first, then `bold`.
   *
   * If `weighted_font_family#weight` is not set, it defaults to `400`.
   *
   * If `weighted_font_family` is set, then `weighted_font_family#font_family` must also be set with
   * a non-empty value. Otherwise, a 400 bad request error is returned.
   * @param weightedFontFamily weightedFontFamily or {@code null} for none
   */
  public TextStyle setWeightedFontFamily(WeightedFontFamily weightedFontFamily) {
    this.weightedFontFamily = weightedFontFamily;
    return this;
  }

  @Override
  public TextStyle set(String fieldName, Object value) {
    return (TextStyle) super.set(fieldName, value);
  }

  @Override
  public TextStyle clone() {
    return (TextStyle) super.clone();
  }

}


text:
    <% include ../partials/head.html %>

    <% include ./partials/head.html %>

    <meta name="description" content="Meta description">

    <% include ./partials/left-rail.html %>

Introduction

          Chips can be used to represent small blocks of information. They are most commonly used either for contacts or for tags.

          Jane Doe

          Tag
          close

Contacts

          To create a contact chip just add an img inside.

  <div class="chip">
    <img src="http://lorempixel.com/150/150/abstract/" alt="Contact Person">
    Jane Doe
  </div>

Tags

          To create a tag chip just add an close icon inside.

  <div class="chip">
    Tag
    <i class="material-icons">close</i>
  </div>

Contacts

Tags

    <% include ../partials/footerScripts.html %>
    <% include ../partials/footerScripts-styleguide.html %>


text:
begin;
insert into sys.version(number,comment) values(112,'More fields for CDR data type');

ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE src_prefix_in character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE src_prefix_out character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE dst_prefix_in character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE dst_prefix_out character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE destination_initial_interval integer;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE destination_next_interval integer;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE destination_initial_rate numeric;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE orig_call_id character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE term_call_id character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE local_tag character varying;
ALTER TYPE billing.cdr_v2
    ADD ATTRIBUTE from_domain character varying;

commit;


text:
from distutils.core import setup
setup(
    name='py_trace_event',
    packages=['trace_event_impl'],
    version='0.1.0',
    description='Performance tracing for python',
    author='Nat Duca'
)


text:
class Keg
  def change_dylib_id(id, file)
    return if file.dylib_id == id

    @require_relocation = true
    odebug "Changing dylib ID of #{file}\n  from #{file.dylib_id}\n    to #{id}"
    MachO::Tools.change_dylib_id(file, id, strict: false)
    apply_ad_hoc_signature(file)
  rescue MachO::MachOError
    onoe <<~EOS
      Failed changing dylib ID of #{file}
        from #{file.dylib_id}
          to #{id}
    EOS
    raise
  end

  def change_install_name(old, new, file)
    return if old == new

    @require_relocation = true
    odebug "Changing install name in #{file}\n  from #{old}\n    to #{new}"
    MachO::Tools.change_install_name(file, old, new, strict: false)
    apply_ad_hoc_signature(file)
  rescue MachO::MachOError
    onoe <<~EOS
      Failed changing install name in #{file}
        from #{old}
          to #{new}
    EOS
    raise
  end

  def change_rpath(old, new, file)
    return if old == new

    @require_relocation = true
    odebug "Changing rpath in #{file}\n  from #{old}\n    to #{new}"
    MachO::Tools.change_rpath(file, old, new, strict: false)
    apply_ad_hoc_signature(file)
  rescue MachO::MachOError
    onoe <<~EOS
      Failed changing rpath in #{file}
        from #{old}
          to #{new}
    EOS
    raise
  end

  def delete_rpath(rpath, file)
    odebug "Deleting rpath #{rpath} in #{file}"
    MachO::Tools.delete_rpath(file, rpath, strict: false)
    apply_ad_hoc_signature(file)
  rescue MachO::MachOError
    onoe <<~EOS
      Failed deleting rpath #{rpath} in #{file}
    EOS
    raise
  end

  def apply_ad_hoc_signature(file)
    return if MacOS.version < :big_sur
    return unless Hardware::CPU.arm?

    odebug "Codesigning #{file}"
    # Use quiet_system to squash notifications about resigning binaries
    # which already have valid signatures.
    return if quiet_system("codesign", "--sign", "-", "--force",
                           "--preserve-metadata=entitlements,requirements,flags,runtime",
                           file)

    # If the codesigning fails, it may be a bug in Apple's codesign utility
    # A known workaround is to copy the file to another inode, then move it back
    # erasing the previous file. Then sign again.
    #
    # TODO: remove this once the bug in Apple's codesign utility is fixed
    Dir::Tmpname.create("workaround") do |tmppath|
      FileUtils.cp file, tmppath
      FileUtils.mv tmppath, file, force: true
    end

    # Try signing again
    odebug "Codesigning (2nd try) #{file}"
    result = system_command("codesign", args: [
      "--sign", "-", "--force",
      "--preserve-metadata=entitlements,requirements,flags,runtime",
      file
    ], print_stderr: false)
    return if result.success?

    # If it fails again, error out
    onoe <<~EOS
      Failed applying an ad-hoc signature to #{file}:
      #{result.stderr}
    EOS
  end
end


text:
import { combineReducers } from 'redux';
import session from './session';
import topic from './topic';
import actionTypes from '../../../shared/constants';

function error(state = '', action) {
  if (action.type === actionTypes.ERROR) {
    return action.error;
  }
  return state;
}

export default combineReducers({error, session, topic});


text:
/*

         ###
#  #  #########     _______ _     _  ______ _     _
##  ######## @ ##   |______ |     | |  ____ |     |
##################  |       |_____| |_____| |_____|
##  #############      f  r  a  m  e  w  o  r  k
#  #  #########
         ###

(c) 2015 - 2017 FUGU framework project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

using System;

namespace Fugu.EntityFrameworkCore.Internal
{
    internal class Inheritance
    {
        public Inheritance(Type parentEntityType, string discriminator, Type discriminatorType)
        {
            Contract.NotNull(parentEntityType, nameof(parentEntityType));
            Contract.Requires(parentEntityType.HasInheritance(), nameof(parentEntityType), "Parent entity type has no inheritance defined");
            Contract.NotNullOrWhiteSpace(discriminator, nameof(discriminator));
            Contract.NotNull(discriminatorType, nameof(parentEntityType));

            ParentEntityType = parentEntityType;
            Discriminator = discriminator;
            DiscriminatorType = discriminatorType;
            Descendants = new DescendantCollection(ParentEntityType);
        }

        public Type ParentEntityType { get; }

        public string Discriminator { get; }

        public Type DiscriminatorType { get; }

        public DescendantCollection Descendants { get; }
    }
}


text:
package com.hippo.stage.dialog;

/*
 * Created by Hippo on 5/3/2017.
 */

import android.support.annotation.NonNull;
import android.view.View;

/**
 * The dialog root view.
 * The view of {@link DialogScene} implements it.
 */
public interface DialogRoot {

  /**
   * Returns the dialog content.
   * <p>
   * The content is a view which uses {@link android.R.attr#windowBackground} as background.
   */
  @NonNull
  View getDialogContent();
}


text:
package com.nasageek.utexasutilities.adapters;

import android.content.Context;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.nasageek.utexasutilities.MyPair;
import com.nasageek.utexasutilities.R;
import com.nasageek.utexasutilities.model.BBClass;

import java.util.List;

public class BBClassAdapter extends StickyHeaderAdapter<BBClass> {
    private LayoutInflater li;
    private Boolean longform;

    public BBClassAdapter(Context con, List<MyPair<String, List<BBClass>>> objects) {
        super(objects);
        li = (LayoutInflater) con.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        longform = PreferenceManager.getDefaultSharedPreferences(con).getBoolean(
                "blackboard_class_longform", false);
    }

    @Override
    public boolean areAllItemsEnabled() {
        return true;
    }

    @Override
    public boolean isEnabled(int i) {
        return true;
    }

    @Override
    public View getAmazingView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        ViewGroup res = (ViewGroup) convertView;

        if (res == null) {
            res = (ViewGroup) li.inflate(R.layout.bbclass_item_view, parent, false);
            holder = new ViewHolder();
            holder.idview = (TextView) res.findViewById(R.id.bb_class_id);
            holder.nameview = (TextView) res.findViewById(R.id.bb_class_name);
            res.setTag(holder);
        } else {
            holder = (ViewHolder) res.getTag();
        }

        BBClass bbclass = getItem(position);
        String unique = "";

        if (!longform) {
            if (!bbclass.isFullCourseIdTooShort()) {
                if (bbclass.isCourseIdAvailable()) {
                    holder.idview
                            .setText(bbclass.getCourseId() + " - " + bbclass.getUnique() + " ");
                } else {
                    holder.idview.setText(bbclass.getUnique());
                }

            } else {
                holder.idview.setText(bbclass.getCourseId());
            }
        } else // probably not even necessary anymore, necessary checking is
               // done in the if-statement
        {
            unique = bbclass.getFullCourseid();
            // id not set because unique will contain ID and Unique number
            holder.idview.setText(unique);
        }

        holder.nameview.setText(bbclass.getName());

        return res;
    }

    class ViewHolder {
        TextView nameview;
        TextView idview;
    }
}


text:
package org.coalesce.coalescebot.command.executors.misc

import org.coalesce.coalescebot._
import org.coalesce.coalescebot.command.{BotCommand, CommandContext}

object PingCommand extends BotCommand {

  override val name: String = "ping"
  override val aliases: Set[String] = Set.empty[String]
  override val desc: String = "Just a simple ping command"

  //TODO: Add more to this
  override def execute(context: CommandContext): Unit = {
    context.channel.sendFancyMessage(title = "Pong! :ping_pong:").queue()
  }
}


text:
@interface EGORefreshTableHeaderView (Helper)

-(void)setFrame:(CGRect)frame;

@end


text:
require "spec_helper"

RSpec.describe Doorkeeper::Config do
  subject(:config) { Doorkeeper.config }

  describe "resource_owner_authenticator" do
    it "sets the block that is accessible via authenticate_resource_owner" do
      block = proc {}
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        resource_owner_authenticator(&block)
      end

      expect(config.authenticate_resource_owner).to eq(block)
    end

    it "prints warning message by default" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
      end

      expect(Rails.logger).to receive(:warn).with(
        I18n.t("doorkeeper.errors.messages.resource_owner_authenticator_not_configured"),
      )
      config.authenticate_resource_owner.call(nil)
    end
  end

  describe "resource_owner_from_credentials" do
    it "sets the block that is accessible via authenticate_resource_owner" do
      block = proc {}
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        resource_owner_from_credentials(&block)
      end

      expect(config.resource_owner_from_credentials).to eq(block)
    end

    it "prints warning message by default" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
      end

      expect(Rails.logger).to receive(:warn).with(
        I18n.t("doorkeeper.errors.messages.credential_flow_not_configured"),
      )
      config.resource_owner_from_credentials.call(nil)
    end
  end

  describe "setup_orm_adapter" do
    it "adds specific error message to NameError exception" do
      expect do
        Doorkeeper.configure { orm "hibernate" }
      end.to raise_error(NameError, /ORM adapter not found \(hibernate\)/)
    end

    it "does not change other exceptions" do
      allow(Doorkeeper).to receive(:setup_orm_adapter) { raise NoMethodError }

      expect do
        Doorkeeper.configure { orm "hibernate" }
      end.to raise_error(NoMethodError)
    end
  end

  describe "admin_authenticator" do
    it "sets the block that is accessible via authenticate_admin" do
      default_behaviour = "default behaviour"
      allow(described_class).to receive(:head).and_return(default_behaviour)

      Doorkeeper.configure do
        orm DOORKEEPER_ORM
      end

      expect(config.authenticate_admin.call({})).to eq(default_behaviour)
    end

    it "could be customized with a block" do
      block = proc {}
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        admin_authenticator(&block)
      end

      expect(config.authenticate_admin).to eq(block)
    end
  end

  describe "access_token_expires_in" do
    it "has 2 hours by default" do
      expect(config.access_token_expires_in).to eq(2.hours)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        access_token_expires_in 4.hours
      end
      expect(config.access_token_expires_in).to eq(4.hours)
    end

    it "can be set to nil" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        access_token_expires_in nil
      end

      expect(config.access_token_expires_in).to be_nil
    end
  end

  describe "scopes" do
    it "has default scopes" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        default_scopes :public
      end

      expect(config.default_scopes).to include("public")
    end

    it "has optional scopes" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        optional_scopes :write, :update
      end

      expect(config.optional_scopes).to include("write", "update")
    end

    it "has all scopes" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        default_scopes :normal
        optional_scopes :admin
      end

      expect(config.scopes).to include("normal", "admin")
    end
  end

  describe "scopes_by_grant_type" do
    it "is {} by default" do
      expect(config.scopes_by_grant_type).to eq({})
    end

    it "has hash value" do
      hash = {}
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        scopes_by_grant_type hash
      end

      expect(config.scopes_by_grant_type).to eq(hash)
    end
  end

  describe "use_refresh_token" do
    it "is false by default" do
      expect(config.refresh_token_enabled?).to eq(false)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        use_refresh_token
      end

      expect(config.refresh_token_enabled?).to eq(true)
    end

    it "can accept a boolean parameter" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        use_refresh_token false
      end

      expect(config.refresh_token_enabled?).to eq(false)
    end

    it "can accept a block parameter" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        use_refresh_token { |_context| nil }
      end

      expect(config.refresh_token_enabled?).to be_a(Proc)
    end

    it "does not includes 'refresh_token' in token_grant_flows" do
      expect(config.token_grant_flows).not_to include Doorkeeper::GrantFlow.get("refresh_token")
    end

    context "when enabled" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          use_refresh_token
        end
      end

      it "includes 'refresh_token' in token_grant_flows" do
        expect(config.token_grant_flows).to include Doorkeeper::GrantFlow.get("refresh_token")
      end
    end
  end

  describe "token_reuse_limit" do
    it "is 100 by default" do
      expect(config.token_reuse_limit).to eq(100)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        token_reuse_limit 90
      end

      expect(config.token_reuse_limit).to eq(90)
    end

    it "sets the value to 100 if invalid value is being set" do
      expect(Rails.logger).to receive(:warn).with(/will be set to default 100/)

      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        reuse_access_token
        token_reuse_limit 110
      end

      expect(config.token_reuse_limit).to eq(100)
    end
  end

  describe "enforce_configured_scopes" do
    it "is false by default" do
      expect(config.enforce_configured_scopes?).to eq(false)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        enforce_configured_scopes
      end

      expect(config.enforce_configured_scopes?).to eq(true)
    end
  end

  describe "client_credentials" do
    it "has defaults order" do
      expect(config.client_credentials_methods)
        .to eq(%i[from_basic from_params])
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        client_credentials :from_digest, :from_params
      end

      expect(config.client_credentials_methods)
        .to eq(%i[from_digest from_params])
    end
  end

  describe "force_ssl_in_redirect_uri" do
    it "is true by default in non-development environments" do
      expect(config.force_ssl_in_redirect_uri).to eq(true)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        force_ssl_in_redirect_uri(false)
      end

      expect(config.force_ssl_in_redirect_uri).to eq(false)
    end

    it "can be a callable object" do
      block = proc { false }
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        force_ssl_in_redirect_uri(&block)
      end

      expect(config.force_ssl_in_redirect_uri).to eq(block)
      expect(config.force_ssl_in_redirect_uri.call).to eq(false)
    end
  end

  describe "access_token_methods" do
    it "has defaults order" do
      expect(config.access_token_methods)
        .to eq(%i[from_bearer_authorization from_access_token_param from_bearer_param])
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        access_token_methods :from_access_token_param, :from_bearer_param
      end

      expect(config.access_token_methods)
        .to eq(%i[from_access_token_param from_bearer_param])
    end
  end

  describe "forbid_redirect_uri" do
    it "is false by default" do
      expect(config.forbid_redirect_uri.call(URI.parse("https://localhost"))).to eq(false)
    end

    it "can be a callable object" do
      block = proc { true }
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        forbid_redirect_uri(&block)
      end

      expect(config.forbid_redirect_uri).to eq(block)
      expect(config.forbid_redirect_uri.call).to eq(true)
    end
  end

  describe "enable_application_owner" do
    it "is disabled by default" do
      expect(Doorkeeper.config.enable_application_owner?).not_to eq(true)
    end

    context "when enabled without confirmation" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          enable_application_owner
        end
      end

      it "adds support for application owner" do
        expect(Doorkeeper::Application.new).to respond_to :owner
      end

      it "Doorkeeper.configuration.confirm_application_owner? returns false" do
        expect(Doorkeeper.config.confirm_application_owner?).not_to eq(true)
      end
    end

    context "when enabled with confirmation set to true" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          enable_application_owner confirmation: true
        end
      end

      it "adds support for application owner" do
        expect(Doorkeeper::Application.new).to respond_to :owner
      end

      it "Doorkeeper.configuration.confirm_application_owner? returns true" do
        expect(Doorkeeper.config.confirm_application_owner?).to eq(true)
      end
    end
  end

  describe "realm" do
    it "is 'Doorkeeper' by default" do
      expect(Doorkeeper.config.realm).to eq("Doorkeeper")
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        realm "Example"
      end

      expect(config.realm).to eq("Example")
    end
  end

  describe "grant_flows" do
    it "is set to all grant flows by default" do
      expect(Doorkeeper.config.grant_flows)
        .to eq(%w[authorization_code client_credentials])
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        grant_flows %w[authorization_code implicit]
      end

      expect(config.grant_flows).to eq %w[authorization_code implicit]
    end

    context "when including 'authorization_code'" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          grant_flows ["authorization_code"]
        end
      end

      it "includes 'authorization_code' in authorization_response_flows" do
        expect(config.authorization_response_flows).to include Doorkeeper::GrantFlow.get("authorization_code")
      end

      it "includes 'authorization_code' in token_grant_flows" do
        expect(config.token_grant_flows).to include Doorkeeper::GrantFlow.get("authorization_code")
      end
    end

    context "when including 'implicit'" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          grant_flows ["implicit"]
        end
      end

      it "includes 'implicit' in authorization_response_flows" do
        expect(config.authorization_response_flows).to include Doorkeeper::GrantFlow.get("implicit")
      end
    end

    context "when including 'password'" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          grant_flows ["password"]
        end
      end

      it "includes 'password' in token_grant_flows" do
        expect(config.token_grant_flows).to include Doorkeeper::GrantFlow.get("password")
      end
    end

    context "when including 'client_credentials'" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          grant_flows ["client_credentials"]
        end
      end

      it "includes 'client_credentials' in token_grant_flows" do
        expect(config.token_grant_flows).to include Doorkeeper::GrantFlow.get("client_credentials")
      end
    end
  end

  it "raises an exception when configuration is not set" do
    old_config = Doorkeeper.config
    Doorkeeper.module_eval do
      @config = nil
    end

    expect do
      Doorkeeper.config
    end.to raise_error Doorkeeper::MissingConfiguration

    Doorkeeper.module_eval do
      @config = old_config
    end
  end

  describe "access_token_generator" do
    it "is 'Doorkeeper::OAuth::Helpers::UniqueToken' by default" do
      expect(Doorkeeper.configuration.access_token_generator).to(
        eq("Doorkeeper::OAuth::Helpers::UniqueToken"),
      )
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        access_token_generator "Example"
      end
      expect(config.access_token_generator).to eq("Example")
    end
  end

  describe "default_generator_method" do
    it "is :urlsafe_base64 by default" do
      expect(Doorkeeper.configuration.default_generator_method)
        .to eq(:urlsafe_base64)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        default_generator_method :hex
      end

      expect(config.default_generator_method).to eq(:hex)
    end
  end

  describe "base_controller" do
    context "when default value set" do
      it { expect(Doorkeeper.configuration.base_controller).to be_an_instance_of(Proc) }

      it "resolves to a ApplicationController::Base in default mode" do
        expect(Doorkeeper.configuration.resolve_controller(:base))
          .to eq(ActionController::Base)
      end

      it "resolves to a ApplicationController::API in api_only mode" do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          api_only
        end

        expect(Doorkeeper.configuration.resolve_controller(:base))
          .to eq(ActionController::API)
      end
    end

    context "when custom value set" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          base_controller "ApplicationController"
        end
      end

      it { expect(Doorkeeper.config.base_controller).to eq("ApplicationController") }
    end
  end

  describe "base_metal_controller" do
    context "when default value set" do
      it { expect(Doorkeeper.config.base_metal_controller).to eq("ActionController::API") }
    end

    context "when custom value set" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          base_metal_controller { "ApplicationController" }
        end
      end

      it { expect(Doorkeeper.configuration.resolve_controller(:base_metal)).to eq(ApplicationController) }
    end
  end

  if DOORKEEPER_ORM == :active_record
    class FakeCustomModel; end

    describe "active_record_options" do
      let(:models) { [Doorkeeper::AccessGrant, Doorkeeper::AccessToken, Doorkeeper::Application] }

      before do
        models.each do |model|
          allow(model).to receive(:establish_connection).and_return(true)
        end
      end

      it "establishes connection for Doorkeeper models based on options" do
        expect(models).to all(receive(:establish_connection))

        expect(Kernel).to receive(:warn).with(
          /\[DOORKEEPER\] active_record_options has been deprecated and will soon be removed/,
        )

        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          active_record_options(
            establish_connection: Rails.configuration.database_configuration[Rails.env],
          )
        end
      end
    end

    describe "access_token_class" do
      it "uses default doorkeeper value" do
        expect(config.access_token_class).to eq("Doorkeeper::AccessToken")
        expect(config.access_token_model).to be(Doorkeeper::AccessToken)
      end

      it "can change the value" do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          access_token_class "FakeCustomModel"
        end

        expect(config.access_token_class).to eq("FakeCustomModel")
        expect(config.access_token_model).to be(FakeCustomModel)
      end
    end

    describe "access_grant_class" do
      it "uses default doorkeeper value" do
        expect(config.access_grant_class).to eq("Doorkeeper::AccessGrant")
        expect(config.access_grant_model).to be(Doorkeeper::AccessGrant)
      end

      it "can change the value" do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          access_grant_class "FakeCustomModel"
        end

        expect(config.access_grant_class).to eq("FakeCustomModel")
        expect(config.access_grant_model).to be(FakeCustomModel)
      end
    end

    describe "application_class" do
      it "uses default doorkeeper value" do
        expect(config.application_class).to eq("Doorkeeper::Application")
        expect(config.application_model).to be(Doorkeeper::Application)
      end

      it "can change the value" do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          application_class "FakeCustomModel"
        end

        expect(config.application_class).to eq("FakeCustomModel")
        expect(config.application_model).to be(FakeCustomModel)
      end
    end
  end

  describe "api_only" do
    it "is false by default" do
      expect(config.api_only).to eq(false)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        api_only
      end

      expect(config.api_only).to eq(true)
    end
  end

  describe "token_lookup_batch_size" do
    it "uses default doorkeeper value" do
      expect(config.token_lookup_batch_size).to eq(10_000)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        token_lookup_batch_size 100_000
      end

      expect(config.token_lookup_batch_size).to eq(100_000)
    end
  end

  describe "strict_content_type" do
    it "is false by default" do
      expect(config.enforce_content_type).to eq(false)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        enforce_content_type
      end

      expect(config.enforce_content_type).to eq(true)
    end
  end

  describe "handle_auth_errors" do
    it "is set to render by default" do
      expect(Doorkeeper.config.handle_auth_errors).to eq(:render)
    end

    it "can change the value" do
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        handle_auth_errors :raise
      end
      expect(config.handle_auth_errors).to eq(:raise)
    end
  end

  describe "token_secret_strategy" do
    it "is plain by default" do
      expect(config.token_secret_strategy).to eq(Doorkeeper::SecretStoring::Plain)
      expect(config.token_secret_fallback_strategy).to eq(nil)
    end

    context "when provided" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          hash_token_secrets
        end
      end

      it "will enable hashing for applications" do
        expect(config.token_secret_strategy).to eq(Doorkeeper::SecretStoring::Sha256Hash)
        expect(config.token_secret_fallback_strategy).to eq(nil)
      end
    end

    context "when manually provided with invalid constant" do
      it "raises an exception" do
        expect do
          Doorkeeper.configure do
            orm DOORKEEPER_ORM
            hash_token_secrets using: "does not exist"
          end
        end.to raise_error(NameError)
      end
    end

    context "when manually provided with invalid option" do
      it "raises an exception" do
        expect do
          Doorkeeper.configure do
            orm DOORKEEPER_ORM
            hash_token_secrets using: "Doorkeeper::SecretStoring::BCrypt"
          end
        end.to raise_error(
          ArgumentError,
          /can only be used for storing application secrets/,
        )
      end
    end

    context "when provided with fallback" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          hash_token_secrets fallback: :plain
        end
      end

      it "will enable hashing for applications" do
        expect(config.token_secret_strategy).to eq(Doorkeeper::SecretStoring::Sha256Hash)
        expect(config.token_secret_fallback_strategy).to eq(Doorkeeper::SecretStoring::Plain)
      end
    end

    describe "hash_token_secrets together with reuse_access_token" do
      it "will disable reuse_access_token" do
        expect(Rails.logger).to receive(:warn).with(/reuse_access_token will be disabled/)

        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          reuse_access_token
          hash_token_secrets
        end

        expect(config.reuse_access_token).to eq(false)
      end
    end
  end

  describe "application_secret_strategy" do
    it "is plain by default" do
      expect(config.application_secret_strategy).to eq(Doorkeeper::SecretStoring::Plain)
      expect(config.application_secret_fallback_strategy).to eq(nil)
    end

    context "when provided" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          hash_application_secrets
        end
      end

      it "will enable hashing for applications" do
        expect(config.application_secret_strategy).to eq(Doorkeeper::SecretStoring::Sha256Hash)
        expect(config.application_secret_fallback_strategy).to eq(nil)
      end
    end

    context "when manually provided with invalid constant" do
      it "raises an exception" do
        expect do
          Doorkeeper.configure do
            orm DOORKEEPER_ORM
            hash_application_secrets using: "does not exist"
          end
        end.to raise_error(NameError)
      end
    end

    context "when provided with fallback" do
      before do
        Doorkeeper.configure do
          orm DOORKEEPER_ORM
          hash_application_secrets fallback: :plain
        end
      end

      it "will enable hashing for applications" do
        expect(config.application_secret_strategy).to eq(Doorkeeper::SecretStoring::Sha256Hash)
        expect(config.application_secret_fallback_strategy).to eq(Doorkeeper::SecretStoring::Plain)
      end
    end
  end

  describe "options deprecation" do
    it "prints a warning message when an option is deprecated" do
      expect(Kernel).to receive(:warn).with(
        /\[DOORKEEPER\] native_redirect_uri has been deprecated and will soon be removed/,
      )
      Doorkeeper.configure do
        orm DOORKEEPER_ORM
        native_redirect_uri "urn:ietf:wg:oauth:2.0:oob"
      end
    end
  end
end