Java程序编译时,出现‘xxx‘ is deprecated and marked for removal报错的临时处理方法

问题

当我们编译Java文件出现报错 ‘xxx’ is deprecated and marked for removal时,代表该语法类型不适合在此JDK版本下使用

原因分析

以下图JDK17版本下的第28行代码报错为例:
图例:包装类'Long(long)' 不建议使用
报错提示:‘Long(long)’ is deprecated and marked for removal
即包装类Long在当前版本JDK已弃用,建议删除。

鼠标悬停至下图报错红线“Long”处,得知Long包装类自从JDK9版本起,就不建议使用了。
报错详情

解决方法(临时)

(注意:此方法只是临时修改配置解决问题,具体是否使用要视具体情况而定,如公司是否允许。)
1.点击下图“Edit inspection profile setting”进入提示编辑页面
点击Edit inspection profile setting
2.把下图Severity中的Error改为Warning,点击OK
更改设置
3.观察报错发现报错消失,此时可以重新运行代码
报错消失

Warning: Permanently added '[gerrit-ssh.ce.tp-link.com]:29418' (ED25519) to the list of known hosts. repo sync has finished successfully. + echo Repo sync completed successfully! Repo sync completed successfully! + cd CAMEOS + repo forall -c # Only run if HEAD is detached if [ -z "$(git symbolic-ref --short -q HEAD)" ]; then # Get the remote branch names from origin/gerrit for b in $(git branch -r | grep "gerrit/" | sed "s|gerrit/||"); do # Just pick the branch that exists remotely git checkout -B $b gerrit/$b break done fi /usr/bin/repo:681: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() ... A new version of repo (2.54) is available. ... New version is available at: /home/ubuntu/workspace/H500/Tapo_H500_job2_nightly_image_compile/.repo/repo/repo ... The launcher is run from: /usr/bin/repo !!! The launcher is not writable. Please talk to your sysadmin or distro !!! to get an update installed. + awk /Host gerrit/,/^$/ /home/ubuntu/.ssh/config + awk /User/ {print $2} + GIT_PREFIX=jenkinsbuild6_bot + echo -------------cherry pick------------------ -------------cherry pick------------------ + git fetch ssh://jenkinsbuild6_bot@gerrit-ssh.ce.tp-link.com:29418/base/public/CAMEOS refs/changes/03/3/2 Warning: Permanently added '[gerrit-ssh.ce.tp-link.com]:29418' (ED25519) to the list of known hosts. Total 19 (delta 15), reused 19 (delta 15) From ssh://gerrit-ssh.ce.tp-link.com:29418/base/public/CAMEOS * branch refs/changes/03/3/2 -> FETCH_HEAD + git cherry-pick FETCH_HEAD## 修改pull ams和matter的脚本 fatal: bad revision 'FETCH_HEAD##' Build step 'Execute shell' marked build as failure Archiving artifacts Finished: FAILURE
最新发布
01-01
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值