I have a module organized as such:
foo/
src/
main/
java/
com.org.pkg/
...(some java files)
kotlin/
com.org.pkg/
Foo.kt
test/
java/
com.org.pkg/
FooTest.java
Where Foo.kt is:
package com.org.pkg
internal class Foo {
fun bar() = "bar"
}
and FooTest.java is:
package com.org.pkg;
import org.testng.annotations.Test;
@Test
public class FooTest {
@Test
public void testBar() {
Foo foo = new Foo();
}
}
I’m getting errors at references to Foo
on FooTest.java:
Usage of Kotlin internal declaration from different module
However, I believe it’s still in the same foo
module, so why is this error happening?
The reason of why I’m doing this is I am currently trying to port some of my code from Java (inside main/java
) to Kotlin (inside main/kotlin
). Previously the Java classes has package-private modifiers.
Note that if I convert the FooTest.java into Kotlin (via IDEA convert functionality) the errors don’t happen, so it only happens when the test file is in Java.
Would really appreciate the help!