Issue 119 in google-gin: NPE in BindingsProcessor.createImplicitBinding

63 views
Skip to first unread message

googl...@googlecode.com

unread,
Oct 10, 2010, 9:11:00 AM10/10/10
to googl...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 119 by dusan.maliarik: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Using both trunk and 1.0, I'm getting following exception which doesn't
provide much information on how to fix my bindings. This one is produced by
trunk version of gin:

14:59:13.680 [ERROR] [client]
Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw threw an
exception while rebinding 'org.ires.gwt.client.gin.ClientGinjector'
java.lang.NullPointerException: null
at
com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBinding(BindingsProcessor.java:491)
at
com.google.gwt.inject.rebind.BindingsProcessor.access$900(BindingsProcessor.java:98)
at
com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.addImplicitBinding(BindingsProcessor.java:967)
at
com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:957)
at
com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:888)
at
com.google.inject.internal.UntargettedBindingImpl.acceptTargetVisitor(UntargettedBindingImpl.java:40)
at
com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:817)
at
com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:810)
at
com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:92)
at
com.google.gwt.inject.rebind.BindingsProcessor.createBindingsForModules(BindingsProcessor.java:402)
at
com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:237)
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.javac.StandardGeneratorContext.runGenerator(StandardGeneratorContext.java:418)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:38)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindOracle.java:108)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:54)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:154)
at
com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:119)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:531)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:414)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:39)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at org.ires.gwt.client.Client.<init>(Client.java:13)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:422)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:361)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Thread.java:619)

googl...@googlecode.com

unread,
Oct 11, 2010, 1:16:55 AM10/11/10
to googl...@googlegroups.com
Updates:
Status: Accepted
Owner: aragos

Comment #1 on issue 119 by aragos: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Interesting, you're trying to bind a type which GWT can't seem to find. I
can provide you with a patched Gin version that will give a better error
message as to which type is affected.

http://codesearch.google.com/codesearch/p?hl=en#d7yaITFH7NQ/trunk/src/com/google/gwt/inject/rebind/util/KeyUtil.java&l=111

googl...@googlecode.com

unread,
Feb 12, 2011, 6:02:50 PM2/12/11
to googl...@googlegroups.com
Updates:
Status: WontFix

Comment #2 on issue 119 by aragos: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Marking as "won't fix" for now since we have too little information on how
this came about.

googl...@googlecode.com

unread,
Feb 14, 2011, 1:37:05 PM2/14/11
to googl...@googlegroups.com

Comment #3 on issue 119 by smc...@google.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Ah. Dropped off my radar.

FYI, I see that we get this type of error when we mistakenly reference a
non-gwt class (well, one without a source file available for GWT). I'll
open a new bug if feeling properly motivated by additional errors.

googl...@googlecode.com

unread,
Jan 25, 2012, 3:52:27 PM1/25/12
to googl...@googlegroups.com

Comment #4 on issue 119 by joerg.ho...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

I also get such errors a lot and I am pretty much left alone in space
tracking down the actual problem.

> I can provide you with a patched Gin version
> that will give a better error message as to which type is affected.

That would really save the world. However the provided link does not work
for me.

googl...@googlecode.com

unread,
Jan 26, 2012, 5:38:06 PM1/26/12
to googl...@googlegroups.com

Comment #5 on issue 119 by joerg.ho...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Hi again,

Class: com.google.gwt.inject.rebind.BindingsProcessor
Method: createImplicitBinding
Line 498 (or 491):
if (rawClassType.equals(ginjectorInterface)) {

For some reason the TypeOracle can return null for rawClassType and then
you get this NPE. An excellent improvement would be to add this before the
if stated above:

if (rawClassType == null) {
throw new IllegalStateException("Failed to resolve " + key);
}

googl...@googlecode.com

unread,
Jan 26, 2012, 6:26:33 PM1/26/12
to googl...@googlegroups.com

Comment #6 on issue 119 by joerg.ho...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

I tracked my problem down to the root and in the end I used an
someClass.isAssignableFrom(otherClass)
what is not compliant with GWT client code.
I would expect the GWT Compiler to log something in such case. I got no
message for this problem even with -loglevel DEBUG.
Not a problem of GIN but if you have good connections to GWT core team
please let them know to improve... Thanks for all!

googl...@googlecode.com

unread,
May 8, 2012, 5:06:07 AM5/8/12
to googl...@googlegroups.com

Comment #7 on issue 119 by AndiShea...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Whoever runs into the same problem: Maybe you have excluded certain classes
from your gwt.xml file.

E.g. I excluded all classes ending in *Mock and just spent an hour on this
issue. ;)

