Created
July 7, 2014 18:06
-
-
Save gissuebot/1c8f7e9bd98e3eefd11a to your computer and use it in GitHub Desktop.
Migrated attachment for Guice issue 235, comment 0
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
### Eclipse Workspace Patch 1.0 | |
#P guice | |
Index: test/com/googlecode/guice/PackagePrivateImpl.java | |
=================================================================== | |
--- test/com/googlecode/guice/PackagePrivateImpl.java (revision 0) | |
+++ test/com/googlecode/guice/PackagePrivateImpl.java (revision 0) | |
@@ -0,0 +1,6 @@ | |
+package com.googlecode.guice; | |
+ | |
+ | |
+class PackagePrivateImpl implements PackagePrivateInterface { | |
+ | |
+} | |
Index: test/com/googlecode/guice/PackagePrivateInterface.java | |
=================================================================== | |
--- test/com/googlecode/guice/PackagePrivateInterface.java (revision 0) | |
+++ test/com/googlecode/guice/PackagePrivateInterface.java (revision 0) | |
@@ -0,0 +1,5 @@ | |
+package com.googlecode.guice; | |
+ | |
+interface PackagePrivateInterface { | |
+ | |
+} | |
Index: test/com/googlecode/guice/PackageVisilibityTestModule.java | |
=================================================================== | |
--- test/com/googlecode/guice/PackageVisilibityTestModule.java (revision 0) | |
+++ test/com/googlecode/guice/PackageVisilibityTestModule.java (revision 0) | |
@@ -0,0 +1,13 @@ | |
+package com.googlecode.guice; | |
+ | |
+import com.google.inject.AbstractModule; | |
+ | |
+ | |
+public class PackageVisilibityTestModule extends AbstractModule { | |
+ | |
+ @Override | |
+ protected void configure() { | |
+ bind(PackagePrivateInterface.class).to(PackagePrivateImpl.class); | |
+ } | |
+ | |
+} | |
Index: test/com/googlecode/guice/PublicUserOfPackagePrivate.java | |
=================================================================== | |
--- test/com/googlecode/guice/PublicUserOfPackagePrivate.java (revision 0) | |
+++ test/com/googlecode/guice/PublicUserOfPackagePrivate.java (revision 0) | |
@@ -0,0 +1,9 @@ | |
+package com.googlecode.guice; | |
+ | |
+import com.google.inject.Inject; | |
+ | |
+public class PublicUserOfPackagePrivate { | |
+ | |
+ @Inject public PublicUserOfPackagePrivate(PackagePrivateInterface ppi) {} | |
+ | |
+} | |
Index: test/com/google/inject/InjectorTest.java | |
=================================================================== | |
--- test/com/google/inject/InjectorTest.java (revision 603) | |
+++ test/com/google/inject/InjectorTest.java (working copy) | |
@@ -18,11 +18,16 @@ | |
import static com.google.inject.Asserts.assertContains; | |
import static com.google.inject.Asserts.assertNotSerializable; | |
+import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
+ | |
import java.io.IOException; | |
import java.lang.annotation.Retention; | |
-import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
+ | |
import junit.framework.TestCase; | |
+import com.googlecode.guice.PackageVisilibityTestModule; | |
+import com.googlecode.guice.PublicUserOfPackagePrivate; | |
+ | |
/** | |
* @author crazybob@google.com (Bob Lee) | |
*/ | |
@@ -361,6 +366,12 @@ | |
"@ProvidedBy points to the same class it annotates"); | |
} | |
} | |
+ | |
+ public void testPackageVisibility() { | |
+ Injector injector = Guice.createInjector(new PackageVisilibityTestModule()); | |
+ injector.getInstance(PublicUserOfPackagePrivate.class); // This must pass. | |
+ } | |
+ | |
static class MyRunnable implements Runnable { | |
public void run() {} | |
Index: test/com/googlecode/guice/PackagePrivateImpl.java | |
=================================================================== | |
--- test/com/googlecode/guice/PackagePrivateImpl.java (revision 0) | |
+++ test/com/googlecode/guice/PackagePrivateImpl.java (revision 0) | |
@@ -0,0 +1,6 @@ | |
+package com.googlecode.guice; | |
+ | |
+ | |
+class PackagePrivateImpl implements PackagePrivateInterface { | |
+ | |
+} | |
Index: test/com/googlecode/guice/PackagePrivateInterface.java | |
=================================================================== | |
--- test/com/googlecode/guice/PackagePrivateInterface.java (revision 0) | |
+++ test/com/googlecode/guice/PackagePrivateInterface.java (revision 0) | |
@@ -0,0 +1,5 @@ | |
+package com.googlecode.guice; | |
+ | |
+interface PackagePrivateInterface { | |
+ | |
+} | |
Index: test/com/googlecode/guice/PackageVisilibityTestModule.java | |
=================================================================== | |
--- test/com/googlecode/guice/PackageVisilibityTestModule.java (revision 0) | |
+++ test/com/googlecode/guice/PackageVisilibityTestModule.java (revision 0) | |
@@ -0,0 +1,13 @@ | |
+package com.googlecode.guice; | |
+ | |
+import com.google.inject.AbstractModule; | |
+ | |
+ | |
+public class PackageVisilibityTestModule extends AbstractModule { | |
+ | |
+ @Override | |
+ protected void configure() { | |
+ bind(PackagePrivateInterface.class).to(PackagePrivateImpl.class); | |
+ } | |
+ | |
+} | |
Index: test/com/googlecode/guice/PublicUserOfPackagePrivate.java | |
=================================================================== | |
--- test/com/googlecode/guice/PublicUserOfPackagePrivate.java (revision 0) | |
+++ test/com/googlecode/guice/PublicUserOfPackagePrivate.java (revision 0) | |
@@ -0,0 +1,9 @@ | |
+package com.googlecode.guice; | |
+ | |
+import com.google.inject.Inject; | |
+ | |
+public class PublicUserOfPackagePrivate { | |
+ | |
+ @Inject public PublicUserOfPackagePrivate(PackagePrivateInterface ppi) {} | |
+ | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment