steffimueller / google-gin Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/google-gin
License: Apache License 2.0
Automatically exported from code.google.com/p/google-gin
License: Apache License 2.0
For some situations, in particular when the construction of an object is
not under Gin/developer control, constructor injection is not sufficient.
An example for this issue are GWT entry points - the Ginjector
implementations would shrink by a good margin if one had to only define the
GWT entry points in here.
The attached patch adds method injection to Gin, providing a way to inject
members in objects even after they have been created. It closely follows
the Guice pattern for similar cases:
--- Example ---
public class MyInjector {
...
injectMembers(MyEntryPoint entryPoint);
}
public class MyEntryPoint {
private MyService service;
public void onModuleLoad() {
MyInjector injector = GWT.create(MyInjector.class);
injector.injectMembers(this);
...
}
@Inject
public void injectHere(MyService service) [
this.service = service;
}
}
--- /Example ---
The patch can be found at http://codereview.appspot.com/5863.
Original issue reported on code.google.com by aragos
on 15 Sep 2008 at 2:31
out/testrun/hosted/gen/com/google/gwt/inject/client/field/FruitGinjectorImpl.jav
a
demonstrates this. For example, it has two methods with this signature:
private native void
com$google$gwt$inject$client$field$Pear_color_fieldInjection_(com.google.gwt.inj
ect.client.field.Pear
injectee, java.lang.String value)
The reason is that injectMembers and regular creation end up duplicating
the member injection helper methods.
Original issue reported on code.google.com by [email protected]
on 29 May 2009 at 1:41
Although we support Guice constant bindings (i.e. bindConstant()) in
general, Gin currently does not allow the definition of constant-returning
methods in a Ginjector, for example:
interface MyGinjector extends Ginjector {
@Named("foo") int getFoo();
}
This is not terribly important but should probably be enabled eventually.
Original issue reported on code.google.com by aragos
on 29 Dec 2008 at 6:46
What steps will reproduce the problem?
1. Run ant.
2. Have many hidden hosted modes created.
3. Have the build take 3 minutes, 21 seconds on new MacBook Pro.
What is the expected output? What do you see instead?
A common technique is to put all GWTTestCases into a single (or a couple large)
GWTTestSuites
so only one hidden hosted mode needs to be launched to run a number of
GWTTestCases.
What version of the product are you using? On what operating system?
r74 on Mac OS X.
Please provide any additional information below.
I'll try to see if I can provide a patch, but I'll need to set up Eclipse to
follow the style rules so I
can contribute.
Original issue reported on code.google.com by [email protected]
on 7 Jan 2009 at 9:15
Trying to inject an instance of a non-public class fails weirdly. Would be
nice to support this as well as Guice does. Regardless, if it fails, it
should fail with useful error messages.
Original issue reported on code.google.com by [email protected]
on 28 Aug 2008 at 11:43
Compilation of tests fails with current trunk due to this changes:
http://code.google.com/p/google-web-toolkit/source/detail?r=5166
[javac]
/home/kojot/dev/google/google-gin/test/com/google/gwt/inject/rebind/util/Abstrac
tUtilTester.java:32:
cannot find symbol
[javac] symbol : class JavaSourceFile
[javac] location: package com.google.gwt.dev.javac
[javac] import com.google.gwt.dev.javac.JavaSourceFile;
Original issue reported on code.google.com by [email protected]
on 17 Jun 2009 at 9:47
What steps will reproduce the problem?
1. inject a class that has an unannotated no-args private constructor and a
public constructor with some arguments (which can not be injected)
2. don't create a binding for that class
3. compile
What is the expected output? What do you see instead?
I expect a compile-time error.
Instead GIN happily uses the private no-args constructor and creates an
invalid object.
Original issue reported on code.google.com by [email protected]
on 6 Mar 2009 at 7:33
Update Gin to compile and run with Guice 2.0 final.
Original issue reported on code.google.com by [email protected]
on 2 Jun 2009 at 5:04
[deleted issue]
I implemented field injection for Gin, to reach feature parity with Guice
and because it is fun. :) Field injection enables any field in a
guice-controlled class to be annotated with @Inject, the Ginjector will
then take care of adding values for those fields.
This change is included in patch http://codereview.appspot.com/7735
Original issue reported on code.google.com by aragos
on 4 Nov 2008 at 5:34
What steps will reproduce the problem?
1. create simple class Foo that injects Bar
2. create simple class Bar that injects Foo
3. set up binds for Foo and Bar in your GinModule
4. call injector.getFoo()
5. get a stack overflow error
What is the expected output? What do you see instead?
I would like it if GIN discovered the circular dependency and inform user
during exception in injection. Seems like it would be helpful in more
complicated cases and better than running the circuit until overflow.
What version of the product are you using? On what operating system?
Linux
Original issue reported on code.google.com by [email protected]
on 29 Oct 2008 at 12:20
See also http://groups.google.com/group/google-
gin/browse_thread/thread/be9eca254106d9ef
GIN should support injection of remote service proxies by calling
GWT.create on the synchronous service interface.
Original issue reported on code.google.com by [email protected]
on 13 Sep 2008 at 11:33
Attachments:
Binding an enum as a constant currently results in a compile time error:
public void configure() {
bindConstant().annotatedWith(MyAnnotation.class).to(MyEnum.Value);
}
[ERROR] Errors in
'file:/home/schmitt/projects/gin2/out/testrun/gen/com/google/gwt/inject/client/b
indings/MyGinjectorImpl.java'
[ERROR] Line 20: Rebind result
'com.google.gwt.inject.client.bindings.MyEnum' must be a class
This looks like a bug, we probably check for isClassOrInterface and get a
null, we need to check for enums as well.
Original issue reported on code.google.com by aragos
on 30 Dec 2008 at 11:04
Follow up on discussion here:
http://groups.google.com/group/google-gin/browse_thread/thread/a182319d8b17c73c
Basically, we could get rid of @Modules("...") by mirroring some Guice
interfaces to corresponding types like GModule, GProvider and so on. For
the generator, or to reuse client code on the backend, we can write
adapters for those classes.
Proof of concept attached in the patch.
Wins:
- Gradually move towards the Guice API without having to include methods
that don't work.
- No more string identifier to specify modules. I know it gets validated at
GWT compile time, but GWT compile time is usually not IDE compile time.
- No more awkward "rebind" package to put the Module in. Having these
different worlds separated by convention feels ugly.
- 100% client to server compatibility using the module adapter.
- Ability to extend the Guice DSL to address GWT specific needs, e.g.
intercepting private methods/interfaces
- Documents the fact (GModule API name) that the module could behave
differently depending on where you use it. For example a class might work
with GWT.create but not on the backend.
Losses:
- Code shared by client and server needs to be in a GModule.
- G's: GModule, GProvider.
Let's discuss.
Original issue reported on code.google.com by [email protected]
on 12 Sep 2008 at 12:43
Attachments:
It should be a fairly straight-forward project to implement Guice AOP in
Gin. We can write subclasses of intercepted types and wrap matched methods
in our pre/post-processing. The interesting part of this implementation is
likely going to be the inclusion and partial re-write (super-source) of
method interceptors as provided by the aop alliance.
See also
http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/Binder.ht
ml#bindInterceptor(com.google.inject.matcher.Matcher,%20com.google.inject.matche
r.Matcher,%20org.aopalliance.intercept.MethodInterceptor...)
Original issue reported on code.google.com by aragos
on 26 May 2009 at 2:41
After checking out GIN, to my eclipse workspace, I run the build.xml script
and get the output in the attached file. The path to the project has spaces
in it and it appears that it is being incorrectly tokenized.
The build works fine when I move it to a different location (without
spaces). I am using Windows XP, Eclipse 3.4 and GWT 1.7.
Original issue reported on code.google.com by [email protected]
on 22 Jul 2009 at 4:11
Attachments:
What steps will reproduce the problem?
1. Using @Inject on a provider method.
What is the expected output? What do you see instead?
Injection is automatic in provider methods but this is not documented well.
Adding @Inject causes loops that are not visible to the developer because
they are hidden in generated code.
What version of the product are you using? On what operating system?
I'm using gin with adplanner. As far as I know our version is current.
It should be an error (in Guice, not only Gin) to annotate provider methods
with @Inject. Module objects should be created with "new" instead of trying
to inject them in Gin.
Original issue reported on code.google.com by [email protected]
on 18 Mar 2009 at 8:32
For Guice-compatibility (and because I think there are a few cases where
it's actually useful), let's make it possible to inject the ginjector
itself, by creating a binding to its interface.
Original issue reported on code.google.com by aragos
on 10 Feb 2009 at 1:43
What steps will reproduce the problem?
this compiles OK:
Enum:
enum En {
A, B;
}
in GinModule:
public void configure(binder b) {
b.bindConstant().annotatedWith(A.class).to(En.A);
b.bindConstant().annotatedWith(B.class).to(En.B);
}
But this:
enum En {
A() {}, B() {};
}
Would result in exception
Using trunk Gin, Guice 2.0, GWT 1.6.4
Original issue reported on code.google.com by [email protected]
on 1 Jul 2009 at 5:22
Should be pretty straightforward to implement - allow static injections.
Original issue reported on code.google.com by aragos
on 26 Jan 2009 at 7:51
Unit test (and fix) to follow.
Essentially, if MyMessages is an interface that will be instantiated via
GWT.create:
bind(MyMessages.class).asEagerSingleton();
leads to:
1) No implementation for com.google.gwt.inject.client.MyMessages was bound.
at
com.google.gwt.inject.client.scopedimplicit.ScopedImplicitModule.configure(Scope
dImplicitModule.java:25)
Original issue reported on code.google.com by [email protected]
on 9 Jan 2009 at 3:04
When I run ant task jar on windows, it cannot work.
-> build.properties not found in the repository
-> It seems working for Mac,not for Windows.
Original issue reported on code.google.com by [email protected]
on 4 Oct 2008 at 8:50
What steps will reproduce the problem?
1. Create a gin module that binds
bind(Foo.class).in(Singleton.class);
and
bind(Foo.class).toProvider(FooProvider.class).in(Singleton.class);
2. there is no error or warning.
What is the expected output? What do you see instead?
Guice would error on this case and give you the name of the problem class key.
What version of the product are you using? On what operating system?
Working on Linux
Original issue reported on code.google.com by [email protected]
on 29 Oct 2008 at 12:13
Although injection into private fields is already implemented, we do not
currently allow (or successfully execute) injection into private methods or
constructors. The fix for methods is probably quite trivial (using the
same basic principle as field injection), constructors will have to be
investigated.
Original issue reported on code.google.com by aragos
on 23 Dec 2008 at 7:46
I just had the following (very rough) idea.
BEFORE
======
Java:
public class JSNIExample {
void instanceFoo(String s) {
// use s
}
}
JSNI:
// Call instance method instanceFoo()
[email protected]::instanceFoo(Ljava/lang/String;)(s);
AFTER
=====
Java:
public class JSNIExample {
// Use @Named to distinguish overloads
@Named("instanceFooWithMyName")
void instanceFoo(String s) {
// use s
}
}
$(this).named("instanceFooWithMyName").(s);
We could basically rewrite JSNI at compile time, based on annotations in
the Java code. Maybe we can use some kind of matcher system much like Guice
AOP does.
Setting this to low priority... I'd implement AOP first.
Original issue reported on code.google.com by [email protected]
on 5 Oct 2008 at 1:39
What steps will reproduce the problem?
1. create an enum (Foo) with an inner Visitor<T> interface
2. set up a binding from visitor to an implementing class
bind(new TypeLeteral<Foo.Vistor<Bar>>).to(BarVistor.class);
where the BarVistor implements Foo.Vistor<Bar>
3. watch gin blow up with
Computing all possible rebind results for SCRUBBED MyInjector'
Rebinding SCRUBBED MyInjector
Invoking <generate-with
class='com.google.gwt.inject.rebind.GinjectorGenerator'/>
[ERROR] Generator
'com.google.gwt.inject.rebind.GinjectorGenerator' threw threw an exception
while rebinding 'SCRUBBED MyInjector'
java.lang.IllegalArgumentException: No owner type for enclosed interface
Foo$Visitor
at
com.google.inject.internal.base.Preconditions.checkArgument(Preconditions.java:1
11)
at
com.google.inject.internal.MoreTypes$ParameterizedTypeImpl.<init>(MoreTypes.java
:471)
at
com.google.inject.util.Types.newParameterizedTypeWithOwner(Types.java:60)
at com.google.inject.util.Types.newParameterizedType(Types.java:49)
at
com.google.gwt.inject.rebind.util.KeyUtil.gwtTypeToJavaType(KeyUtil.java:261)
at com.google.gwt.inject.rebind.util.KeyUtil.getKey(KeyUtil.java:108)
at com.google.gwt.inject.rebind.util.KeyUtil.getKey(KeyUtil.java:70)
at
com.google.gwt.inject.rebind.binding.CreatorBinding.addParamTypes(CreatorBinding
.java:108)
at
com.google.gwt.inject.rebind.binding.CallConstructorBinding.setConstructor(CallC
onstructorBinding.java:45)
at
com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBindingForClass(Bin
dingsProcessor.java:402)
at
com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBinding(BindingsPro
cessor.java:384)
at
com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBindingsForUnresolv
ed(BindingsProcessor.java:187)
at
com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:17
9)
at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorI
mpl.java:76)
at
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java
:47)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:49)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindO
racle.java:113)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOrac
le.java:62)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:1
72)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:1
61)
at
com.google.gwt.dev.Precompile$DistillerRebindPermutationOracle.getAllPossibleReb
indAnswers(Precompile.java:243)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds
(WebModeCompilerFrontEnd.java:177)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.process(AbstractCompiler.ja
va:151)
at
com.google.gwt.thirdparty.org.eclipse.jdt.internal.compiler.Compiler.compile(Com
piler.java:444)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile(AbstractCompiler.ja
va:85)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile(AbstractCompiler.ja
va:181)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.access$400(AbstractCompiler
.java:71)
at
com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:473)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(We
bModeCompilerFrontEnd.java:121)
at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompi
ler.java:325)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:341)
at com.google.gwt.dev.Precompile.run(Precompile.java:444)
at com.google.gwt.dev.Precompile$1.run(Precompile.java:291)
atcom.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:84)
at
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.
java:78)
at com.google.gwt.dev.Precompile.main(Precompile.java:298)
Original issue reported on code.google.com by [email protected]
on 1 Apr 2009 at 1:12
What steps will reproduce the problem?
1. Create a valid concrete instance class (MyClass)
2. bind( MyClass.class ).asEagerSingleton();
3. @Inject public MyConstuctor( MyClass myClass )
What is the expected output? What do you see instead?
I would expect that MyClass is initialised ASAP and that MyConstructor will
receive that one-and-only instance in its constructor.
Instead, while the class does seem to be initialised correctly, the inject
is always null. This is also the case if you then bind MyInterface to
MyClass and inject that. Eg:
bind( MyClass.class ).asEagerSingleton();
bind( MyInterface.class ).to( MyClass.class );
The same result if you then inject MyInterface instead. My guess is that
the lookup for MyClass is returning null for some reason...
What version of the product are you using? On what operating system?
Latest from trunk, on Mac OS X 10.5.7 running Java 6 (1.6.0_13).
Original issue reported on code.google.com by [email protected]
on 25 Jun 2009 at 3:56
My Module provides values of same type:
public class MyModule extends AbstractGinModule {
@Provides @Apple
public Label getApple() {
return new Label("apple");
}
@Provides @Lemon
public Label getLemon() {
return new Label("lemon");
}
}
If I use injector with no annotation, GIN not say me about any warning signs:
@GinModules(MyModule.class)
public interface MyGinjector extends Ginjector {
Label getLabel();
}
Is it wishful behaviour ?
Original issue reported on code.google.com by [email protected]
on 14 May 2009 at 1:36
This should work in a GinModule:
// It is legal to have the bind().in() separate from the bind().to()
bind(MyProvided.class).in(Singleton.class);
bind(MyProvided.class).toProvider(MyProvidedProvider.class);
But it does not:
[ERROR] Double-bound:
Key[type=com.google.gwt.inject.client.MyProvided, annotation=[none]].
com.google.gwt.inject.rebind.binding.CallGwtDotCreateBinding@788896,
com.google.gwt.inject.rebind.binding.BindProviderBinding@714e09
Jesse says that we need to replace the original untargetted binding with
the right one when we see it later. I think the right fix will be for Gin
to stop detecting double bindings altogether because Guice's TOOL-mode
check will catch them (with a better error message anyhow).
Original issue reported on code.google.com by [email protected]
on 13 Jan 2009 at 6:01
Fits the project name.
Original issue reported on code.google.com by [email protected]
on 12 Sep 2008 at 12:44
What steps will reproduce the problem?
1. Try to bind a class that has two constructors, one of them a default
constructor. Example:
public class ViewImpl implements View {
private String hello;
public ViewImpl() {
}
public ViewImpl(String hello) {
this.hello = hello;
}
public void sayHello() {
GWT.log("Hello from view with constructor." + hello, null);
}
}
2. Fails to start with the following error: [ERROR] No @Inject or default
constructor found
What is the expected output? What do you see instead?
It should just use the no argument constructor.
What version of the product are you using? On what operating system?
svn 84.
Please provide any additional information below.
As noted here: http://groups.google.com/group/google-
gin/browse_thread/thread/98698d20502a5c31, after the Guice documentation was
updated,
this is not the default behavior.
Original issue reported on code.google.com by [email protected]
on 3 Feb 2009 at 1:41
What steps will reproduce the problem?
1. Create an interface.
2. Create a concrete implementation of said interface that @Inject Constants,
Messages and/or
RemoteServices.
3. Bind the concrete implementation to the interface in a AbstractGinModule.
What is the expected output? What do you see instead?
The expected output is GWT.create() being called on the Constants, Messages
and/or
RemoteServices. Instead, something like the following error message appears:
[ERROR] Guice creation errors:
1) No implementation for com.test.client.ViewConstants was bound.
while locating com.test.client.ViewConstants
for parameter 0 at com.test.client.ViewImpl.<init>(ViewImpl.java:11)
at com.google.gwt.inject.rebind.adapter.BinderAdapter.bind(BinderAdapter.java:33)
What version of the product are you using? On what operating system?
SVN HEAD (revision 60). Mac OS X Leopard.
Please provide any additional information below.
I've patched a test case to show the error. The patch is attached below.
Original issue reported on code.google.com by [email protected]
on 22 Dec 2008 at 7:57
Attachments:
What steps will reproduce the problem?
Try binding a type like Map<String, Provider<? extends MyInterface>>.
What is the expected output? What do you see instead?
I expected it to work, however it gives me an error like this:
com.google.inject.ProvisionException: Error creating key for interface
java.util.Map<java.lang.String, com.google.inject.Provider<? extends
com.rdamazio.MyInterface>>
at com.google.gwt.inject.rebind.KeyUtil.getKey(KeyUtil.java:94)
at com.google.gwt.inject.rebind.KeyUtil.getKey(KeyUtil.java:54)
at
com.google.gwt.inject.rebind.binding.CreatorBinding.addParamTypes(CreatorBinding
.java:96)
at
com.google.gwt.inject.rebind.binding.CallConstructorBinding.setConstructor(CallC
onstructorBinding.java:44)
at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.createImplicitBindingForClas
s(GinjectorGeneratorImpl.java:565)
at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.createImplicitBinding(Ginjec
torGeneratorImpl.java:539)
at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorI
mpl.java:251)
at
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java
:35)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:49)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindO
racle.java:110)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOrac
le.java:62)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:1
64)
at
com.google.gwt.dev.GWTCompiler$DistillerRebindPermutationOracle.getAllPossibleRe
bindAnswers(GWTCompiler.java:165)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds
(WebModeCompilerFrontEnd.java:128)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.process(AbstractCompiler.ja
va:151)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile(AbstractCompiler.ja
va:85)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile(AbstractCompiler.ja
va:181)
at
com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.access$400(AbstractCompiler
.java:71)
at
com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:473)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(We
bModeCompilerFrontEnd.java:73)
at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.<init>(JavaToJavaScriptCompiler.
java:315)
at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:324)
at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:470)
at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:460)
at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:196)
Caused by: java.lang.ClassNotFoundException: ? extends com.rdamazio.MyInterface
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.google.gwt.inject.rebind.KeyUtil.loadClass(KeyUtil.java:166)
at
com.google.gwt.inject.rebind.KeyUtil.gwtTypeToJavaType(KeyUtil.java:154)
at
com.google.gwt.inject.rebind.KeyUtil.gwtTypeToJavaType(KeyUtil.java:145)
at
com.google.gwt.inject.rebind.KeyUtil.gwtTypeToJavaType(KeyUtil.java:145)
at com.google.gwt.inject.rebind.KeyUtil.getKey(KeyUtil.java:85)
... 25 more
apparently it tries to take "? extends com.rdamazio.MyInterface" as a class
name and doesn't find it.
What version of the product are you using? On what operating system?
GWT 1.5 on Linux
Please provide any additional information below.
I can provide an google-internal code sample for reproducing if needed
(just can't post it here) - ping me at [email protected] for that.
Original issue reported on code.google.com by [email protected]
on 4 Nov 2008 at 9:23
Guice 2 has cool stuff for private modules. I suspect it won't just work in
Gin -- we'll need to add explicit support.
Original issue reported on code.google.com by [email protected]
on 6 Jan 2009 at 5:16
Add support for assisted inject. Proposed solution: Add a method "void
asFactory()" (or similar) to GinLinkedBindingBuilder. A binding would look
like this:
bind(MyFactory.class).asFactory();
// or
bind(MyFactory.class).annotatedWith(MyAnnotation.class).asFactory();
Internally gin would then fill out the factory implementation.
This could also be added back to Guice's EDSL for native assisted inject
support.
Original issue reported on code.google.com by aragos
on 23 Dec 2008 at 8:04
Please distribute this great library in a maven repository.
See also:
http://groups.google.com/group/google-gin/browse_thread/thread/211fa264a1b42b3a/
470f2b4c9b533ea2?lnk=gst&q=maven#470f2b4c9b533ea2
Original issue reported on code.google.com by [email protected]
on 12 Jun 2009 at 4:23
We currently do not check for optional injection. Need to add that.
Original issue reported on code.google.com by aragos
on 1 Mar 2009 at 6:42
What is the expected output? What do you see instead?
ScopeAnnotation cannot be resolved to a type
Original issue reported on code.google.com by [email protected]
on 11 Jun 2009 at 9:15
What steps will reproduce the problem?
1. download&build gin.jar with gwt1.6.4
2. add the lib gin.jar to the eclipse-build-path
2. adding the <inherits name="com.google.gwt.inject.Inject"/>
What is the expected output? What do you see instead?
Should deploy&run without errors, but gives a [ERROR] Line 20: Unexpected
exception while
processing element 'inherits'
java.lang.UnsupportedClassVersionError: Bad version number in .class file
What version of the product are you using? On what operating system?
gwt1.6.4 with the eclipse-plugin on a Mac with several jdks - default is
1.6.0_13
Is gin supposed to work with gwt1.6.4? Are there any special recommendations on
building gin
(eg. a jdk1.5 needed??) I haven't yet used any of the gin-classes, just trying
to inherit the
module.
Original issue reported on code.google.com by [email protected]
on 23 Jun 2009 at 8:52
This should work:
class Foo {
@Inject Foo(@Nullable @Named("unbound") String s, @Nullable Unimplemented
unimpl);
interface Unimplemented {}
}
null should be passed for both constructor parameters.
Actually, the unimplemented interface part may be impossible due to the
GWT.create fallback. But we should support nullable injection when possible.
Original issue reported on code.google.com by [email protected]
on 31 May 2009 at 10:55
What steps will reproduce the problem?
1. Try to bind a generic concrete implementation to a generic interface.
2. Do this by trying to bind the TypeLiteral concrete generic
implementation to generic interface.
3. binding a TypeLiteral to another TypeLiteral is not supported.
What is the expected output? What do you see instead?
This should be possible.
What version of the product are you using? On what operating system?
svn r86.
Please provide any additional information below.
Discussed here:
http://groups.google.com/group/google-gin/browse_thread/thread/54813ada541e12a9
Original issue reported on code.google.com by [email protected]
on 24 Feb 2009 at 3:05
We currently use native methods to allow access control in Gin but that
seems to break the code optimization in the GWT compiler (it treats native
method bodies as blobs).
To ultimately solve this problem, we'll have to introduce a better
reflection "light" mechanism in GWT, either through improving native method
analysis or by adding a dedicated syntax. In the meantime, we should at
least inject publicly accessible members in java to allow older versions of
GWT some optimization.
Original issue reported on code.google.com by aragos
on 21 Apr 2009 at 2:53
If a GinModule has a provider method, the generated Ginjector does not
compile. Errors are like:
[ERROR] Line 81: The nested type
com.google.gwt.inject.client.InnerGinjectorTest$InnerModule cannot be
referenced using its binary name
Original issue reported on code.google.com by [email protected]
on 28 May 2009 at 9:31
What steps will reproduce the problem?
1. Create two classes A and B
2. Bind them in Module as singletones
3. Create an injector with getA() method
4. Use constructor injection on both
5. Invoke the getA() method
What is the expected output? What do you see instead?
I expect that two linked instances of the classes are created.
But I see stack overflow exception. See attached log file.
What version of the product are you using? On what operating system?
I use latest trunk r108, Windows vista,
java version "1.6.0_10-beta"
Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b24)
Java HotSpot(TM) Client VM (build 11.0-b12, mixed mode, sharing)
Please provide any additional information below.
Please find test project attached.
Original issue reported on code.google.com by aectann
on 8 Jun 2009 at 6:03
Attachments:
[deleted issue]
I noticed that the build.xml in the trunk is incomplete. It is missing the
top <project> tag, a mapping to the env property and a fix to build on the
Mac. I attached my changes to the build file to address these issues.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2008 at 10:01
Attachments:
What steps will reproduce the problem?
(code/error message taken from shybyte's mailinglist post "GinTutorial
doesn't work for me"):
public interface Localization
{
public String MSG_HELLO_WORLD();
}
public class LocalizationImpl implements Localization
{
@Override
public String MSG_HELLO_WORLD()
{
return "Hello World!";
}
}
public class ClientGinModule extends AbstractGinModule
{
@Override
protected void configure()
{
bind(Localization.class).to(LocalizationImpl.class);
}
}
@GinModules(ClientGinModule.class)
public interface LocalizationGinjector extends Ginjector
{
Localization getLocalization();
}
What is the expected output? What do you see instead?
Expected: don't knwo, never seen it ;)
What i got:
In hosted mode I got:
[ERROR] Errors from Guice: Guice creation errors:
1) A binding to prototype.gin.client.Localization was already
configured at com.google.gwt.inject.rebind.LieToGuiceModule
$ImplicitBindingModule.configure(LieToGuiceModule.java:70).
at prototype.gin.client.ClientGinModule.configure
(ClientGinModule.java:21)
1 error
com.google.inject.CreationException: Guice creation errors:
1) A binding to prototype.gin.client.Localization was already
configured at com.google.gwt.inject.rebind.LieToGuiceModule
$ImplicitBindingModule.configure(LieToGuiceModule.java:70).
at prototype.gin.client.ClientGinModule.configure
(ClientGinModule.java:21)
1 error
at
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist
(Errors.java:342)
at com.google.inject.InjectorBuilder.initializeStatically
(InjectorBuilder.java:152)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)
at com.google.inject.Guice.createInjector(Guice.java:92)
at
com.google.gwt.inject.rebind.BindingsProcessor.validateModulesUsingGuice
(BindingsProcessor.java:309)
at com.google.gwt.inject.rebind.BindingsProcessor.process
(BindingsProcessor.java:180)
at com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate
(GinjectorGeneratorImpl.java:76)
at com.google.gwt.inject.rebind.GinjectorGenerator.generate
(GinjectorGenerator.java:47)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize
(RuleGenerateWith.java:49)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind
(StandardRebindOracle.java:113)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind
(StandardRebindOracle.java:62)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind
(StandardRebindOracle.java:172)
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind
(ShellModuleSpaceHost.java:114)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:474)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate
(ModuleSpace.java:365)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:
39)
at com.google.gwt.core.client.GWT.create(GWT.java:91)
at prototype.gin.client.GinPrototype.<init>(GinPrototype.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate
(ModuleSpace.java:373)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:318)
at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace
(BrowserWidget.java:343)
at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access$100
(BrowserWidgetMoz.java:35)
at com.google.gwt.dev.shell.moz.BrowserWidgetMoz
$ExternalObjectImpl.gwtOnLoad(BrowserWidgetMoz.java:58)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native
Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:
1428)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840)
at com.google.gwt.dev.SwtHostedModeBase.processEvents
(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop
(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)
When compiling to javascript I got:
Compiling module prototype.gin.GinPrototype
Refreshing module from source
Refreshing TypeOracle
Processing types in compilation unit: file:/home/marco/
workspace/GinPrototype/src/prototype/gin/client/
LocalizationGinjector.java
Found type 'LocalizationGinjector'
Resolving annotation '@GinModules
(ClientGinModule.class)'
[ERROR]
java.lang.ClassNotFoundException: prototype.gin.client.ClientGinModule
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.google.gwt.dev.javac.TypeOracleMediator.getClassLiteral
(TypeOracleMediator.java:763)
at
com.google.gwt.dev.javac.TypeOracleMediator.getAnnotationElementValue
(TypeOracleMediator.java:674)
at
com.google.gwt.dev.javac.TypeOracleMediator.createAnnotationInstance
(TypeOracleMediator.java:442)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation
(TypeOracleMediator.java:836)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations
(TypeOracleMediator.java:857)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration
(TypeOracleMediator.java:1384)
at com.google.gwt.dev.javac.TypeOracleMediator.addNewUnits
(TypeOracleMediator.java:389)
at com.google.gwt.dev.javac.TypeOracleMediator.refresh
(TypeOracleMediator.java:417)
at com.google.gwt.dev.javac.CompilationState.refresh
(CompilationState.java:179)
at com.google.gwt.dev.javac.CompilationState.<init>
(CompilationState.java:93)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState
(ModuleDef.java:264)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:283)
at com.google.gwt.dev.Compiler.run(Compiler.java:170)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:
84)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger
(CompileTaskRunner.java:78)
at com.google.gwt.dev.Compiler.main(Compiler.java:131)
[ERROR] Unexpected
java.lang.NullPointerException
at
com.google.gwt.dev.javac.TypeOracleMediator.getAnnotationElementValue
(TypeOracleMediator.java:704)
at
com.google.gwt.dev.javac.TypeOracleMediator.createAnnotationInstance
(TypeOracleMediator.java:442)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation
(TypeOracleMediator.java:836)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations
(TypeOracleMediator.java:857)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration
(TypeOracleMediator.java:1384)
at com.google.gwt.dev.javac.TypeOracleMediator.addNewUnits
(TypeOracleMediator.java:389)
at com.google.gwt.dev.javac.TypeOracleMediator.refresh
(TypeOracleMediator.java:417)
at com.google.gwt.dev.javac.CompilationState.refresh
(CompilationState.java:179)
at com.google.gwt.dev.javac.CompilationState.<init>
(CompilationState.java:93)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState
(ModuleDef.java:264)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:283)
at com.google.gwt.dev.Compiler.run(Compiler.java:170)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:
84)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger
(CompileTaskRunner.java:78)
at com.google.gwt.dev.Compiler.main(Compiler.java:131)
What version of the product are you using? On what operating system?
Guice Version: svn r937
Gin Version: svn r95
GWT Version: 1.6.4
Plaform: Linux 32 Bit (Ubuntu 9.04)
Please provide any additional information below.
I worked around that issue by adding a check to the implementation of
GinModule.
I'll take shybyte's code as an example:
public class ClientGinModule extends AbstractGinModule
{
private static boolean configured = false;
@Override
protected void configure()
{
if(!configured) {
bind(Localization.class).to(LocalizationImpl.class);
configured = true;
}
}
}
That fixed the duplicate binding errors, but on the other hand made GIN
completly ignore every binding i defined, meaning that Localization would
not be bound to LocalizationImpl although configure() gets called for sure.
Original issue reported on code.google.com by [email protected]
on 5 May 2009 at 9:27
From review:
[google-gin] limpbizkit commented on revision r73.
Details are at http://code.google.com/p/google-gin/source/detail?r=73
Score: Positive
Line-by-line comments:
File: /trunk/src/com/google/gwt/inject/rebind/BindingsProcessor.java (r73)
===============================================================================
Line 420: if (binding == null) {
-------------------------------------------------------------------------------
really necesssary?
File: /trunk/src/com/google/gwt/inject/rebind/LieToGuiceModule.java (r73)
===============================================================================
Line 34: private final List<Module> implicitBindings = new
ArrayList<Module>();
-------------------------------------------------------------------------------
kinda awkward variable name, a List<Module> being called 'bindings'
I don't know about the use of the word 'implicit' . . . could you just
call them GwtCreateBindings? I assume that's the only place they come from...
Line 61: private class ImplicitBindingModule<T> implements Module,
Provider<T> {
-------------------------------------------------------------------------------
Neato
File:
/trunk/src/com/google/gwt/inject/rebind/binding/CallGwtDotCreateBinding.java
(r73)
===============================================================================
Line 37: sb.append("GWT.create(")
-------------------------------------------------------------------------------
neato codegen
File:
/trunk/src/com/google/gwt/inject/rebind/binding/RemoteServiceProxyBinding.java
(r73)
===============================================================================
Line 41: public RemoteServiceProxyBinding(@InjectionPoint MemberCollector
memberCollector,
-------------------------------------------------------------------------------
hmm. . . . I think we're also using the name InjectionPoint possibly for
something different . . . .
Original issue reported on code.google.com by [email protected]
on 9 Jan 2009 at 6:06
The Gin unit tests work fine against GWT 1.5, but when compiling them
against GWT trunk r4244 I get these compile errors:
[javac] Compiling 62 source files to
/home/bstoler/src/gin/google-gin/out/test
[javac]
/home/bstoler/src/gin/google-gin/test/com/google/gwt/inject/rebind/util/Abstract
UtilTester.java:108:
getCompilationState(com.google.gwt.core.ext.TreeLogger) in
com.google.gwt.dev.cfg.ModuleDef cannot be applied to ()
[javac] compilationState = userModule.getCompilationState();
[javac] ^
[javac]
/home/bstoler/src/gin/google-gin/test/com/google/gwt/inject/rebind/util/Abstract
UtilTester.java:111:
cannot find symbol
[javac] symbol : method
addGeneratedCompilationUnit(com.google.gwt.dev.javac.CompilationUnit)
[javac] location: class com.google.gwt.dev.javac.CompilationState
[javac] compilationState.addGeneratedCompilationUnit(unit);
[javac] ^
[javac]
/home/bstoler/src/gin/google-gin/test/com/google/gwt/inject/rebind/util/Abstract
UtilTester.java:114:
compile(com.google.gwt.core.ext.TreeLogger,java.util.Set<com.google.gwt.dev.java
c.CompilationUnit>)
in com.google.gwt.dev.javac.CompilationState cannot be applied to
(com.google.gwt.dev.util.log.PrintWriterTreeLogger)
[javac] compilationState.compile(logger);
[javac] ^
[javac]
/home/bstoler/src/gin/google-gin/test/com/google/gwt/inject/rebind/util/Abstract
UtilTester.java:134:
com.google.gwt.inject.rebind.util.AbstractUtilTester.MyJavaSourceFile is
not abstract and does not override abstract method isSuperSource() in
com.google.gwt.dev.javac.JavaSourceFile
[javac] private static class MyJavaSourceFile extends JavaSourceFile {
[javac] ^
[javac] 4 errors
Seems like this merge from 1.6 changed APIs we use:
http://code.google.com/p/google-web-toolkit/source/detail?spec=svn4375&r=4032
I am afraid that our tests are depending on internal implementation details
of GWT and thus are bound to break. We may need to reconsider how we do
these tests. r61 changed these tests from using EasyMock to using GWT
internals to create instances of the needed Java AST types.
@aragos: What do you think we can do?
Original issue reported on code.google.com by [email protected]
on 2 Jan 2009 at 7:51
Gin should support provider methods. This would mean that the GinModule
would have to be instantiated and some of its methods actually called at
runtime. (We'd need to be careful to ensure that configure() still compiles
out completely.)
This may require changes in the Guice SPI to be done cleanly.
Original issue reported on code.google.com by [email protected]
on 28 Dec 2008 at 12:56
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.