你是否模糊了商业Java代码?(Do you obfuscate your commercial Java code? [closed])

我想知道有没有人在自己的商业产品上使用商业/免费的java混淆器。 我只知道一个实际上在蚂蚁构建步骤中发生混淆的项目。

你模糊吗 如果是这样,为什么你会混淆?

它是真正的保护代码的一种方式,还是开发人员/管理者更好的感觉?

编辑:好的,我确切地说,关于我的观点:你是否混淆了保护你的IP(你的算法,你放在你的产品中的工作)? 出于安全考虑,我不会混淆,那感觉不对。 所以我只是在谈论保护您的应用程序代码与竞争对手。

@staffan有一个好点:

远离链接代码流的原因是,其中一些更改使得JVM无法有效地优化代码。 实际上它实际上会降低应用程序的性能。


I wonder if anyone uses commercial/free java obfuscators on his own commercial product. I know only about one project that actually had an obfuscating step in the ant build step for releases.

Do you obfuscate? And if so, why do you obfuscate?

Is it really a way to protect the code or is it just a better feeling for the developers/managers?

edit: Ok, I to be exact about my point: Do you obfuscate to protect your IP (your algorithms, the work you've put into your product)? I won't obfuscate for security reasons, that doesn't feel right. So I'm only talking about protecting your applications code against competitors.

@staffan has a good point:

The reason to stay away from chaining code flow is that some of those changes makes it impossible for the JVM to efficiently optimize the code. In effect it will actually degrade the performance of your application.


原文:https://stackoverflow.com/questions/12088
2024-01-19 22:01

满意答案

在Objective-C中,属性中的copy属性意味着合成的setter将如下所示:

-(void)setMasterBirdSightingList:(NSMutableArray*)newValue
{
    if (_masterBirdSightingList == newValue) return;
//  NSMutableArray* oldValue = _masterBirdSightingList;
    _masterBirdSightingList = [newValue copy];
//  [oldValue release];    // <-- not applicable in ARC.
}

并且点语法将始终转换为

[self setMasterBirdSightingList:sightingList];

无论属性的属性如何。

“分配给另一个空间以保存来自sightingList的内容”的东西是通过-copy方法完成的。 将参数传递给setter的newValue参数的方式无关紧要。


编辑 :正如注释中提到的@David一样 ,可变类型的-copy方法返回一个不可变对象。 您必须覆盖setter才能调用-mutableCopy 。 请参阅使用可变对象的Obj-C 2.0属性的最佳方法是什么,例如NSMutableArray?


In Objective-C, the copy attribute in a property means the setter synthesized will look like this:

-(void)setMasterBirdSightingList:(NSMutableArray*)newValue
{
    if (_masterBirdSightingList == newValue) return;
//  NSMutableArray* oldValue = _masterBirdSightingList;
    _masterBirdSightingList = [newValue copy];
//  [oldValue release];    // <-- not applicable in ARC.
}

and that dot syntax will always be translated to

[self setMasterBirdSightingList:sightingList];

regardless of the attribute of the property.

The "allocated for another space to preserve stuffs from sightingList" stuff is done via the -copy method. The way you pass the argument to the setter's newValue parameter is irrelevant.


Edit: As @David mentioned in the comment, the -copy method of a mutable type returns an immutable object. You have to override the setter to call -mutableCopy instead. See What's the best way to use Obj-C 2.0 Properties with mutable objects, such as NSMutableArray?.

相关问答

更多

将NSMutableArray存储在NSArray中?(Store NSMutableArray in NSArray?)

@property ( nonatomic, copy ) NSArray* array 手段: - (void) setArray: (NSArray*) array { _array = [array copy]; } [array copy]总是返回一个不可变的NSArray,即使array是NSMutableArray也是如此。 @property ( nonatomic, copy ) NSMutableArray* array 处理方式有点不同: - (void) set...

NSMutableArray的NSInternalInconsistencyException(NSInternalInconsistencyException for NSMutableArray)

使用options:NSJSONReadingMutableContainers NSJSONSerialization调用上的NSJSONReadingMutableContainers。 然后它创建的所有字典和数组都是可变的。 Use options:NSJSONReadingMutableContainers on your NSJSONSerialization call. Then all the dictionaries and arrays it creates will be mu...

使用@property和'copy'属性分配NSMutableArray(assign NSMutableArray with @property and 'copy' attribute)

在Objective-C中,属性中的copy属性意味着合成的setter将如下所示: -(void)setMasterBirdSightingList:(NSMutableArray*)newValue { if (_masterBirdSightingList == newValue) return; // NSMutableArray* oldValue = _masterBirdSightingList; _masterBirdSightingList = [newValu...

mutableCopyWithZone,复制NSMutableArray?(mutableCopyWithZone, copy NSMutableArray?)

这里没什么特别的。 像这样的东西: NSMutableArray *copiedData = [[self data] mutableCopyWithZone:zone]; newPlanet.data = copiedData; [copiedData release]; Nothing too special here. Something like this: NSMutableArray *copiedData = [[self data] mutableCopyWithZone:zon...

来自不同类的NSMutableArray获取Null(NSMutableArray from different class gets Null)

如果其他内容具有对同一属性的强引用,则弱属性引用很有用。 在你的情况下,似乎并非如此。 使您的Array成为一个strong属性。 (为了便于阅读,不要以大写字母开头命名变量; array稍微好于Array 。有意义的东西会更好。) A weak property reference is useful if something else has a strong reference to the same property. In your case it doesn't seem like t...

让NSMutableArray属性填充枚举值(getting NSMutableArray Property filled with enumerated values)

更换 Arrow a = (Arrow)[[self arrowsPkg] objectAtIndex:1]; 同 Arrow a = (Arrow)[[[self arrowsPkg] objectAtIndex:1] intValue]; 或者,写得更清楚 NSNumber *arrowNumber = [[self arrowsPkg] objectAtIndex:1]; Arrow a = [arrowNumber intValue]; 您将Arrow枚举类型存储在btn1Click...

NSMutableArray作为@property只读(NSMutableArray as @property with readonly)

是的,你可以修改它的内容。 readonly只适用于指针本身 - 这样,它就不像C ++的const 。 基本上,“readonly”只是表示“不要将a.someArray = foo转换成[a setSomeArray:foo] ”。 也就是说,没有创建setter。 (当然,如果你想防止修改,你只需要使用一个NSArray 。) Yes, you can modify its contents. The readonly only applies to the pointer itself -...

将对象从一个NSMutableArray复制到另一个NSMutableArray(copy objects from one NSMutableArray to another NSMutableArray)

你对正在发生的事情有误解。 replaceObjectAtIndex:withObject: call不修改数组中的对象,它正在修改数组本身。 在这一行之后: [self.cloneArray replaceObjectAtIndex:0 withObject:@"blah"]; 您已经替换了克隆数组中的对象,但您根本没有更改原始数组。 如果您实际修改了放入数组的NSString对象,则可能会获得您期望的行为。 但是,在示例中,您将无法使用放入原始数组的对象,因为它们是不可变的字符串对象。 如果...

NSMutableArray线程安全(NSMutableArray thread safety)

我相信这个解决方案很差。 考虑这个: 线程#1调用count并被告知数组中有4个对象。 数组是不同步的。 线程#2调用数组上的removeObjectAtIndex:2 。 数组是不同步的。 线程#1调用objectAtIndex:3并发生错误。 相反,您需要更高级别的锁定机制,其中锁定在步骤1和5的数组周围,并且线程#2无法删除这些步骤之间的对象。 I believe this solution is poor. Consider this: thread #1 calls count and ...

NSMutableArray更改为副本,从而导致父NSMutableArray中的更改(NSMutableArray changes to the copy causing changes in the parent NSMutableArray as well)

你应该做一个deepCopy,我使用这个并且完美地工作,由Sherm Pendley†制作 。 You should do a deepCopy, i use this one and works perfectly, made by Sherm Pendley †.

相关文章

更多

English,The Da Vinci Code,Chapter 1-3

CHAPTER 1 http://readanybooks.net/thrillers/TheDaVi ...

reading notes for solr source code

solr source code 1 org.apache.solr.common 基本的类对象 ...

There is already an open DataReader associated with this Connection which must be closed first

使用MVC4 EF Linq获取foreach列表循环的时候遇到了如下的问题:报错提示 Ther ...

Java 异常处理

Java 异常处理 异常是程序中的一些错误,但并不是所有的错误都是异常,并且错误有时候是可以避免 ...

Java 反射问题

想问个java 反射问题 public class A{ public void send(){ ...

java WHILE 循环问题

有没有办法让循环在5秒以后自动退出? 问题补充: clshanghe 写道 ...

java配置问题

Exception sending context initialized event to list ...

微信会员注册开发【带源码】:网页授权,得到code后在当前页面获取openid,js+php实现跨域请求

开发情景: 作者主页:天际app工作室http://home.zhubajie.com/7145093 ...

Open Source Search Engines in Java

Open Source Search Engines in Java Open Source Sear ...

Java Applet基础

Java Applet基础 applet是一种Java程序。它一般运行在支持Java的Web浏览 ...

最新问答

更多

如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)

请尝试以下方法: $messages = $user->contact_messages()->paginate(10); Try the following: $messages = $user->contact_messages()->paginate(10);

linux的常用命令干什么用的

linux和win7不一样,win7都图形界面,都是用鼠标来操作打开,解压,或者关闭。而linux是没有图形界面的,就和命令提示符一样的一个文本框,操作linux里的文件可没有鼠标给你用,打开文件夹或者解压文件之类的操作都要通过linux常用命令。

由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)

它创建了这些视图: 'auth/login.blade.php', 'auth/register.blade.php', 'auth/passwords/email.blade.php', 'auth/passwords/reset.blade.php', 'layouts/app.blade.php', 'home.blade.php' 并修改这些文件: 'Http/Controllers/HomeController.php', 'routes/web.php' 如果使用--views

如何交换返回集中的行?(How to swap rows in a return set?)

您可以使用特殊的CASE表达式进行ORDER BY如下所示: SELECT * FROM table ORDER BY CASE id WHEN 3 THEN 8 WHEN 8 THEN 3 ELSE id END You can ORDER BY using a special CASE expression like this: SELECT * FROM table ORDER BY CASE id WHEN 3 THEN 8 WHEN 8 THEN 3 ELSE id END

在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)

我建议你制作一个新的TableView Cell,在这个newTableViewCell中,加载第2节中的所有单元格,然后为newTableViewCell提供边框。 但如果您不想这样做,那么您可以使用以下代码: @property(strong,nonatomic) CAShapeLayer* borderPath; -(void)viewDidLayoutSubviews{ [_borderPath removeFromSuperlayer]; UIView *viewToGiveBord

使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)

出于一些奇怪的原因,我现在发现了一个不同的问题, Boost.Spirit SQL语法/词法分析失败 ,其中提供了一些其他解决方案来进行空格跳过。 一个更好的! 以下是根据建议重新编写的示例代码: #include #include #include #include #include #incl

Java中的不可变类(Immutable class in Java)

1.如果我只有final变量的课程? 这会让你远离但不是全部。 这些变量的类型也需要是不可变的。 考虑一下 class MyImmutableClass { // final variable, referring to a mutable type final String[] arr = { "hello" }; // ... } 这允许有人做 myImmutableObject.arr[0] = "world"; 并有效地改变你的不可变类的对象。 此外,建议禁

WordPress发布查询(WordPress post query)

如果你想要在div中包含所有帖子: post_parent) { $myposts = get_posts('numberposts=10&tag=medical&order=DESC'); echo ' '; foreach ($myposts as $post): ?>

如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)

我不确定哪个是MySQL的正确答案,因为它本身还不支持IPv6地址格式(尽管“ WL#798:MySQL IPv6支持 ”表明它将在MySQL v6.0中,当前文档不支持)。 不过,你建议的人建议去2 * BIGINT,但要确保他们是UNSIGNED。 在IPv6的/ 64地址边界处有一种自然分割(因为/ 64是最小的网格块大小),这将与其很好地对齐。 I'm not sure which is the right answer for MySQL given that it doesn't y

是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)

您可以使用Object.keys和Array#find来获取匹配value的key 。 const letters = {a:'26',b:'25',c:'24',d:'23',e:'22',f:'21',g:'20',h:'19',i:'18',j:'17',k:'16',l:'15',m:'14',n:'13',o:'12',p:'11',q:'10',r:'9',s:'8',t:'7',u:'6',v:'5',w:'4',x:'3',y:'2',z:'1'}; function sw