Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,10 @@ private void injectDynamically() {
* while we're binding these singletons are not be eager.
*/
void loadEagerSingletons(InjectorImpl injector, Stage stage, final Errors errors) {
List<BindingImpl<?>> candidateBindings = new ArrayList<>();
@SuppressWarnings("unchecked") // casting Collection<Binding> to Collection<BindingImpl> is safe
Collection<BindingImpl<?>> bindingsAtThisLevel =
(Collection) injector.getBindingData().getExplicitBindingsThisLevel().values();
candidateBindings.addAll(bindingsAtThisLevel);
List<BindingImpl<?>> candidateBindings = new ArrayList<>(bindingsAtThisLevel);
synchronized (injector.getJitBindingData().lock()) {
// jit bindings must be accessed while holding the lock.
candidateBindings.addAll(injector.getJitBindingData().getJitBindings().values());
Expand Down
12 changes: 6 additions & 6 deletions core/test/com/google/inject/Asserts.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR;
import static com.google.common.truth.Truth.assertThat;
import static com.google.inject.internal.InternalFlags.getIncludeStackTraceOption;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertSame;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
Expand All @@ -43,7 +43,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import junit.framework.Assert;
import org.junit.Assert;

/** @author jessewilson@google.com (Jesse Wilson) */
public class Asserts {
Expand Down Expand Up @@ -88,7 +88,7 @@ public static boolean isIncludeStackTraceOff() {
public static void assertEqualsBothWays(Object expected, Object actual) {
assertNotNull(expected);
assertNotNull(actual);
assertEquals("expected.equals(actual)", actual, expected);
assertEquals("expected.equals(actual)", expected, actual);
assertEquals("actual.equals(expected)", expected, actual);
assertEquals("hashCode", expected.hashCode(), actual.hashCode());
}
Expand Down
10 changes: 2 additions & 8 deletions core/test/com/google/inject/ScopesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.google.inject.Asserts.assertContains;
import static com.google.inject.name.Names.named;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static junit.framework.Assert.assertSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
Expand Down Expand Up @@ -545,13 +545,7 @@ public static class Injected<T> implements In<T> {}
@ScopeAnnotation
public @interface CustomScoped {}

static final Scope CUSTOM_SCOPE =
new Scope() {
@Override
public <T> Provider<T> scope(Key<T> key, Provider<T> unscoped) {
return Scopes.SINGLETON.scope(key, unscoped);
}
};
static final Scope CUSTOM_SCOPE = Scopes.SINGLETON;

@SuppressWarnings("InjectScopeOrQualifierAnnotationRetention") // to check failure mode
@Target({ElementType.TYPE, ElementType.METHOD})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.inject.example;

import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertTrue;

/** @author crazybob@google.com (Bob Lee) */
public class ClientServiceWithDependencyInjection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.inject.example;

import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertTrue;

/** @author crazybob@google.com (Bob Lee) */
public class ClientServiceWithFactories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.inject.example;

import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertTrue;

import com.google.inject.AbstractModule;
import com.google.inject.CreationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import junit.framework.Assert;
import org.junit.Assert;

/** @author crazybob@google.com (Bob Lee) */
public class ClientServiceWithGuiceDefaults {
Expand Down
12 changes: 6 additions & 6 deletions core/test/com/google/inject/internal/SpiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
import static com.google.inject.internal.SpiUtils.VisitType.BOTH;
import static com.google.inject.internal.SpiUtils.VisitType.INJECTOR;
import static com.google.inject.internal.SpiUtils.VisitType.MODULE;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import com.google.common.base.Joiner;
import com.google.common.base.Objects;
Expand Down
10 changes: 5 additions & 5 deletions core/test/com/google/inject/internal/WeakKeySetUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

package com.google.inject.internal;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import com.google.inject.Injector;
import com.google.inject.Key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
package com.google.inject.internal.aop;

import static java.util.Arrays.stream;
import static java.util.Collections.sort;
import static java.util.stream.Collectors.toList;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;

import com.google.common.collect.ImmutableSet;
import com.google.inject.Binder;
Expand Down Expand Up @@ -48,9 +47,7 @@ public void testSingletonTrie() {

public void testMethodStrings() {
List<String> table =
stream(Binder.class.getDeclaredMethods()).map(Method::toString).collect(toList());

sort(table);
stream(Binder.class.getDeclaredMethods()).map(Method::toString).sorted().collect(toList());

ToIntFunction<String> trie = ImmutableStringTrie.buildTrie(table);

Expand Down
2 changes: 1 addition & 1 deletion core/test/com/google/inject/util/TypesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import junit.framework.TestCase;

/** @author jessewilson@google.com (Jesse Wilson) */
Expand Down
4 changes: 2 additions & 2 deletions extensions/persist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb-j5</artifactId>
<version>2.0.0</version>
<artifactId>hsqldb</artifactId>
<version>2.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.google.inject.persist.jpa;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.inject.servlet;

import static junit.framework.Assert.fail;

import junit.framework.TestCase;

public class UriPatternTypeTest extends TestCase {
Expand Down
2 changes: 1 addition & 1 deletion extensions/spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.3.18</version>
<version>5.3.39</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down