ant无法确定 <T>T 的类型参数

本文介绍了一个在Eclipse环境下使用Ant进行项目编译时遇到的问题:编译提示类型参数错误。通过更改方法签名的方式解决了这一问题,并分享了具体的解决步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[size=medium]在eclipse下使用ant打包编译时,提示[/size]
[quote]无法确定 <T>T 的类型参数;对于上限为 int,java.lang.Object 的类型变量 T,不存在唯一最大实例[/quote]

[size=medium]其中ant javac task如下[/size]
[quote]<javac destdir="${tempfile}" source="1.6" target="1.6" encoding="utf-8" debug="on" deprecation="on">
<classpath refid="classpath"></classpath>
<src path="${src}"></src>
</javac>[/quote]

[size=medium]在网上找到了这篇文章[/size]
[url]http://www.blogjava.net/hoojo/archive/2013/10/31/405846.html[/url]
[size=medium]即需要用到eclipse的jdt来编译class,不能再使用javac的默认编译方式。
需要指定jar包,于是回头看代码[/size]
public int checkCompaneyIsAt( HashMap<String, Object> paramsMap){
return this.selectOne("checkCompaneyIsAt",paramsMap);
}

[size=medium]其中selectOne的方法定义为[/size]
public  <T> T selectOne(String statementName, Object param)


[size=medium]将方法改成[/size]
public Integer checkCompaneyIsAt( HashMap<String, Object> paramsMap){
return this.selectOne("checkCompaneyIsAt",paramsMap);
}


