对于可以放入Eclipse java代码中的代码行数有限制 [英] Is there a limit on the number of lines of code you can put in an Eclipse java doument

查看:771
本文介绍了对于可以放入Eclipse java代码中的代码行数有限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我一直在努力的项目,一切顺利,直到今天。我在一个java类文档中有接近6000行代码。如果我尝试再把一个IF子句放入代码中,当调用该类时,程序会抛出异常。我试图放入类中的所有其他片段,导致类调用时失败。我试图添加我知道工作正常的测试代码,他们都抛出力关闭警报对话框。相信我没有什么错误的最后一个片段,我试图放入类。一旦我拿出最后的如果代码段,没有错误。有没有人见过这个?当调用类时,异常被抛出在模拟器中。我得到力关闭警报窗口。这里是java文件大小:172,503字节提前感谢!

I have a project I have been working on and all was going well until today. I have close to 6000 lines of code in one java class document. If I try to put one more IF clause into the code, the program throws an exception when the class is called on. All additional snippets that I have tried to place into the class, cause the class to fail when called on. I have tried to add test code that I know works fine, and they all throw the force close alert dialog. Trust me there is nothing wrong with the last snippet that I attempt to place into the class. Once I take out the last "if" snippet, there are no errors. Has anyone ever seen this before? The exception is thrown in the emulator, when the class is called. I get the force close alert window. Here is the java file size: 172,503 bytes Thanks in advance!

推荐答案

我碰到这个问题前一段时间,它的没有问题有50k行和更多的代码在一个类,只要方法限制不超过。

I ran into that problem some time ago and found out that its no problem to have 50k lines and more of code in one class as long as the method limit is not exceeded.

根据实际导致字节码大小的单一方法中的内容,我在2-3k行代码/方法之间遇到了限制。

Depending on what's in one single method that actually causes the bytecode size I experienced limitations between 2-3k lines of code/method.

添加:

事实上,当你的总代码太大而无法编译时,Eclipse崩溃了 - 只需将Eclipse的内存增加到1 Gb左右。这足以让我的项目总共有大约100k行...

by the way at a certain point in fact Eclipse crashes when your total code becomes too large to compile - just increase Eclipse's memory to 1 Gb or so. SO far that was enough for my projects having around 100k lines in total...

这篇关于对于可以放入Eclipse java代码中的代码行数有限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