googl...@googlecode.com

unread,
Aug 13, 2012, 7:37:06 AM8/13/12
to googl...@googlegroups.com

Comment #8 on issue 119 by grz3gorz...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

It's very easy to reproduce this problem. It happens when there are some
gwt compiler errors in the class file.

I checked what's default behavior in gwt without gin (on sample starter
project from eclipse). It's enough to add

Double.doubleToLongBits(0.0);

in EntryPoint#onModuleLoad(); to see in the dev mode console logs about the
exact location and explanation of the error.

The error is reported in CompilingClassLoader#findClassBytes(String)
(http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java#1331).
It seems that NPE is crashing compilation before the error is reported.

Maybe it's possible to avoid that NPE, and when control reaches the class
loader, the exact information about the error will be displayed as in non
gin project.

googl...@googlecode.com

unread,
Sep 2, 2012, 2:09:40 PM9/2/12
to googl...@googlegroups.com

Comment #9 on issue 119 by pablocha...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Why is this issue in the WontFix category? it's a defect in the compiler,
isn't it? And one that costs many hours to developers, as we are left alone
in the dark wondering which is the offending class. Besides, it looks like
a very easy to reproduce error. Should I consider it a compiler "feature"
then?

googl...@googlecode.com

unread,
Sep 2, 2012, 2:13:10 PM9/2/12
to googl...@googlegroups.com
Updates:
Status: New

Comment #10 on issue 119 by aragos: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Reopening due to more information. We should be able to emit a better error
message now that there is a reproducible way to test the bug with.

googl...@googlecode.com

unread,
Sep 19, 2012, 7:45:21 PM9/19/12
to googl...@googlegroups.com

Comment #11 on issue 119 by joew...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Historically, I've seen this NPE when I've inadvertently used a non-client
class in a client class. In this case, the GWT compiler (ref. GWT 2.4.0)
can identify the offending import. Note that this technique does not help
for all causes of client compilation failure, and it should not decrease
priority of this ticket.

With Google Plugin for Eclipse hosted dev mode:
1. On the launch configuration on the GWT tab, set "Log level" to TRACE.
2. Launch using that configuration, and load the launch URL to generate
the error.
3. In the Development Mode window, expand the "Validating newly compiled
units" item.
4. Beneath the "Validating newly compiled units" item, expand each "Error
in..." item that cites a file in client or shared packages.
5. Scan for items of the form: "Line NN: No source code is available for
type XXXX; did you forget to inherit a required module?"

Some of those messages will be irrelevant (e.g.
requestfactory.vm.impl.Deobfuscator.Builder), but one of them will be the
offending non-client class.

You can get the same info in more grep-friendly form by compiling with
-logLevel TRACE.


googl...@googlecode.com

unread,
Jul 1, 2014, 3:21:56 AM7/1/14
to googl...@googlegroups.com

Comment #12 on issue 119 by PetrG...@gmail.com: NPE in
BindingsProcessor.createImplicitBinding
http://code.google.com/p/google-gin/issues/detail?id=119

Can anyone add that better error message mentioned in
http://code.google.com/p/google-gin/issues/detail?id=119#c5

After this change I would consider this bug fixed as long as key allows to
guess which class is being resolved.

That is simple change and would help a lot when this error occurs.
Currently GIN is not helpful in this case. It is no fun trying to track
reason of this error by randomly pocking in configuration instead of
getting at least some error message.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages