笔者最近在调试一段代码,进入spring-core以后,IDEA帮我反编译出源码,其中MethodProxy.java如下

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
// package org.springframework.cglib.proxy; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.springframework.cglib.core.AbstractClassGenerator;
import org.springframework.cglib.core.CodeGenerationException;
import org.springframework.cglib.core.GeneratorStrategy;
import org.springframework.cglib.core.NamingPolicy;
import org.springframework.cglib.core.Signature;
import org.springframework.cglib.reflect.FastClass;
import org.springframework.cglib.reflect.FastClass.Generator; public class MethodProxy {
private Signature sig1;
private Signature sig2;
private MethodProxy.CreateInfo createInfo;
private final Object initLock = new Object();
private volatile MethodProxy.FastClassInfo fastClassInfo; public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) {
MethodProxy proxy = new MethodProxy();
proxy.sig1 = new Signature(name1, desc);
proxy.sig2 = new Signature(name2, desc);
proxy.createInfo = new MethodProxy.CreateInfo(c1, c2);
return proxy;
} private void init() {
if (this.fastClassInfo == null) {
synchronized(this.initLock) {
if (this.fastClassInfo == null) {
MethodProxy.CreateInfo ci = this.createInfo;
MethodProxy.FastClassInfo fci = new MethodProxy.FastClassInfo();
fci.f1 = helper(ci, ci.c1);
fci.f2 = helper(ci, ci.c2);
fci.i1 = fci.f1.getIndex(this.sig1);
fci.i2 = fci.f2.getIndex(this.sig2);
this.fastClassInfo = fci;
this.createInfo = null;
}
}
} } private static FastClass helper(MethodProxy.CreateInfo ci, Class type) {
Generator g = new Generator();
g.setType(type);
g.setClassLoader(ci.c2.getClassLoader());
g.setNamingPolicy(ci.namingPolicy);
g.setStrategy(ci.strategy);
g.setAttemptLoad(ci.attemptLoad);
return g.create();
} private MethodProxy() {
} public Signature getSignature() {
return this.sig1;
} public String getSuperName() {
return this.sig2.getName();
} public int getSuperIndex() {
this.init();
return this.fastClassInfo.i2;
} FastClass getFastClass() {
this.init();
return this.fastClassInfo.f1;
} FastClass getSuperFastClass() {
this.init();
return this.fastClassInfo.f2;
} public static MethodProxy find(Class type, Signature sig) {
try {
Method m = type.getDeclaredMethod("CGLIB$findMethodProxy", MethodInterceptorGenerator.FIND_PROXY_TYPES);
return (MethodProxy)m.invoke((Object)null, sig);
} catch (NoSuchMethodException var3) {
throw new IllegalArgumentException("Class " + type + " does not use a MethodInterceptor");
} catch (IllegalAccessException var4) {
throw new CodeGenerationException(var4);
} catch (InvocationTargetException var5) {
throw new CodeGenerationException(var5);
}
} public Object invoke(Object obj, Object[] args) throws Throwable {
try {
this.init();
MethodProxy.FastClassInfo fci = this.fastClassInfo;
return fci.f1.invoke(fci.i1, obj, args);
} catch (InvocationTargetException var4) {
throw var4.getTargetException();
} catch (IllegalArgumentException var5) {
if (this.fastClassInfo.i1 < 0) {
throw new IllegalArgumentException("Protected method: " + this.sig1);
} else {
throw var5;
}
}
} public Object invokeSuper(Object obj, Object[] args) throws Throwable {
try {
this.init();
MethodProxy.FastClassInfo fci = this.fastClassInfo;
return fci.f2.invoke(fci.i2, obj, args);
} catch (InvocationTargetException var4) {
throw var4.getTargetException();
}
} private static class CreateInfo {
Class c1;
Class c2;
NamingPolicy namingPolicy;
GeneratorStrategy strategy;
boolean attemptLoad; public CreateInfo(Class c1, Class c2) {
this.c1 = c1;
this.c2 = c2;
AbstractClassGenerator fromEnhancer = AbstractClassGenerator.getCurrent();
if (fromEnhancer != null) {
this.namingPolicy = fromEnhancer.getNamingPolicy();
this.strategy = fromEnhancer.getStrategy();
this.attemptLoad = fromEnhancer.getAttemptLoad();
} }
} private static class FastClassInfo {
FastClass f1;
FastClass f2;
int i1;
int i2; private FastClassInfo() {
}
}
}

笔者相关的代码是

 public Object invoke(Object obj, Object[] args) throws Throwable {
try {
this.init();
MethodProxy.FastClassInfo fci = this.fastClassInfo;
return fci.f1.invoke(fci.i1, obj, args);
} catch (InvocationTargetException var4) {
throw var4.getTargetException();
} catch (IllegalArgumentException var5) {
if (this.fastClassInfo.i1 < 0) {
throw new IllegalArgumentException("Protected method: " + this.sig1);
} else {
throw var5;
}
}
}

通过Maven管理jar包版本,附加源码始终挂不上去

后来找到相关文件spring-core-5.0.6.RELEASE-sources.jar

查看代码如下

笔者看了几个(5.0.6,5.0.7,5.2.0)版本,java源代码文件都丢失, org.springframework.cglib.proxy包哪里去了,不懂是不是移动到其他包了,真是日了狗了。

2020-3-4更新

网友 johnbanq:看起来故事是这样的,检查spring-core的gradle脚本,发现下述内容:

他在构建构过程中把cglib的jar拿来,解开重新打包到自己的jar里,所以-source.jar当然没有,因为这部分都部署spring的东西

