/**
* Returns the name of the parameter. If the parameter's name is
* {@linkplain #isNamePresent() present}, then this method returns
* the name provided by the class file. Otherwise, this method
* synthesizes a name of the form argN, where N is the index of
* the parameter in the descriptor of the method which declares
* the parameter.
*
* @return The name of the parameter, either provided by the class
* file or synthesized if the class file does not provide
* a name.
*/
public String getName() {
// Note: empty strings as paramete names are now outlawed.
// The .equals("") is for compatibility with current JVM
// behavior. It may be removed at some point.
if(name == null || name.equals(""))
return "arg" + index;
else
return name;
}

说明:

  • jdk1.8反射包增加了Parameter类,通过该类的getName方法能在运行时得到参数的名称
  • 如果没有通过-parameters指定编译器在编译的时候将参数名编译进去,那么得到的参数名称将会是arg1、arg2、arg3这种默认的参数名

图说jdk1.8新特性(5)--- 编译器新特性的更多相关文章

  1. 线程基础:JDK1.5+(9)——线程新特性(中)

    (接上文<线程基础:JDK1.5+(8)--线程新特性(上)>) 3.工作在多线程环境下的"计数器": 从这个小节開始,我们将以一个"赛跑"的样例. ...

  2. iOS开发——新特性篇&swift新特性(__nullable和__nonnull)

    swift新特性(__nullable和__nonnull) 最近在看老师写代码的时候经常遇到两个陌生的关键字,但是当我在我的电脑上敲得时候就是敲不出,后来才知道这是为了swift与OC混编的时候产生 ...

  3. Atitit.业务系统的新特性 开发平台 新特性的来源总结

    Atitit.业务系统的新特性 开发平台 新特性的来源总结 1.1. 语言新特性(java c# php js python lisp c++ oc swift ruby  go dart1 1.2. ...

  4. Atitit python3.0 3.3 3.5 3.6 新特性 Python2.7新特性1Python 3_x 新特性1python3.4新特性1python3.5新特性1值得关注的新特性1Pyth

    Atitit python3.0 3.3 3.5 3.6 新特性 Python2.7新特性1 Python 3_x 新特性1 python3.4新特性1 python3.5新特性1 值得关注的新特性1 ...

  5. 11g新特性与12c新特性

    1. 11g新特性概图 管理新特性> 开发新特性> 2. 12c 新特性概图

  6. 代码走查25条疑问 C# 跳转新的标签页 C#线程处理 .Net 特性 attribute 学习 ----自定义特性 看懂 ,学会 .NET 事件的正确姿势-简单版

    代码走查25条疑问   代码走查(Code Review) 是一个开发人员与架构师集中讨论代码的过程.通过代码走查可以提高代码的 质量,同时减少Bug出现的几率.但是在小公司中并没有代码走查的过程在这 ...

  7. cocos2d-x 源代码分析 : EventDispatcher、EventListener、Event 源代码分析 (新触摸机制,新的NotificationCenter机制)

    源代码版本号来自3.x,转载请注明 cocos2d-x 源代码分析总文件夹 http://blog.csdn.net/u011225840/article/details/31743129 1.继承结 ...

  8. 新博客,新开始-从Chrome浏览器奔溃说起

    新博客,新开始 今天是2015-04-09,昨天新开的博客,今天在这写上一段,算是立个标记,好留以后拿来回溯吧. 不知道是谁跟我说的,坚持写博客是个好习惯,也能帮助自己总结经验,提高技术.也许大概可能 ...

  9. 已有使用Key登陆机器,创建新账号并使用新Key登陆

    背景信息:CentOS6.9机器,目前是使用Key进行登陆的,现在需要创建一个新账号并使用新生成的Key进行登陆使用 使用连接Linux工具:XShell 1.在当前机器中创建一个新用户: # use ...

  10. java:合并两个排序的整数数组A和B变成一个新的数组。新数组也要有序。

    合并两个排序的整数数组A和B变成一个新的数组.新数组也要有序. 样例 1: 输入: A=[1], B=[1] 输出:[1,1] 样例解释: 返回合并后的数组. 样例 2: 输入: A=[1,2,3,4 ...

随机推荐

  1. ThinkPHP中文字段问题

    转自: https://www.baidu.com/link?url=Ohc9epgQgkNYLwnHqP-jZ9RfIQWW50-iz8-ZMIPLdtCIJHnUpYwQnDLmXzi7Fa110 ...

  2. 小程序报错:对应的服务器 TLS 为 TLS 1.0 ,小程序要求的 TLS 版本必须大于等于 1.2

    我这里出现此错误的原因是,搭载域名网站的服务器是windows2008 r2,配置的域名证书是TLS1.0版本,需要在服务器注册表中加入TLS的其他版本. 处理办法如下 小程序报错 TLS 版本必须大 ...

  3. 理解CNN中的感受野(receptive-field)

    1. 阅读论文:Understanding the Effective Receptive Field in Deep Convolutional Neural Networks 理解感受野 定义:r ...

  4. [PHP] dompdf 使用记录

    # 安装字体,解决中文乱码参考: https://blog.51cto.com/lampzxr/1916038```首先下载composer curl -sS https://getcomposer. ...

  5. hashMap的原理

    hashMap的原理分析(转载) 1.总结: HashMap是基于哈希表实现的,用Entry[]来存储数据,而Entry中封装了key.value.hash以及Entry类型的next HashMap ...

  6. Chaikin Curves in Processing

    转自:https://sighack.com/post/chaikin-curves In this post, we’ll look at what Chaikin curves are, how ...

  7. spring boot前后端参数传递方式

    使用spring boot2X做后端,postman做前端测试 1.获取json字符串 @RestController public class Demo { @RequestMapping(&quo ...

  8. 前端向后端获取数据的三种方法:ajax、axios、fetch

    1.jQuery中的ajax get方法: $.ajax({ url:"v4/api/film/now-playing?t=1539401039415&page=1&coun ...

  9. [转帖]Exadata X8发布

    Exadata X8发布 2019-04-09 10:45:32 dingdingfish 阅读数 193 文章标签: ExadataOracleX8 更多 分类专栏: Exadata   版权声明: ...

  10. Java后台验证

    前台的js验证,可以通过其他手段绕过,存在安全问题,所以引入Java后台进行验证 一.导入jar包 此为hibernate-validator jar包,进行Java后台验证使用,在Java 1.9及 ...