i have read the following post

i was wondering what this change really means.

1). Means that this class sun.reflect.Reflection.getCallerClass will be rewritten to provide more security in Java reflection?

2). Means this class will no more be needed? maybe another approach?

3). Reflection will be over in Java 8. method.invoke will throw UnsupportedOperationException.??

4). this will affect anything related to Spring or AspectJ Aspect Oriented Programming?

i was wondering because we use Reflection method.invoke to provide some flags to the class before being send to the DB. this raises another question if reflection is over what approach can i use to provide my behavior above. i think AOP is a way to go.

thanks a lot.

解决方案

Short answer: you only need to worry if you use sun.reflect.Reflection.getCallerClass. (And it is ludicrous to suggest that Java reflection is being withdrawn.)

A longer answer is that the functionality provided by that method is being reworked in JEP 176. The old method is actually being removed ... not just deprecated. It is a method in the sun.* tree, and application code should not be calling it directly. The current plan seems to be:

to remove this functionality entirely if no valid use cases can be identified, or

provide a replacement API, or at least defer the hard removal of the current method from Java 7

The original primary use-case for this private API was for security managers and the like that needed to know who called them. Unfortunately, this approach has proven to be fragile. A new approach to that problem (using message handles) has been designed. Rather than leaving this API in place for application code to use willy-nilly for dubious purposes, they have decided to force the issue.

However, there are signs of push-back on this issue because it is causing breakages in things like Groovy and JRuby.

References:

Your specific questions:

1). Means that this class sun.reflect.Reflection.getCallerClass will be rewritten to provide more security in Java reflection?

See above. I suspect that there is a security related motivation for this.

2). Means this class will no more be needed? maybe another approach?

See above. They haven't yet determined whether the functionality is needed.

3). Reflection will be over in Java 8. method.invoke will throw UnsupportedOperationException.??

No to both of these. This is just about a specific method of a specific class in the sun.* packages.

It does not impact on reflection in general or on method.invoke().

4). this will affect anything related to Spring or AspectJ Aspect Oriented Programming?

Probably not. It would only affect those technologies if they relied on that particular method. If they do, then the respective library maintainers will need to ensure that the Java team are aware of the use-cases that require this. I imagine the maintainers are tracking this.

java 7 40,Java 7u40 Java SE 8 sun.reflect.Reflection.getCallerClass相关推荐

  1. java caller_java – sun.reflect.CallerSensitive注释是什么意思?

    根据JEP我链接的评论(也是 here), A caller-sensitive method varies its behavior according to the class of its im ...

  2. java手机象棋软件下载,Java手机网络版象棋游戏附源码JAVA游戏源码下载

    运行于手机上的中国象棋游戏,鉴于JAVA J2ME技术,本游戏分服务端和客户端,导入JAR包即可在手机上运行,内有开发文档和运用说明. Java手机网络版象棋游戏附源码 (1 folders, 2 f ...

  3. 字体对话框java实验_Java Web安全 || Java基础 sun.misc.Unsafe

    点击上方"凌天实验室","星标或置顶公众号" 漏洞.技术还是其他,我都想第一时间和你分享 " [历史]已连载更新全部内容:[菜单栏]-[JAVA SE ...

  4. java ee me se_java EE ME SE有什么关系

    1. Java SE(Java Platform,Standard Edition).Java SE 以前称为 J2SE.它允许开发和部署在桌面. 服务器.嵌入式环境和实时环境中使用的 Java 应用 ...

  5. java 1.6 ubuntu_ubuntu配置 Java SE 1.6

    今天编译android 4.0时提示如下错误: You are attempting to build with the incorrect version of java. Your version ...

  6. BTA 常问的 Java基础40道常见面试题及详细答案

    最近看到网上流传着,各种面试经验及面试题,往往都是一大堆技术题目贴上去,而没有答案. 为此我业余时间整理了,Java基础常见的40道常见面试题,及详细答案,望各路大牛,发现不对的地方,不吝赐教,留言即 ...

  7. java.lang.module_如何修复“java.lang.module.FindException:module java.se.ee not found”错误

    我正在尝试打包我的kivy应用程序(python3),但是当我运行命令buildozer -v android debug时,看到这个错误# Cwd /home/javier/.buildozer/a ...

  8. java se7 变化_[转] Java se 7新特性研究(二)

    今天主要研究Java se 7中异常处理的新功能.从今天开始正在将jdk7的说法改为java se 7跟oracle官网的一致 一.新增了try-with-resource 异常声明 在JDK7中只要 ...

  9. JAVA企业面试题精选 Java SE 91-100

    3.91.一个图书管理系统的面向对象设计方法如下图所示:   Book代表书,有"Name(书名)","Author(作者名)","Price(单价) ...

最新文章

  1. 解决yum 不能更新问题 :yum 报错Loaded plugins: fastestmirror, refresh-packagekit, security
  2. 检查传递给Bash脚本的参数数量
  3. 公司inur php id_,PHP——个人信息管理系统
  4. 机器学习--最基础的最常用的聚类算法
  5. 同态加法_同态的Spotify
  6. mysqld --initialize --console 没有 打印信息_JavaScript设计模式--装饰者模式
  7. jQuery使用总结 - jQuery组成和主要功能 1/4
  8. Unity Animation 的使用
  9. 在.Net中读写config文件的各种方法
  10. 【Shell】ps -ef 和ps aux
  11. 用R语言做单方程的误差修正模型(ECM)
  12. Java8中list转map方法
  13. 关于复数i本质的探讨
  14. 创意无价,优化 百度、Bing、Duckduckgo 三大国际搜索引擎
  15. 全球与中国矿物加工工程市场深度研究分析报告
  16. MATLAB之最优路径的查找
  17. 【数据科学】01 数据科学概述
  18. 12位早起的IT大佬们让小伙伴们都惊呆了
  19. Flink DataStream API 中的多面手——Process Function详解
  20. 爬取百度搜索图片的缩略图

热门文章

  1. golang入门小记
  2. 自己搭建mysql服务要知道的二三事
  3. react 数据库排序_如何使用React对表数据进行排序
  4. 企业文档管理_为什么这么多企业文档如此糟糕?
  5. javascript 代码_如何使您JavaScript代码简单易读
  6. vue.js视频课程_在此免费课程中学习Vue.js! ✨
  7. 什么是端到端训练测试_为什么端到端测试对您的团队很重要
  8. Linux安装samba组件,CentOS7安装samba服务
  9. mscoco数据集_重磅!小目标检测的数据增广秘籍
  10. Python 中拼音库 PyPinyin 的用法,没错见名知意它就是用来翻译汉字的