[size=medium]编译通过[/size]
关于结构体的定义: struct BeamData { int Frame_Id = 0; QVector<double> ADC_Matrix_Ant1; QVector<double> ADC_Matrix_Ant2; // 序列化支持 friend QDataStream &operator<<(QDataStream &out, const BeamData &b) { return out << b.Frame_Id << b.ADC_Matrix_Ant1 << b.ADC_Matrix_Ant2; } friend QDataStream &operator>>(QDataStream &in, BeamData &b) { return in >> b.Frame_Id >> b.ADC_Matrix_Ant1 >> b.ADC_Matrix_Ant2; } }; struct Radar_ADC_Struct { int Rotate_Scan_Id = 0; qint64 toc = 0; QVector<double> Radar_Angle_Vector; QVector<double> Radar_Wavelength_Vector; QVector<BeamData> beams; QVector<QVector<double>> ANT_CAL_MATRIX; // 序列化支持 friend QDataStream &operator<<(QDataStream &out, const Radar_ADC_Struct &r) { return out << r.Rotate_Scan_Id << r.toc << r.Radar_Angle_Vector << r.Radar_Wavelength_Vector << r.beams << r.ANT_CAL_MATRIX; } friend QDataStream &operator>>(QDataStream &in, Radar_ADC_Struct &r) { return in >> r.Rotate_Scan_Id >> r.toc >> r.Radar_Angle_Vector >> r.Radar_Wavelength_Vector >> r.beams >> r.ANT_CAL_MATRIX; } }; 连续大量类似报错: 1.E:\Qt_work\Deformation_Monitor\Deformation_Monitor_V1_1\globaldata.h:16: error: no match for 'operator<<' (operand types are 'QDataStream' and 'const QVector<double>') return out << b.Frame_Id << b.ADC_Matrix_Ant1 << b.ADC_Matrix_Ant2; ^ 2.E:\Qt_work\Deformation_Monitor\Deformation_Monitor_V1_1\globaldata.h:19: error: ambiguous overload for 'operator>>' (operand types are 'QDataStream' and 'int') return in >> b.Frame_Id >> b.ADC_Matrix_Ant1 >> b.ADC_Matrix_Ant2; ^ 3.E:\Qt_work\Deformation_Monitor\Deformation_Monitor_V1_1\globaldata.h:19: error: invalid user-defined conversion from 'int' to 'QString&' [-fpermissive] return in >> b.Frame_Id >> b.ADC_Matrix_Ant1 >> b.ADC_Matrix_Ant2; ^ 4.E:\Qt_work\Deformation_Monitor\Deformation_Monitor_V1_1\globaldata.h:19: error: invalid conversion from 'int' to 'const char*' [-fpermissive] return in >> b.Frame_Id >> b.ADC_Matrix_Ant1 >> b.ADC_Matrix_Ant2; ^ 5.E:\Qt_work\Deformation_Monitor\Deformation_Monitor_V1_1\globaldata.h:19: error: invalid conversion from 'int' to 'const char*' [-fpermissive] 6.E:\Qt_work\Deformation_Monitor\Deformation_Monitor_V1_1\globaldata.h:19: error: invalid user-defined conversion from 'int' to 'QByteArray&' [-fpermissive] return in >> b.Frame_Id >> b.ADC_Matrix_Ant1 >> b.ADC_Matrix_Ant2; ^
03-26
<template> <div class="transfer-container"> <!-- 左侧表格 --> <div class="table-container"> <div class="header-box"> <span>设备列表</span> <span class="checkAll" @click="checkAll">全选</span> </div> <div class="select-box"> <div class="select-item"> <span>{{ $t('主机型号:') }}</span> <a-select v-model="hostModel" @change="changeSelect" :placeholder="$t('请选择主机型号')" allowClear> <a-select-option v-for="item in periodList" :key="item.id" :value="item.itemDesc" :title="item.itemName"> {{ item.itemName }} </a-select-option> </a-select> </div> <div class="select-item"> <span>{{ $t('组织名称:') }}</span> <org-tree-select @treeSelect="orgTreeSelect"></org-tree-select> </div> </div> <!-- 左侧列表 --> <div class="list-container"> <div v-for="item in leftData" :key="item.personId" class="list-item"> <a-checkbox v-model="item.checked" :disabled="item.deviceOnOffLine == 0 || item.configStatus == 1" class="checkbox" ></a-checkbox> <div class="device-box"> <div class="top-info"> <span>{{ item.deviceName }}</span> <span v-show="item.configStatus == 1" @click="openTask(item)"> <hd-icon type="files" /> {{ $t('已配任务') }} </span> </div> <div class="bottom-info"> <span>{{ $t('探测器信息:') }}</span> <span>{{ item.detectorName }} </span> | <span>{{ item.productModel }} </span> | <span>{{ item.detectorUniqueCode }} </span> </div> </div> </div> <a-empty v-show="leftData.length === 0" /> </div> <div v-if="leftData.length" class="pagination"> <a-pagination simple :defaultCurrent="pagination.currentPage" :total="pagination.totalRows" @change="changePage" /> </div> </div> <!-- 中间操作按钮 --> <div class="transfer-actions"> <a-button type="primary" icon="right" :disabled="selectedLeft.length === 0" @click="moveToRight"> </a-button> </div> <!-- 右侧表格 --> <div class="table-container right-content"> <div class="header-box"> <span>{{ $t('已选择列表') + '(' + rightData.length + ')' }}</span> <a-button type="primary" :disabled="rightData.length === 0" @click="clearAll"> 清除 </a-button> </div> <div class="list-container"> <div v-for="item in rightData" :key="item.personId" class="list-item right-list"> <div class="device-box"> <div class="top-info"> <span>{{ item.deviceName }}</span> <div>{{ item.detectorOwnerName }}</div> <span v-show="item.configStatus == 1" @click="openTask(item)"> <hd-icon type="files" /> {{ $t('已配任务') }} </span> </div> <div class="bottom-info"> <span>{{ $t('探测器信息:') }}</span> <span>{{ item.detectorName }} </span> | <span>{{ item.productModel }} </span> | <span>{{ item.detectorUniqueCode }} </span> </div> </div> <img src="@/assets/img/icon-remove.png" @click="moveToLeft(item)" alt="" /> </div> <a-empty v-show="rightData.length === 0" /> </div> </div> <!-- 定时任务已存在 --> <myModal :params="{ title: $t('已配置任务列表'), showFooter: false }" :visible="visible" @cancel="visible = false" destroyOnClose > <template v-slot:header><span></span></template> <template v-slot:body> <div class="table_title"> {{ $t('探测名称') }} </div> <a-table :columns="detailColumns" :scroll="{ x: '100%', y: 400 }" :dataSource="detailData" row-key="id" :pagination="false" > </a-table> </template> </myModal> </div> </template> <script> import factory from '../factory' import myModal from '@/components/scfComponents/modalComponents/modal.vue' import orgTreeSelect from '@/components/orgTreeSelect/orgTreeSelect' export default { components: { myModal, orgTreeSelect }, data() { return { visible: false, // 弹窗 periodList: [], // 主机型号列表 orgData: {}, // 组织树数据 leftData: [], // 左侧表格数据 rightData: [], // 右侧表格数据 pagination: { pageSize: 10, currentPage: 1, totalRows: 0, }, // 分页 // 已配任务列表表头 detailColumns: [ { title: this.$t('日期'), dataIndex: 'date', ellipsis: true, }, { title: this.$t('时间'), dataIndex: 'executeTime', ellipsis: true, }, { title: this.$t('空开操作'), dataIndex: 'operation', ellipsis: true, }, ], // 已配任务列表数据 detailData: [], } }, computed: { // 选中左侧列表 selectedLeft() { return this.leftData.filter(item => item.checked) }, }, mounted() { this.getDic() // 初始化数据 this.leftData = [] this.rightData = [] }, methods: { // 主机型号列表 getDic() { factory.getDic(1080).then(res => { this.periodList = res }) }, // 获取左侧表格数据 getLeftTableData() { let params = { page: this.pagination.currentPage, orgCodes: [this.orgData.orgCode], productModel: this.hostModel, } factory.getBatchDetector(params).then(res => { if (res.success) { this.leftData = res.data.map(item => ({ ...item, checked: false })) || [] // 如果右侧存在数据需要把数据过滤一下 if (this.rightData.length > 0) { let ids = this.rightData.map(item => item.id) this.leftData = this.leftData.filter(item => !ids.includes(item.id)) } } }) }, // 查询已存在空开定时任务 getDetectorJob(record) { factory.getDetectorJob(record.jobId).then(res => { if (res.success) { this.detailData = res.data.map(item => { item.detectorName = record.detectorName || '' item.weekList = this.getActiveWeeks(item.rept) return item }) || [] } }) }, // 主机型号 changeSelect(value) { if (value && Object.keys(this.orgData).length > 0) { this.getLeftTableData() } else { this.leftData = [] } }, getActiveWeeks(rept) { const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] const pattern = rept.split('') return pattern .map((char, index) => (char == '1' ? weekDays[index] : null)) .filter(Boolean) .join('、') }, // 组织树节点选择 orgTreeSelect(node) { this.orgData = node if (this.hostModel && Object.keys(this.orgData).length > 0) { this.getLeftTableData() } else { this.leftData = [] } }, // 全选 checkAll() { if (this.leftData.length === 0) return this.leftData.forEach(item => { if (item.deviceOnOffLine == 1 && item.configStatus == 0) { item.checked = true } }) }, // 清除 clearAll() { const newLeft = [...this.leftData] this.rightData.forEach(rightItem => { if (!newLeft.some(leftItem => leftItem.id == rightItem.id)) { newLeft.push({ ...rightItem, checked: false }) } }) this.leftData = newLeft this.rightData = [] }, // 向右移动选中项 moveToRight() { this.rightData = [...this.rightData, ...this.selectedLeft] this.leftData = this.leftData.filter(item => !this.selectedLeft.some(i => i.id === item.id)) }, // 向左移动单个项 moveToLeft(item) { this.rightData = this.rightData.filter(i => i.id !== item.id) this.leftData = [...this.leftData, { ...item, checked: false }] }, // 打开已配置任务列表 openTask(record) { this.visible = true this.getDetectorJob(record) }, }, } </script> <style lang="less" scoped> .transfer-container { width: 100%; display: flex; justify-content: space-around; box-sizing: border-box; } .table-container { width: 48%; height: 100%; position: relative; font-family: '微软雅黑'; font-weight: 400; border: 1px solid #ebedef; .header-box { height: 46px; width: 100%; display: flex; align-items: center; padding: 0 16px; border-bottom: 1px solid rgb(229, 231, 234); background: rgb(242, 243, 244); justify-content: space-between; color: rgb(21, 23, 26); font-size: 14px; font-weight: 700; .checkAll { cursor: pointer; color: rgb(41, 141, 255); } } .select-box { display: flex; height: 64px; padding: 0 20px; align-items: center; .select-item { margin-right: 24px; color: rgb(157, 166, 177); > span:first-child { margin-right: 5px; } } } .list-container { padding: 0 20px; height: 392px; overflow-y: scroll; .list-item { height: 74px; display: flex; align-items: center; .device-box { margin-left: 16px; .top-info { display: flex; align-items: center; span { cursor: pointer; color: #298dff; font-size: 14px; } div { height: 24px; border-radius: 2px; font-size: 12px; display: flex; cursor: default; margin-right: 24px; align-items: center; padding: 0 8px; color: rgb(66, 75, 86); background: rgb(236, 238, 240); } span:first-child { color: rgb(21, 23, 26); font-size: 16px; cursor: default; margin-right: 24px; } } .bottom-info { color: rgb(105, 118, 136); font-size: 14px; > span { margin: 0 5px; } } } } } .pagination { display: flex; height: 58px; align-items: center; justify-content: flex-end; } } .right-content { .device-box { margin: 0; } .list-container { height: 514px; .list-item { justify-content: space-between; .device-box { margin: 0; } img { width: 20px; height: 20px; display: inline-block; } } } } .transfer-actions { margin-top: 56px; display: flex; flex-direction: column; justify-content: center; } </style> 代码评审
最新发布
08-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值