_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q170400
JsonPath.get
test
public <T> T get(String path) { final JSONAssertion jsonAssertion = createJsonAssertion(path, params); final Object json = jsonParser.parseWith(createConfigurableJsonSlurper()); return (T) jsonAssertion.getResult(json, null); }
java
{ "resource": "" }
q170401
JsonPath.getInt
test
public int getInt(String path) { //The type returned from Groovy depends on the input, so we need to handle different numerical types. Object value = get(path); if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Short) { return ((S...
java
{ "resource": "" }
q170402
JsonPath.getByte
test
public byte getByte(String path) { //The type returned from Groovy depends on the input, so we need to handle different numerical types. Object value = get(path); if (value instanceof Byte) { return (Byte) value; } else if (value instanceof Long) { return ((Long) ...
java
{ "resource": "" }
q170403
JsonPath.getShort
test
public short getShort(String path) { //The type returned from Groovy depends on the input, so we need to handle different numerical types. Object value = get(path); if (value instanceof Short) { return (Short) value; } else if (value instanceof Long) { return ((Lo...
java
{ "resource": "" }
q170404
JsonPath.getFloat
test
public float getFloat(String path) { final Object value = get(path); //Groovy will always return a Double for floating point values. if (value instanceof Double) { return ((Double) value).floatValue(); } else { return ObjectConverter.convertObjectTo(value, Float.c...
java
{ "resource": "" }
q170405
JsonPath.getDouble
test
public double getDouble(String path) { final Object value = get(path); if (value instanceof Double) { return (Double) value; } return ObjectConverter.convertObjectTo(value, Double.class); }
java
{ "resource": "" }
q170406
JsonPath.getLong
test
public long getLong(String path) { //The type returned from Groovy depends on the input, so we need to handle different numerical types. Object value = get(path); if (value instanceof Long) { return (Long) value; } else if (value instanceof Short) { return ((Short...
java
{ "resource": "" }
q170407
JsonPath.getList
test
public <T> List<T> getList(String path, Class<T> genericType) { if (genericType == null) { throw new IllegalArgumentException("Generic type cannot be null"); } final List<T> original = get(path); final List<T> newList = new LinkedList<T>(); if (original != null) { ...
java
{ "resource": "" }
q170408
JsonPath.getMap
test
public <K, V> Map<K, V> getMap(String path) { return get(path); }
java
{ "resource": "" }
q170409
XmlPath.getObject
test
public <T> T getObject(String path, Class<T> objectType) { Object object = getFromPath(path, false); return getObjectAsType(object, objectType); }
java
{ "resource": "" }
q170410
RequestSpecBuilder.setBody
test
public RequestSpecBuilder setBody(Object object, ObjectMapper mapper) { spec.body(object, mapper); return this; }
java
{ "resource": "" }
q170411
RequestSpecBuilder.addCookie
test
public RequestSpecBuilder addCookie(String key, Object value, Object... cookieNameValuePairs) { spec.cookie(key, value, cookieNameValuePairs); return this; }
java
{ "resource": "" }
q170412
RequestSpecBuilder.addParam
test
public RequestSpecBuilder addParam(String parameterName, Object... parameterValues) { spec.param(parameterName, parameterValues); return this; }
java
{ "resource": "" }
q170413
RequestSpecBuilder.addParam
test
public RequestSpecBuilder addParam(String parameterName, Collection<?> parameterValues) { spec.param(parameterName, parameterValues); return this; }
java
{ "resource": "" }
q170414
MockMvcParamConfig.formParamsUpdateStrategy
test
public MockMvcParamConfig formParamsUpdateStrategy(UpdateStrategy updateStrategy) { return new MockMvcParamConfig(queryParamsUpdateStrategy, updateStrategy, requestParameterUpdateStrategy, attributeUpdateStrategy, sessionUpdateStrategy, true); }
java
{ "resource": "" }
q170415
ResponseLoggingFilter.logResponseToIfMatches
test
public static Filter logResponseToIfMatches(PrintStream stream, Matcher<Integer> matcher) { return new ResponseLoggingFilter(stream, matcher); }
java
{ "resource": "" }
q170416
Cookies.cookies
test
public static Cookies cookies(Cookie cookie, Cookie... additionalCookies) { AssertParameter.notNull(cookie, "Cookie"); final List<Cookie> cookieList = new LinkedList<Cookie>(); cookieList.add(cookie); Collections.addAll(cookieList, additionalCookies); return new Cookies(cookieLis...
java
{ "resource": "" }
q170417
WeakKeySet.cleanUpForCollectedState
test
private void cleanUpForCollectedState(Set<KeyAndSource> keysAndSources) { synchronized (lock) { for (KeyAndSource keyAndSource : keysAndSources) { Multiset<Object> set = backingMap.get(keyAndSource.key); if (set != null) { set.remove(keyAndSource.source); if (set.isEmpty())...
java
{ "resource": "" }
q170418
InjectorImpl.index
test
void index() { for (Binding<?> binding : state.getExplicitBindingsThisLevel().values()) { bindingsMultimap.put(binding.getKey().getTypeLiteral(), binding); } }
java
{ "resource": "" }
q170419
InjectorImpl.getBindingOrThrow
test
<T> BindingImpl<T> getBindingOrThrow(Key<T> key, Errors errors, JitLimitation jitType) throws ErrorsException { // Check explicit bindings, i.e. bindings created by modules. BindingImpl<T> binding = state.getExplicitBinding(key); if (binding != null) { return binding; } // Look for an o...
java
{ "resource": "" }
q170420
InjectorImpl.convertConstantStringBinding
test
private <T> BindingImpl<T> convertConstantStringBinding(Key<T> key, Errors errors) throws ErrorsException { // Find a constant string binding. Key<String> stringKey = key.ofType(STRING_TYPE); BindingImpl<String> stringBinding = state.getExplicitBinding(stringKey); if (stringBinding == null || !str...
java
{ "resource": "" }
q170421
InjectorImpl.cleanup
test
private boolean cleanup(BindingImpl<?> binding, Set<Key> encountered) { boolean bindingFailed = false; Set<Dependency<?>> deps = getInternalDependencies(binding); for (Dependency dep : deps) { Key<?> depKey = dep.getKey(); InjectionPoint ip = dep.getInjectionPoint(); if (encountered.add(de...
java
{ "resource": "" }
q170422
InjectorImpl.removeFailedJitBinding
test
private void removeFailedJitBinding(Binding<?> binding, InjectionPoint ip) { failedJitBindings.add(binding.getKey()); jitBindings.remove(binding.getKey()); membersInjectorStore.remove(binding.getKey().getTypeLiteral()); provisionListenerStore.remove(binding); if (ip != null) { constructors.rem...
java
{ "resource": "" }
q170423
InjectorImpl.getInternalDependencies
test
@SuppressWarnings("unchecked") private Set<Dependency<?>> getInternalDependencies(BindingImpl<?> binding) { if (binding instanceof ConstructorBindingImpl) { return ((ConstructorBindingImpl) binding).getInternalDependencies(); } else if (binding instanceof HasDependencies) { return ((HasDependencie...
java
{ "resource": "" }
q170424
InjectorImpl.createUninitializedBinding
test
<T> BindingImpl<T> createUninitializedBinding( Key<T> key, Scoping scoping, Object source, Errors errors, boolean jitBinding) throws ErrorsException { Class<?> rawType = key.getTypeLiteral().getRawType(); ImplementedBy implementedBy = rawType.getAnnotation(ImplementedBy.class); // Don't try to...
java
{ "resource": "" }
q170425
SingleParameterInjector.getAll
test
static Object[] getAll(InternalContext context, SingleParameterInjector<?>[] parameterInjectors) throws InternalProvisionException { if (parameterInjectors == null) { return NO_ARGUMENTS; } int size = parameterInjectors.length; Object[] parameters = new Object[size]; // optimization: u...
java
{ "resource": "" }
q170426
InjectorShell.bindInjector
test
private static void bindInjector(InjectorImpl injector) { Key<Injector> key = Key.get(Injector.class); InjectorFactory injectorFactory = new InjectorFactory(injector); injector.state.putBinding( key, new ProviderInstanceBindingImpl<Injector>( injector, key, ...
java
{ "resource": "" }
q170427
InjectorShell.bindLogger
test
private static void bindLogger(InjectorImpl injector) { Key<Logger> key = Key.get(Logger.class); LoggerFactory loggerFactory = new LoggerFactory(); injector.state.putBinding( key, new ProviderInstanceBindingImpl<Logger>( injector, key, SourceProvider.UNKNO...
java
{ "resource": "" }
q170428
InjectionPoint.checkForMisplacedBindingAnnotations
test
private static boolean checkForMisplacedBindingAnnotations(Member member, Errors errors) { Annotation misplacedBindingAnnotation = Annotations.findBindingAnnotation( errors, member, ((AnnotatedElement) member).getAnnotations()); if (misplacedBindingAnnotation == null) { return false; ...
java
{ "resource": "" }
q170429
InjectionPoint.overrides
test
private static boolean overrides(Method a, Method b) { // See JLS section 8.4.8.1 int modifiers = b.getModifiers(); if (Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) { return true; } if (Modifier.isPrivate(modifiers)) { return false; } // b must be package-priv...
java
{ "resource": "" }
q170430
MembersInjectorLookup.initializeDelegate
test
public void initializeDelegate(MembersInjector<T> delegate) { checkState(this.delegate == null, "delegate already initialized"); this.delegate = checkNotNull(delegate, "delegate"); }
java
{ "resource": "" }
q170431
TypeLiteral.providerType
test
@SuppressWarnings("unchecked") final TypeLiteral<Provider<T>> providerType() { // This cast is safe and wouldn't generate a warning if Type had a type // parameter. return (TypeLiteral<Provider<T>>) get(Types.providerOf(getType())); }
java
{ "resource": "" }
q170432
TypeLiteral.resolveAll
test
private List<TypeLiteral<?>> resolveAll(Type[] types) { TypeLiteral<?>[] result = new TypeLiteral<?>[types.length]; for (int t = 0; t < types.length; t++) { result[t] = resolve(types[t]); } return ImmutableList.copyOf(result); }
java
{ "resource": "" }
q170433
MoreTypes.canonicalizeForKey
test
public static <T> TypeLiteral<T> canonicalizeForKey(TypeLiteral<T> typeLiteral) { Type type = typeLiteral.getType(); if (!isFullySpecified(type)) { Errors errors = new Errors().keyNotFullySpecified(typeLiteral); throw new ConfigurationException(errors.getMessages()); } if (typeLiteral.getRa...
java
{ "resource": "" }
q170434
TypeConverterBindingProcessor.prepareBuiltInConverters
test
static void prepareBuiltInConverters(InjectorImpl injector) { // Configure type converters. convertToPrimitiveType(injector, int.class, Integer.class); convertToPrimitiveType(injector, long.class, Long.class); convertToPrimitiveType(injector, boolean.class, Boolean.class); convertToPrimitiveType(inj...
java
{ "resource": "" }
q170435
BytecodeGen.canonicalize
test
private static ClassLoader canonicalize(ClassLoader classLoader) { return classLoader != null ? classLoader : SystemBridgeHolder.SYSTEM_BRIDGE.getParent(); }
java
{ "resource": "" }
q170436
BytecodeGen.hasSameVersionOfCglib
test
private static boolean hasSameVersionOfCglib(ClassLoader classLoader) { Class<?> fc = net.sf.cglib.reflect.FastClass.class; try { return classLoader.loadClass(fc.getName()) == fc; } catch (ClassNotFoundException e) { return false; } }
java
{ "resource": "" }
q170437
BytecodeGen.isPubliclyCallable
test
private static boolean isPubliclyCallable(Member member) { if (!Modifier.isPublic(member.getModifiers())) { return false; } Class<?>[] parameterTypes; if (member instanceof Constructor) { parameterTypes = ((Constructor) member).getParameterTypes(); } else { Method method = (Method)...
java
{ "resource": "" }
q170438
Parameter.fixAnnotations
test
public Key<?> fixAnnotations(Key<?> key) { return key.getAnnotation() == null ? key : Key.get(key.getTypeLiteral(), key.getAnnotation().annotationType()); }
java
{ "resource": "" }
q170439
Initializer.requestInjection
test
<T> Initializable<T> requestInjection( InjectorImpl injector, T instance, Binding<T> binding, Object source, Set<InjectionPoint> injectionPoints) { checkNotNull(source); Preconditions.checkState( !validationStarted, "Member injection could not be requested after validation ...
java
{ "resource": "" }
q170440
Initializer.validateOustandingInjections
test
void validateOustandingInjections(Errors errors) { validationStarted = true; initializablesCache.clear(); for (InjectableReference<?> reference : pendingInjections) { try { reference.validate(errors); } catch (ErrorsException e) { errors.merge(e.getErrors()); } } }
java
{ "resource": "" }
q170441
AssistedConstructor.newInstance
test
public T newInstance(Object[] args) throws Throwable { constructor.setAccessible(true); try { return constructor.newInstance(args); } catch (InvocationTargetException e) { throw e.getCause(); } }
java
{ "resource": "" }
q170442
ManagedFilterPipeline.withDispatcher
test
@SuppressWarnings({"JavaDoc", "deprecation"}) private ServletRequest withDispatcher( ServletRequest servletRequest, final ManagedServletPipeline servletPipeline) { // don't wrap the request if there are no servlets mapped. This prevents us from inserting our // wrapper unless it's actually going to be ...
java
{ "resource": "" }
q170443
Scoping.scope
test
static <T> InternalFactory<? extends T> scope( Key<T> key, InjectorImpl injector, InternalFactory<? extends T> creator, Object source, Scoping scoping) { if (scoping.isNoScope()) { return creator; } Scope scope = scoping.getScopeInstance(); // NOTE: SingletonScope ...
java
{ "resource": "" }
q170444
Scoping.makeInjectable
test
static Scoping makeInjectable(Scoping scoping, InjectorImpl injector, Errors errors) { Class<? extends Annotation> scopeAnnotation = scoping.getScopeAnnotation(); if (scopeAnnotation == null) { return scoping; } ScopeBinding scope = injector.state.getScopeBinding(scopeAnnotation); if (scope !...
java
{ "resource": "" }
q170445
ServletUtils.normalizePath
test
static String normalizePath(String path) { StringBuilder sb = new StringBuilder(path.length()); int queryStart = path.indexOf('?'); String query = null; if (queryStart != -1) { query = path.substring(queryStart); path = path.substring(0, queryStart); } // Normalize the path. we need...
java
{ "resource": "" }
q170446
Annotations.generateAnnotation
test
public static <T extends Annotation> T generateAnnotation(Class<T> annotationType) { Preconditions.checkState( isAllDefaultMethods(annotationType), "%s is not all default methods", annotationType); return (T) cache.getUnchecked(annotationType); }
java
{ "resource": "" }
q170447
Annotations.isRetainedAtRuntime
test
public static boolean isRetainedAtRuntime(Class<? extends Annotation> annotationType) { Retention retention = annotationType.getAnnotation(Retention.class); return retention != null && retention.value() == RetentionPolicy.RUNTIME; }
java
{ "resource": "" }
q170448
Annotations.findScopeAnnotation
test
public static Class<? extends Annotation> findScopeAnnotation( Errors errors, Annotation[] annotations) { Class<? extends Annotation> found = null; for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); if (isScopeAnnotation(annot...
java
{ "resource": "" }
q170449
Annotations.getKey
test
public static Key<?> getKey( TypeLiteral<?> type, Member member, Annotation[] annotations, Errors errors) throws ErrorsException { int numErrorsBefore = errors.size(); Annotation found = findBindingAnnotation(errors, member, annotations); errors.throwIfNewErrors(numErrorsBefore); return foun...
java
{ "resource": "" }
q170450
Annotations.nameOf
test
public static String nameOf(Key<?> key) { Annotation annotation = key.getAnnotation(); Class<? extends Annotation> annotationType = key.getAnnotationType(); if (annotation != null && !isMarker(annotationType)) { return key.getAnnotation().toString(); } else if (key.getAnnotationType() != null) { ...
java
{ "resource": "" }
q170451
ProviderLookup.initializeDelegate
test
public void initializeDelegate(Provider<T> delegate) { checkState(this.delegate == null, "delegate already initialized"); this.delegate = checkNotNull(delegate, "delegate"); }
java
{ "resource": "" }
q170452
RealOptionalBinder.addDirectTypeBinding
test
private void addDirectTypeBinding(Binder binder) { binder .bind(bindingSelection.getDirectKey()) .toProvider(new RealDirectTypeProvider<T>(bindingSelection)); }
java
{ "resource": "" }
q170453
ConstructorInjectorStore.get
test
public ConstructorInjector<?> get(InjectionPoint constructorInjector, Errors errors) throws ErrorsException { return cache.get(constructorInjector, errors); }
java
{ "resource": "" }
q170454
Struts2Factory.hasScope
test
private static boolean hasScope(Class<? extends Interceptor> interceptorClass) { for (Annotation annotation : interceptorClass.getAnnotations()) { if (Annotations.isScopeAnnotation(annotation.annotationType())) { return true; } } return false; }
java
{ "resource": "" }
q170455
RealMapBinder.newRealMapBinder
test
static <K, V> RealMapBinder<K, V> newRealMapBinder( Binder binder, TypeLiteral<K> keyType, Key<V> valueTypeAndAnnotation) { binder = binder.skipSources(RealMapBinder.class); TypeLiteral<V> valueType = valueTypeAndAnnotation.getTypeLiteral(); return newRealMapBinder( binder, keyType, ...
java
{ "resource": "" }
q170456
RealMapBinder.getKeyForNewValue
test
Key<V> getKeyForNewValue(K key) { checkNotNull(key, "key"); checkConfiguration(!bindingSelection.isInitialized(), "MapBinder was already initialized"); RealMultibinder<Map.Entry<K, Provider<V>>> entrySetBinder = bindingSelection.getEntrySetBinder(); Key<V> valueKey = Key.get( ...
java
{ "resource": "" }
q170457
ConstructorInjector.provision
test
private T provision(InternalContext context, ConstructionContext<T> constructionContext) throws InternalProvisionException { try { T t; try { Object[] parameters = SingleParameterInjector.getAll(context, parameterInjectors); t = constructionProxy.newInstance(parameters); co...
java
{ "resource": "" }
q170458
Message.writeReplace
test
private Object writeReplace() throws ObjectStreamException { Object[] sourcesAsStrings = sources.toArray(); for (int i = 0; i < sourcesAsStrings.length; i++) { sourcesAsStrings[i] = Errors.convert(sourcesAsStrings[i]).toString(); } return new Message(ImmutableList.copyOf(sourcesAsStrings), message...
java
{ "resource": "" }
q170459
CheckedProviderMethodsModule.forModule
test
static Module forModule(Module module) { // avoid infinite recursion, since installing a module always installs itself if (module instanceof CheckedProviderMethodsModule) { return Modules.EMPTY_MODULE; } return new CheckedProviderMethodsModule(module); }
java
{ "resource": "" }
q170460
FactoryProvider2.getAssistedMethods
test
@Override @SuppressWarnings("unchecked") public Collection<AssistedMethod> getAssistedMethods() { return (Collection<AssistedMethod>) (Collection<?>) assistDataByMethod.values(); }
java
{ "resource": "" }
q170461
FactoryProvider2.isTypeNotSpecified
test
private boolean isTypeNotSpecified(TypeLiteral<?> typeLiteral, ConfigurationException ce) { Collection<Message> messages = ce.getErrorMessages(); if (messages.size() == 1) { Message msg = Iterables.getOnlyElement(new Errors().keyNotFullySpecified(typeLiteral).getMessages()); return msg.get...
java
{ "resource": "" }
q170462
FactoryProvider2.constructorHasMatchingParams
test
private boolean constructorHasMatchingParams( TypeLiteral<?> type, Constructor<?> constructor, List<Key<?>> paramList, Errors errors) throws ErrorsException { List<TypeLiteral<?>> params = type.getParameterTypes(constructor); Annotation[][] paramAnnotations = constructor.getParameterAnnotations(); ...
java
{ "resource": "" }
q170463
FactoryProvider2.getDependencies
test
private Set<Dependency<?>> getDependencies( InjectionPoint ctorPoint, TypeLiteral<?> implementation) { ImmutableSet.Builder<Dependency<?>> builder = ImmutableSet.builder(); builder.addAll(ctorPoint.getDependencies()); if (!implementation.getRawType().isInterface()) { for (InjectionPoint ip : Inj...
java
{ "resource": "" }
q170464
FactoryProvider2.removeAssistedDeps
test
private Set<Dependency<?>> removeAssistedDeps(Set<Dependency<?>> deps) { ImmutableSet.Builder<Dependency<?>> builder = ImmutableSet.builder(); for (Dependency<?> dep : deps) { Class<?> annotationType = dep.getKey().getAnnotationType(); if (annotationType == null || !annotationType.equals(Assisted.cl...
java
{ "resource": "" }
q170465
FactoryProvider2.isValidForOptimizedAssistedInject
test
private boolean isValidForOptimizedAssistedInject( Set<Dependency<?>> dependencies, Class<?> implementation, TypeLiteral<?> factoryType) { Set<Dependency<?>> badDeps = null; // optimization: create lazily for (Dependency<?> dep : dependencies) { if (isInjectorOrAssistedProvider(dep)) { if (b...
java
{ "resource": "" }
q170466
FactoryProvider2.getBindingFromNewInjector
test
public Binding<?> getBindingFromNewInjector( final Method method, final Object[] args, final AssistData data) { checkState( injector != null, "Factories.create() factories cannot be used until they're initialized by Guice."); final Key<?> returnType = data.returnType; // We ignore an...
java
{ "resource": "" }
q170467
FactoryProvider2.invoke
test
@Override public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { // If we setup a method handle earlier for this method, call it. // This is necessary for default methods that java8 creates, so we // can call the default method implementation (and not our proxied v...
java
{ "resource": "" }
q170468
Errors.missingImplementationWithHint
test
<T> Errors missingImplementationWithHint(Key<T> key, Injector injector) { StringBuilder sb = new StringBuilder(); sb.append(format("No implementation for %s was bound.", key)); // Keys which have similar strings as the desired key List<String> possibleMatches = new ArrayList<>(); // Check for oth...
java
{ "resource": "" }
q170469
RealMultibinder.newRealSetBinder
test
public static <T> RealMultibinder<T> newRealSetBinder(Binder binder, Key<T> key) { binder = binder.skipSources(RealMultibinder.class); RealMultibinder<T> result = new RealMultibinder<>(binder, key); binder.install(result); return result; }
java
{ "resource": "" }
q170470
RealMultibinder.getKeyForNewItem
test
Key<T> getKeyForNewItem() { checkConfiguration(!bindingSelection.isInitialized(), "Multibinder was already initialized"); return Key.get( bindingSelection.getElementTypeLiteral(), new RealElement(bindingSelection.getSetName(), MULTIBINDER, "")); }
java
{ "resource": "" }
q170471
FilterChainInvocation.findNextFilter
test
private Filter findNextFilter(HttpServletRequest request) { while (++index < filterDefinitions.length) { Filter filter = filterDefinitions[index].getFilterIfMatching(request); if (filter != null) { return filter; } } return null; }
java
{ "resource": "" }
q170472
ConstructorBindingImpl.hasAtInject
test
private static boolean hasAtInject(Constructor cxtor) { return cxtor.isAnnotationPresent(Inject.class) || cxtor.isAnnotationPresent(javax.inject.Inject.class); }
java
{ "resource": "" }
q170473
ConstructorBindingImpl.getInternalConstructor
test
InjectionPoint getInternalConstructor() { if (factory.constructorInjector != null) { return factory.constructorInjector.getConstructionProxy().getInjectionPoint(); } else { return constructorInjectionPoint; } }
java
{ "resource": "" }
q170474
ConstructorBindingImpl.getInternalDependencies
test
Set<Dependency<?>> getInternalDependencies() { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); if (factory.constructorInjector == null) { builder.add(constructorInjectionPoint); // If the below throws, it's OK -- we just ignore those dependencies, because no one // could...
java
{ "resource": "" }
q170475
ProviderMethodsModule.forModule
test
public static Module forModule(Object module, ModuleAnnotatedMethodScanner scanner) { return forObject(module, false, scanner); }
java
{ "resource": "" }
q170476
ProviderMethodsModule.getAnnotation
test
private Annotation getAnnotation(Binder binder, Method method) { if (method.isBridge() || method.isSynthetic()) { return null; } Annotation annotation = null; for (Class<? extends Annotation> annotationClass : scanner.annotationClasses()) { Annotation foundAnnotation = method.getAnnotation(a...
java
{ "resource": "" }
q170477
LineNumbers.getLineNumber
test
public Integer getLineNumber(Member member) { Preconditions.checkArgument( type == member.getDeclaringClass(), "Member %s belongs to %s, not %s", member, member.getDeclaringClass(), type); return lines.get(memberKey(member)); }
java
{ "resource": "" }
q170478
DeferredLookups.initialize
test
void initialize(Errors errors) { injector.lookups = injector; new LookupProcessor(errors).process(injector, lookups); }
java
{ "resource": "" }
q170479
ServletScopes.continueRequest
test
@Deprecated public static <T> Callable<T> continueRequest(Callable<T> callable, Map<Key<?>, Object> seedMap) { return wrap(callable, continueRequest(seedMap)); }
java
{ "resource": "" }
q170480
ServletScopes.transferRequest
test
public static <T> Callable<T> transferRequest(Callable<T> callable) { return wrap(callable, transferRequest()); }
java
{ "resource": "" }
q170481
ServletScopes.validateAndCanonicalizeValue
test
private static Object validateAndCanonicalizeValue(Key<?> key, Object object) { if (object == null || object == NullObject.INSTANCE) { return NullObject.INSTANCE; } if (!key.getTypeLiteral().getRawType().isInstance(object)) { throw new IllegalArgumentException( "Value[" ...
java
{ "resource": "" }
q170482
MembersInjectorStore.get
test
@SuppressWarnings("unchecked") // the MembersInjector type always agrees with the passed type public <T> MembersInjectorImpl<T> get(TypeLiteral<T> key, Errors errors) throws ErrorsException { return (MembersInjectorImpl<T>) cache.get(key, errors); }
java
{ "resource": "" }
q170483
MembersInjectorStore.createWithListeners
test
private <T> MembersInjectorImpl<T> createWithListeners(TypeLiteral<T> type, Errors errors) throws ErrorsException { int numErrorsBefore = errors.size(); Set<InjectionPoint> injectionPoints; try { injectionPoints = InjectionPoint.forInstanceMethodsAndFields(type); } catch (ConfigurationExcep...
java
{ "resource": "" }
q170484
MembersInjectorStore.getInjectors
test
ImmutableList<SingleMemberInjector> getInjectors( Set<InjectionPoint> injectionPoints, Errors errors) { List<SingleMemberInjector> injectors = Lists.newArrayList(); for (InjectionPoint injectionPoint : injectionPoints) { try { Errors errorsForMember = injectionPoint.isOptional() ...
java
{ "resource": "" }
q170485
Key.get
test
static <T> Key<T> get(Class<T> type, AnnotationStrategy annotationStrategy) { return new Key<T>(type, annotationStrategy); }
java
{ "resource": "" }
q170486
Key.strategyFor
test
static AnnotationStrategy strategyFor(Annotation annotation) { checkNotNull(annotation, "annotation"); Class<? extends Annotation> annotationType = annotation.annotationType(); ensureRetainedAtRuntime(annotationType); ensureIsBindingAnnotation(annotationType); if (Annotations.isMarker(annotationTyp...
java
{ "resource": "" }
q170487
Key.strategyFor
test
static AnnotationStrategy strategyFor(Class<? extends Annotation> annotationType) { annotationType = Annotations.canonicalizeIfNamed(annotationType); if (isAllDefaultMethods(annotationType)) { return strategyFor(generateAnnotation(annotationType)); } checkNotNull(annotationType, "annotation type"...
java
{ "resource": "" }
q170488
InterceptorStackCallback.pruneStacktrace
test
private void pruneStacktrace(Throwable throwable) { for (Throwable t = throwable; t != null; t = t.getCause()) { StackTraceElement[] stackTrace = t.getStackTrace(); List<StackTraceElement> pruned = Lists.newArrayList(); for (StackTraceElement element : stackTrace) { String className = elem...
java
{ "resource": "" }
q170489
DependencyAndSource.getBindingSource
test
public String getBindingSource() { if (source instanceof Class) { return StackTraceElements.forType((Class) source).toString(); } else if (source instanceof Member) { return StackTraceElements.forMember((Member) source).toString(); } else { return source.toString(); } }
java
{ "resource": "" }
q170490
Messages.formatMessages
test
public static String formatMessages(String heading, Collection<Message> errorMessages) { Formatter fmt = new Formatter().format(heading).format(":%n%n"); int index = 1; boolean displayCauses = getOnlyCause(errorMessages) == null; Map<Equivalence.Wrapper<Throwable>, Integer> causes = Maps.newHashMap(); ...
java
{ "resource": "" }
q170491
Messages.create
test
public static Message create(String messageFormat, Object... arguments) { return create(null, messageFormat, arguments); }
java
{ "resource": "" }
q170492
Messages.create
test
public static Message create(Throwable cause, String messageFormat, Object... arguments) { return create(cause, ImmutableList.of(), messageFormat, arguments); }
java
{ "resource": "" }
q170493
Messages.create
test
public static Message create( Throwable cause, List<Object> sources, String messageFormat, Object... arguments) { String message = format(messageFormat, arguments); return new Message(sources, message, cause); }
java
{ "resource": "" }
q170494
Messages.convert
test
static Object convert(Object o) { ElementSource source = null; if (o instanceof ElementSource) { source = (ElementSource) o; o = source.getDeclaringSource(); } return convert(o, source); }
java
{ "resource": "" }
q170495
SourceProvider.shouldBeSkipped
test
private boolean shouldBeSkipped(String className) { return (parent != null && parent.shouldBeSkipped(className)) || classNamesToSkip.contains(className); }
java
{ "resource": "" }
q170496
SourceProvider.getFromClassNames
test
public Object getFromClassNames(List<String> moduleClassNames) { Preconditions.checkNotNull(moduleClassNames, "The list of module class names cannot be null."); for (final String moduleClassName : moduleClassNames) { if (!shouldBeSkipped(moduleClassName)) { return new StackTraceElement(moduleClass...
java
{ "resource": "" }
q170497
Manager.main
test
public static void main(String[] args) throws Exception { if (args.length != 1) { System.err.println( "Usage: java -Dcom.sun.management.jmxremote " + Manager.class.getName() + " [module class name]"); System.err.println("Then run 'jconsole' to connect."); Syst...
java
{ "resource": "" }
q170498
InternalContext.pushDependency
test
Dependency<?> pushDependency(Dependency<?> dependency, Object source) { Dependency<?> previous = this.dependency; this.dependency = dependency; doPushState(dependency, source); return previous; }
java
{ "resource": "" }
q170499
InternalContext.pushState
test
void pushState(com.google.inject.Key<?> key, Object source) { doPushState(key, source); }
java
{ "resource": "" }