forked from google/guice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run google-java-format on all Guice code.
configure a presubmit to ensure that it stays formatted. Highlights include: * simplified import order * method annotations are now consistently defined on the preceding line * javadoc reformatted to 100 chars column width One test that contained line numbers in error messages had to be modified and the formatter didn't like some of the more complicated preprocessor directives (MOE and AOP). To avoid formatting the copyright notices as javadoc i did a preprocessing step to rewrite the initial '/**' to '/*' using perl ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132704710
- Loading branch information
1 parent
d34d64e
commit d66a079
Showing
22 changed files
with
245 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
/* | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
2 changes: 1 addition & 1 deletion
2
extensions/grapher/src/com/google/inject/grapher/AliasCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
/* | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
/* | ||
* Copyright (C) 2011 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -26,7 +26,6 @@ | |
import com.google.inject.spi.InjectionPoint; | ||
import com.google.inject.spi.InstanceBinding; | ||
import com.google.inject.spi.ProviderInstanceBinding; | ||
|
||
import java.lang.reflect.Member; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
@@ -37,7 +36,8 @@ | |
* @author [email protected] (Bojan Djordjevic) | ||
*/ | ||
final class DefaultNodeCreator implements NodeCreator { | ||
@Override public Iterable<Node> getNodes(Iterable<Binding<?>> bindings) { | ||
@Override | ||
public Iterable<Node> getNodes(Iterable<Binding<?>> bindings) { | ||
List<Node> nodes = Lists.newArrayList(); | ||
NodeVisitor visitor = new NodeVisitor(); | ||
for (Binding<?> binding : bindings) { | ||
|
@@ -64,10 +64,10 @@ private InterfaceNode newInterfaceNode(Binding<?> binding) { | |
* @param members members to add to the node | ||
* @return implementation node for the given binding | ||
*/ | ||
private ImplementationNode newImplementationNode(Binding<?> binding, | ||
Collection<Member> members) { | ||
return new ImplementationNode(NodeId.newTypeId(binding.getKey()), binding.getSource(), | ||
members); | ||
private ImplementationNode newImplementationNode( | ||
Binding<?> binding, Collection<Member> members) { | ||
return new ImplementationNode( | ||
NodeId.newTypeId(binding.getKey()), binding.getSource(), members); | ||
} | ||
|
||
/** | ||
|
@@ -77,8 +77,8 @@ private ImplementationNode newImplementationNode(Binding<?> binding, | |
* @param instance value of the instance | ||
* @return instance node for the given binding | ||
*/ | ||
private <T extends Binding<?> & HasDependencies> InstanceNode newInstanceNode(T binding, | ||
Object instance) { | ||
private <T extends Binding<?> & HasDependencies> InstanceNode newInstanceNode( | ||
T binding, Object instance) { | ||
Collection<Member> members = Lists.newArrayList(); | ||
for (Dependency<?> dependency : binding.getDependencies()) { | ||
InjectionPoint injectionPoint = dependency.getInjectionPoint(); | ||
|
@@ -87,15 +87,16 @@ private <T extends Binding<?> & HasDependencies> InstanceNode newInstanceNode(T | |
members.add(injectionPoint.getMember()); | ||
} | ||
} | ||
return new InstanceNode(NodeId.newInstanceId(binding.getKey()), binding.getSource(), instance, | ||
members); | ||
return new InstanceNode( | ||
NodeId.newInstanceId(binding.getKey()), binding.getSource(), instance, members); | ||
} | ||
|
||
/** | ||
* Visitor for {@link ConstructorBinding}s. These are for classes that Guice will instantiate to | ||
* satisfy injection requests. | ||
*/ | ||
@Override public Collection<Node> visit(ConstructorBinding<?> binding) { | ||
@Override | ||
public Collection<Node> visit(ConstructorBinding<?> binding) { | ||
Collection<Member> members = Lists.newArrayList(); | ||
members.add(binding.getConstructor().getMember()); | ||
for (InjectionPoint injectionPoint : binding.getInjectableMembers()) { | ||
|
@@ -110,21 +111,24 @@ private <T extends Binding<?> & HasDependencies> InstanceNode newInstanceNode(T | |
* the binding's {@link Key}, and then an implementation node for the instance {@link Object} | ||
* itself. | ||
*/ | ||
@Override public Collection<Node> visit(InstanceBinding<?> binding) { | ||
return ImmutableList.<Node>of(newInterfaceNode(binding), newInstanceNode(binding, | ||
binding.getInstance())); | ||
@Override | ||
public Collection<Node> visit(InstanceBinding<?> binding) { | ||
return ImmutableList.<Node>of( | ||
newInterfaceNode(binding), newInstanceNode(binding, binding.getInstance())); | ||
} | ||
|
||
/** | ||
* Same as {@link #visit(InstanceBinding)}, but the binding edge is | ||
* {@link BindingEdgeType#PROVIDER}. | ||
* Same as {@link #visit(InstanceBinding)}, but the binding edge is {@link | ||
* BindingEdgeType#PROVIDER}. | ||
*/ | ||
@Override public Collection<Node> visit(ProviderInstanceBinding<?> binding) { | ||
return ImmutableList.<Node>of(newInterfaceNode(binding), newInstanceNode(binding, | ||
binding.getUserSuppliedProvider())); | ||
@Override | ||
public Collection<Node> visit(ProviderInstanceBinding<?> binding) { | ||
return ImmutableList.<Node>of( | ||
newInterfaceNode(binding), newInstanceNode(binding, binding.getUserSuppliedProvider())); | ||
} | ||
|
||
@Override public Collection<Node> visitOther(Binding<?> binding) { | ||
@Override | ||
public Collection<Node> visitOther(Binding<?> binding) { | ||
return ImmutableList.<Node>of(newInterfaceNode(binding)); | ||
} | ||
} | ||
|
Oops, something went wrong.