Skip to content

Commit 473adc4

Browse files
committed
en: Add note about InternalsVisibleTo-similar funcionality in Java
1 parent d713af9 commit 473adc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_i18n/en/_posts/2019-04-05-java-for-csharp-programmers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ So, here is my list. Bear in mind that this is written from a C# programmer's pe
3232
- `private` and `public` - works pretty much the same as in C#.
3333
- `protected` - again, similar to its C# counterpart. A type with this visibility is visible to all subclasses (in the same package and others)
3434
- no modifier - `package private` - like `internal` in C#. Unfortunately, this can *only* be specified by not providing a modifier at all!
35-
- No concept like `InternalsVisibleTo`. This can be rather annoying, especially when working with unit tests and integration tests; you would want to tighten the visibility for a particular class and/or method and `InternalsVisibleTo` plays a nice role in this.
35+
- No concept like `InternalsVisibleTo`. This can be rather annoying, especially when working with unit tests and integration tests; you would want to tighten the visibility for a particular class and/or method and `InternalsVisibleTo` plays a nice role in this. _Update_: I discovered that you can slightly "workaround" this by putting test-related classes in the same package (i.e. `namespace` in the C# world) as the class being tested. That way, the test-related class can access the `internal` stuff because _in Java, `internal` takes the *package* into consideration rather than the *assembly*, which is the case in .NET_.
3636

3737
### Language runtime and language version much more tightly coupled
3838

0 commit comments

Comments
 (0)