spring-core-5.0.6.RELEASE-sources.jar中java源代码不全的更多相关文章

  1. .NET Core 3.0预览版7中的ASP.NET Core和Blazor更新

    .NET Core 3.0 Preview 7现已推出,它包含一系列ASP.NET Core和Blazor的新更新. 以下是此预览中的新功能列表: 最新的Visual Studio预览包括.NET C ...

  2. Payment Spring Boot 1.0.4.RELEASE 发布,最易用的微信支付 V3 实现

    Payment Spring Boot 是微信支付V3的Java实现,仅仅依赖Spring内置的一些类库.配置简单方便,可以让开发者快速为Spring Boot应用接入微信支付. 欢迎ISSUE,欢迎 ...

  3. 坎坷路:ASP.NET Core 1.0 Identity 身份验证(中集)

    上一篇:<坎坷路:ASP.NET 5 Identity 身份验证(上集)> ASP.NET Core 1.0 什么鬼?它是 ASP.NET vNext,也是 ASP.NET 5,以后也可能 ...

  4. 探索ASP.Net Core 3.0系列六:ASP.NET Core 3.0新特性启动信息中的结构化日志

    前言:在本文中,我将聊聊在ASP.NET Core 3.0中细小的变化——启动时记录消息的方式进行小的更改. 现在,ASP.NET Core不再将消息直接记录到控制台,而是正确使用了logging 基 ...

  5. Spring Boot自动配置源码解析(基于Spring Boot 2.0.2.RELEASE)

    在Spring Boot官方介绍中,首一段话是这样的(如下图).我们可以大概了解到其所表达的含义:我们可以利用Spring Boot写很少的配置来创建一个非常方便的基于Spring整合第三方类库的单体 ...

  6. Spring Boot 2.0 学习笔记(一)——JAVA EE简介

    本章内容:JAVA EE>Spring>Spring Boot 一.JAVA EE简介 1.1 Java ee优点:结束了Web开发的技术无序状态,让程序员.架构师用同一种思维去思考如何架 ...

  7. spring 5.0.1.RELEASE官方任然不支持velocity(平台升级)

    官方说明: Dear Spring community, It is my pleasure to announce that Spring Framework 5.0.1 is available ...

  8. 001-Spring Cloud Edgware.SR3 升级最新 Finchley.SR1,spring boot 1.5.9.RELEASE 升级2.0.4.RELEASE注意问题点

    一.前提 升级前 => 升级后 Spring Boot 1.5.x => Spring Boot 2.0.4.RELEASE Spring Cloud Edgware SR3 => ...

  9. Spring Boot 2.0 教程 - 深入SpringAplication

    原文连接:https://www.codemore.top/cates/Backend/post/2018-05-20/spring-boot-SpringApplication 可以通过Spring ...

随机推荐

  1. P4393 [BOI2007]Sequence 序列问题[贪心]

    题目描述 对于一个给定的序列a1, -, an,我们对它进行一个操作reduce(i),该操作将数列中的元素ai和ai+1用一个元素max(ai,ai+1)替代,这样得到一个比原来序列短的新序列.这一 ...

  2. 日常2018/4/9---b/s和c/s架构分别是什么?区别?

    b/s和c/s架构分别是什么?区别? b/s是指前后端分别是 Browser/Server的模式.(3层c/s模式) c/s是指前后端分别是 Client/Server的模式.(2层c/s模式) c/ ...

  3. 大数据之路week07--day04 (YARN,Hadoop的优化,combline,join思想,)

    hadoop 的计算特点:将计算任务向数据靠拢,而不是将数据向计算靠拢. 特点:数据本地化,减少网络io. 首先需要知道,hadoop数据本地化是指的map任务,reduce任务并不具备数据本地化特征 ...

  4. jquery模仿淘宝星星打分

    今天做论坛页面有星星评分功能,以下是代码.用的时候引入jquery <span> <ul class="hs_df_xx"> <li><i ...

  5. Promise.then方法的执行顺序例题分析

    1. 当Promise对象作为resolve的参数时 const p = Promise.resolve(); const p1 = Promise.resolve(p); //就是p const p ...

  6. SpringMVC使用ResponseEntity实现文件下载,及图片base64的字节数组上传于下载

    本文主要通过ResponseEntity<byte[]>实现文件下 该类实现响应头.文件数据(以字节存储).状态封装在一起交给浏览器处理以实现浏览器的文件下载. ResponseEntit ...

  7. Greenplum 调优--数据分布法则 - 分布列与分区的选择

    分布列选择黄金法则 由于Greenplum是一个分布式的数据库,数据是分散存储在各个数据节点的,所以需要告诉Greenplum数据应该如何分布. 短板效应 当用户请求QUERY时,Greenplum会 ...

  8. am335x system upgrade rootfs custom service using systemd script(十七)

    1      Scope of Document systemd 是一个 Linux 系统基础组件的集合,提供了一个系统和服务管理器,运行为 PID 1 并负责启动其它程序.功能包括:支持并行化任务: ...

  9. Vue.config.productionTip = false 是什麽意思

    阻止启动生产消息,常用作指令. 阻止启动生产消息 這又是什麽意思? 看下效果 Vue.config.productionTip = false Vue.config.productionTip = t ...

  10. surprise库官方文档分析(三):搭建自己的预测算法

    1.基础 创建自己的预测算法非常简单:算法只不过是一个派生自AlgoBase具有estimate 方法的类.这是该方法调用的predict()方法.它接受内部用户ID,内部项ID,并返回估计评级r f ...