Is there a limit on the number of lines of code you can add in eclipse java doup

I have a project that I'm working on, and everything went well until today. I have about 6,000 lines of code in a single Java class document. If I try to insert another IF statement in the code, the program throws an exception when the class is called. All the additional fragments that I tried to put in the class cause the class to fail when called. I tried to add test code, which, as I know, works fine, and they all throw a strength warning dialog. Believe me, there is nothing wrong with the last fragment that I am trying to put in a class. As soon as I select the last "if" fragment, there are no errors. Has anyone seen this before? An exception is thrown in the emulator when the class is called. I get a power warning window. Here is the java file size: 172,503 bytes Thanks in advance!

+6
source share
4 answers

I ran into this problem a while ago and found out that it is not a problem to have 50k lines and more code in the same class until the method limit is exceeded.

Depending on what in one method actually causes the size of the bytecode, I experienced restrictions between 2-3k lines of code / method.

added by:

by the way, at some point, Eclipse crashes when your shared code gets too large to compile - just increase your Eclipse memory to 1 GB or so. It is enough that for my projects there were only about 100 thousand lines ...

+3
source

You can change the same using the following settings:

--launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m 
+4
source

I noticed this before, Eclipse is running away from Java itself, so it is very RAM intensive, if you have too much code, so it needs more than can be allocated, it will work.

+1
source

Is there a limit on the number of lines of code that you can put in an Eclipse java project.

Not exactly.

There are limits on the number of bytecodes in the compiled method and other similar things, but they are imposed by the Java file format (for example, the JVM specification), not Eclipse.

It is also possible that Eclipse needs more memory, although I don't think adding one if reliably triggers this. (And if that were to happen, the exception would tell you that you are running out of memory ...)

+1
source

Source: https://habr.com/ru/post/913765/


All Articles