Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bugs caused by multiple configurations #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

7449
Copy link

@7449 7449 commented Sep 9, 2023

一个项目多项配置StringFog导致的Bug

一个项目里面多个Project都配置StringFog会导致找不到所需的StringFog.java
提示Missing class packageName.StringFog,
这里的packageName是插件apply方法获取的最后一个Project

复现:

分别创建包名为com.github.sample.A和包名为com.github.sample.B的两个Library都配置StringFog,
ALibraryrelease包的时候会提示找不到com.github.sample.B.StringFog

这里BLibrary是项目运行时插件获取到的最后一个Project,如果配置了三个StringFog分别是A,B,C
就会提示找不到C包名下的StringFog.java

原因:

StringFogTransform的数据都是通过静态变量赋值,className一直都是最后一个Project的包名,
配置一个没有这个问题

@MegatronKing
Copy link
Owner

@7449 你好,感谢提交PR。关于StringFogTransform静态赋值的问题我知道的,之所以没有使用参数传值是因为参数需要序列化,比如IKeyGenerator就需要强制序列化。对于继承IKeyGenerator自己实现一些加密解密方法的可能会出现无法序列化的问题,会影响到一部分用户,这个我一直没有找到好的解决方法。

@7449
Copy link
Author

7449 commented Sep 12, 2023

这个我也发现了,要不就强制IKeyGenerator 需要序列化,要不就和implementation一样通过反射去获取,提供个无参构造就行了或者提供构造参数,或者两个都弄上,有的只是简单加密不需要太复杂的方式
我觉得序列化方便一点,java层加密也只是求个心安

update:
或者用一个静态map[k->applicationId,value->StringFogExtension],parameters只需要传递一个applicationId

@MegatronKing

@shabic
Copy link

shabic commented Dec 6, 2023

我也遇到了,这个问题还可以解决吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants