Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Issue 722 in google-guice: PrivateModule prevents interceptors to be applied
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
google-gu...@googlecode.com  
View profile  
 More options Aug 2 2012, 8:44 am
From: google-gu...@googlecode.com
Date: Thu, 02 Aug 2012 12:44:29 +0000
Local: Thurs, Aug 2 2012 8:44 am
Subject: Issue 722 in google-guice: PrivateModule prevents interceptors to be applied
Status: New
Owner: ----

New issue 722 by wix...@gmail.com: PrivateModule prevents interceptors to  
be applied
http://code.google.com/p/google-guice/issues/detail?id=722

Description of the issue:
When an interceptor is bound inside a private module the original class  
will not be enhanced if its bound and exposed via an interface. If the  
class is bound and exposed directly or if the interface is bound in a non  
private module the interceptors are applied correctly. This seems incorrect  
and an inconsistent behavior.

Steps to reproduce:
1. run all 3 unit tests in attached InterceptorTest class
2. testPrivateModule fails, but the other 2 run fine

Attachments:
        InterceptorTest.java  2.7 KB


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
google-gu...@googlecode.com  
View profile  
 More options Aug 2 2012, 8:45 am
From: google-gu...@googlecode.com
Date: Thu, 02 Aug 2012 12:45:29 +0000
Local: Thurs, Aug 2 2012 8:45 am
Subject: Re: Issue 722 in google-guice: PrivateModule prevents interceptors to be applied

Comment #1 on issue 722 by wix...@gmail.com: PrivateModule prevents  
interceptors to be applied
http://code.google.com/p/google-guice/issues/detail?id=722

Probably related to issue702


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
google-gu...@googlecode.com  
View profile  
 More options Aug 2 2012, 9:04 am
From: google-gu...@googlecode.com
Date: Thu, 02 Aug 2012 13:04:16 +0000
Local: Thurs, Aug 2 2012 9:04 am
Subject: Re: Issue 722 in google-guice: PrivateModule prevents interceptors to be applied

Comment #2 on issue 722 by wix...@gmail.com: PrivateModule prevents  
interceptors to be applied
http://code.google.com/p/google-guice/issues/detail?id=722

upload new test without the @Ignore annotation

Attachments:
        InterceptorTest.java  2.6 KB


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
google-gu...@googlecode.com  
View profile  
 More options Aug 2 2012, 9:27 am
From: google-gu...@googlecode.com
Date: Thu, 02 Aug 2012 13:27:42 +0000
Local: Thurs, Aug 2 2012 9:27 am
Subject: Re: Issue 722 in google-guice: PrivateModule prevents interceptors to be applied
Updates:
        Status: WorkingAsIntended

Comment #3 on issue 722 by sberlin: PrivateModule prevents interceptors to  
be applied
http://code.google.com/p/google-guice/issues/detail?id=722

Somewhat unfortunately, this is working-as-designed.

Because of the way just-in-time-bindings work, in the HelloModulePrivate,  
Guice does not know that the statement:
  bind(HelloWord.class).to(HelloWorldImpl.class)
also means that 'HelloWorldImpl' is 'private'.  The statement is only  
saying, "Link HelloWorld to HelloWordImpl".  Because of that, HelloWordImpl  
is actually being bound in the parent module, and the interceptor in the  
private module can't see it.

This is why HelloModulePrivateNoInterface works -- you have a separate  
bind(HelloWorldImpl.class) line, telling Guice that HelloWorldImpl wants to  
be private.

If you add that bind statement (doesn't need to be a singleton as it is in  
HelloModulePrivateNoInterface) in the HelloModulePrivate, then things will  
start working.

Another fix would be to add 'binder().requireExplicitBindings()' to the  
parent Module, and that will tell Guice that you don't want just-in-time  
bindings at all, and everything should exist in the Module is was declared  
in.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
google-gu...@googlecode.com  
View profile  
 More options Aug 2 2012, 10:02 am
From: google-gu...@googlecode.com
Date: Thu, 02 Aug 2012 14:02:16 +0000
Local: Thurs, Aug 2 2012 10:02 am
Subject: Re: Issue 722 in google-guice: PrivateModule prevents interceptors to be applied

Comment #4 on issue 722 by wix...@gmail.com: PrivateModule prevents  
interceptors to be applied
http://code.google.com/p/google-guice/issues/detail?id=722

A bit surprising, but both your solutions work fine for me.
Many thanks for the prompt and useful reply!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »