ceylon.interop.java {CeylonList}에서 파생 된 실론 클래스를 Java 단위로 가져 오려고합니다 (실론 용어로는 모듈을 불렀지 만, java는 아직 파생되지 않았다)이 파생 된 실론 클래스를 포함하는 실론 모듈 외부.실론과 자바의 상호 운용성 : 'ceylon.language'에서 가져온 것을 공유하는 방법
run.ceylon :
import java.util {
JList=List
}
import ceylon.interop.java {
CeylonList
}
// CL is deliberately annotated as 'shared' - this is the crucial point !!
shared class CL(JList<out Integer> jil) extends CeylonList<Integer>(jil) {}
내가 '공유'로 모듈 설명에서 가져온 모듈에 주석을 자바 측의 수입 모듈을 볼 수 있도록합니다.
module.ceylon :
이native ("jvm") module com.example.simple "1.0.0" {
shared import "java.base" "8";
shared import ceylon.collection "1.2.2";
shared import ceylon.interop.java "1.2.2";
}
그러나 컴파일러는 아직보고 오류 :
source/com/example/simple/run.ceylon:18: error: supertype of type 'CL' that is visible outside this module comes from an imported module that is not re-exported: 'Collection<Integer>' involves an unexported type declaration
shared class CL(JList<out Integer> jil) extends CeylonList<Integer>(jil) {}
^
source/com/example/simple/run.ceylon:18: error: supertype of type 'CL' that is visible outside this module comes from an imported module that is not re-exported: 'List<Integer>' involves an unexported type declaration
shared class CL(JList<out Integer> jil) extends CeylonList<Integer>(jil) {}
^
source/com/example/simple/run.ceylon:18: error: supertype of type 'CL' that is visible outside this module comes from an imported module that is not re-exported: 'Correspondence<Integer,Integer>' involves an unexported type declaration
shared class CL(JList<out Integer> jil) extends CeylonList<Integer>(jil) {}
^
source/com/example/simple/run.ceylon:18: error: supertype of type 'CL' that is visible outside this module comes from an imported module that is not re-exported: 'Ranged<Integer,Integer,List<Integer>>' involves an unexported type declaration
shared class CL(JList<out Integer> jil) extends CeylonList<Integer>(jil) {}
해결책이하는 것 재수출 ceylon.language
...
shared import ceylon.language "1.2.2";
...
그러나에
한 손으로 ceylon.language는 전혀 수입 될 수 없으므로 다시 내보낼 수도없고 주석을 달 수도 없습니다.반면에 가져온 모든 모듈이 공유 된 것으로 주석 처리 되었기 때문에 '가져온 모듈은 다시 내보낼 수 없습니다 ...'라는 것을 발견 할 수 없습니다.
은 제외 :
package some.other.package
// And thus some.other.module if there were
import com.example.simple.*;
import java.util.* ;
public class Use{
public static void main (String[] args) {
LinkedList ll = new LinkedList();
ll.add(1);
ll.add(2);
CL c = new CL(ll);
}
}
문제는 지금 (위의 오류 메시지 참조)된다 run.ceylon에서 클래스 CL은 Use.java 수입 Use.java
에 사용된다 1.이 모듈 외부에서 볼 수있는 'CL'유형의 수퍼 유형은 다시 가져 오기되지 않은 가져온 모듈에서 가져오고 2. 다시 내보내기하는 방법은 무엇입니까?
@ user3464741 https://github.com/ceylon/ceylon/issues에서 버그 신고를 제출 하시겠습니까? –
실례 합니다만, 나는 지난 주 ceylon 1.2.3 nightly build로 컴파일했다고 언급하는 것을 잊어 버렸습니다. run.ceylon의 '공유 된'주석 (즉 '공유 클래스 CL'만 '클래스 CL') 대신에 실론 선언을 동일한 모듈의 Java 코드에서 사용할 수 있습니다. 그러나 모듈 밖에서는 아닙니다. 이는 run.ceyon에서 CL을 '공유'로 주석 처리해야합니다. 그리고 정확하게 이것은 오류로 이어집니다. – Michael
물론 알겠습니다. 나는 당신이 언급 한 오류가 현재의 1.2.3 빌드에만 해당된다고 생각한다. –