는 다음과 같은 방법을 감안할 때 : 일반 메서드가 지정된 메서드 서명과 호환되지 않습니다?
public <E> void bindContentBidirectional(final String fieldPath,
final String itemFieldPath, final Class<?> itemFieldPathType,
final ObservableList<E> list, final Class<E> listValueType,
final SelectionModel<E> selectionModel,
final String selectionModelItemMasterPath)
내가 나의 이해에 정정 오전, 그 난의 종류로서
ObservableList<PrintablePredicate<SomeClass>>
이있는 경우 :
final ObservableList<E> list
(즉이 작동하지 않을 수 있다는 E = PrintablePredicate<SomeClass>
입니다 왜냐하면 다음 인수 때문에 :
final Class<E> listValueType)
나는 단지 PrintablePredicate.class를 쓸 수 있고, PrintablePredicate.class는 유전자로 쓸 수 없기 때문에 유형이 구체화되지 않았습니다. 즉, bindContentBidirectional에 대한 지정된 메서드 서명은 E가 제네릭 형식 인수를 갖도록 모든 E와 호환되지 않습니다. 구체적인 코드 시나리오에서 모두 함께 퍼팅
는, 우리가 말 :
이@FXML private CheckListView<PrintablePredicate<Miner>> profileConditions;
private MinerMonitorProfile minerMonitorProfile;
private void initialize() {
BeanPathAdapter<MinerMonitorProfile> minerMonitorProfileBPA = new BeanPathAdapter<> (this.minerMonitorProfile);
minerMonitorProfileBPA.bindContentBidirectional("conditions", null, String.class, this.profileConditions.getItems(), PrintablePredicate.class, null, null);
}
컴파일러는 말한다 :
유형
BeanPathAdapter<MinerMonitorProfile>
의 방법bindContentBidirectional(String, String, Class<?>, ObservableList<E>, Class<E>, SelectionModel<E>, String)
이 인수 적용되지 않습니다 (String
,null
,Class<String>
,ObservableList<PrintablePredicate<Miner>>
,Class<PrintablePredicate>
,null
,null
)
어쨌든이 문제가 있습니까? 감사!
참고 : this.profileConditions.getItems()
반환 입력에서와 같이 메서드 호출을 매개 변수화하는 것이 ObservableList<PrintablePredicate<Miner>>
또한 참고 :
minerMonitorProfileBPA.<PrintablePredicate<Miner>>bindContentBidirectional("conditions", null, String.class, this.profileConditions.getItems(), PrintablePredicate.class, null, null);
문제를 완화하지 않습니다.
실제로 작동했습니다. 매우 감사합니다. 우연히 (또는 다른 누군가) 내가 겉으로보기에는 마법 같은 이중 주조에 대해 배울 수있는 자원이 있습니까? 감사합니다.) – brcolow
불행히도 나는 그것에 대해 읽지 않았습니다. 그것은 언젠가 그런 종류의 문제로 어려움을 겪었을 때 알게된 속임수입니다. 그 트릭이 무엇을 설명하려고하는지에 대한 대답에 더 많은 정보를 추가 할 것입니다. –
흠 ... 솔직히 말하면 솔직히 말해서, 내가 발견 한 해킹의 일종이라고 생각합니다. 왜냐하면 코드가 먼저 클래스를 변수에 할당하면 코드가 작동하기 때문에 (예 : "class clazz = PrintablePredicate.class"를 사용하여 메서드 호출) 그 변수를 메서드에 전달하면됩니다. 그래서이 컴파일 오류가 자바 컴파일러에서 일종의 버그 일종의 경우 궁금합니다. –