mrszj / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Guice displays misleading line numbers #475

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Here is a sample error message I get under Guice 2.0:

------------
1) Error injecting constructor, java.lang.NullPointerException
  at wolverine.server.dutchpoker.Table.<init>(Table.java:38)
  while locating wolverine.server.dutchpoker.Table
    for parameter 0 at
wolverine.server.dutchpoker.PokerGame.<init>(PokerGame.java:37)
  while locating wolverine.server.dutchpoker.PokerGame
    for parameter 0 at
wolverine.server.dutchpoker.network.Server.<init>(Server.java:90)
  while locating wolverine.server.dutchpoker.network.Server

1 error
        at com.google.inject.InjectorImpl$4.get(InjectorImpl.java:767)
        at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:793)
        at wolverine.server.dutchpoker.network.Server.main(Server.java:210)
Caused by: java.lang.NullPointerException
        at wolverine.server.dutchpoker.Table.<init>(Table.java:65)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
------------

Pay attention to these sniplets:

at wolverine.server.dutchpoker.Table.<init>(Table.java:38)
at wolverine.server.dutchpoker.Table.<init>(Table.java:65)

The first line number is incorrect (points to "class Table" not its
constructor). The second line number is correct. In the first line number,
if Guice is trying to tell me that "I had problems injecting class Table
and here is its line number" that's fine, but I think it is misleading to
reference the constructor and point to a different line.

Please fix the error message or the line number.

Original issue reported on code.google.com by cowwoc...@gmail.com on 20 Apr 2010 at 11:19

GoogleCodeExporter commented 9 years ago
I tried reproducing and received correct line numbers.  If you have a 
reproducable case, please re-open and attach the test, and we can look into 
whether it is fixable.

Original comment by sberlin on 20 Feb 2011 at 11:25