BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Method too long

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder IDE
View previous topic :: View next topic  
Author Message
Howard Brazee
Guest





PostPosted: Thu Feb 01, 2007 3:03 am    Post subject: Method too long Reply with quote



I downloaded some programs I wanted to analyze (a Sudoku solver), and
had JBuilder run them.

I got the following error:
com.borland.jbuilder.unittest.TestCreateException: Couldn't load the
test suite class

at
com.borland.jbuilder.unittest.JBTestRunner.constructTest(JBTestRunner.java:118)

at
com.borland.jbuilder.unittest.JBTestRunner.setTest(JBTestRunner.java:170)

at
com.borland.jbuilder.unittest.JBTestRunner.initiateTest(JBTestRunner.java:246)

at
com.borland.jbuilder.unittest.JBTestRunner.main(JBTestRunner.java:558)

Caused by: java.lang.ClassFormatError: hjb/sudokusolver (Code of a
method longer than 65535 bytes)
Back to top
Kevin Dean [TeamB]
Guest





PostPosted: Thu Feb 01, 2007 6:15 am    Post subject: Re: Method too long Reply with quote



Howard Brazee wrote:

Quote:
Caused by: java.lang.ClassFormatError: hjb/sudokusolver (Code of a
method longer than 65535 bytes)

That exception means exactly what it says: you have a (really long!)
method in the code. This may compile for someone else if they have
different optimization settings or a different compiler, but obviously not
for you. The only solution is to break the method up into two or more
pieces so that each method will be less than the 64k limit.

--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/

Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
Back to top
Howard Brazee
Guest





PostPosted: Thu Feb 01, 2007 9:18 pm    Post subject: Re: Method too long Reply with quote



On 31 Jan 2007 16:15:37 -0800, "Kevin Dean [TeamB]"
<NkOdSePaAnM (AT) datadevelopment (DOT) com> wrote:

Quote:
Caused by: java.lang.ClassFormatError: hjb/sudokusolver (Code of a
method longer than 65535 bytes)

That exception means exactly what it says: you have a (really long!)
method in the code. This may compile for someone else if they have
different optimization settings or a different compiler, but obviously not
for you. The only solution is to break the method up into two or more
pieces so that each method will be less than the 64k limit.

I saw that and was hoping for a work around so I could run that code.

This is mostly 3400 lines of code like this (note array size) - and I
want to see how it compares to more concise solutions:

for (int av = 0; av <
((ArrayList)sets.get(47)).size(); av++) {
for (int aw
= 0; aw < ((ArrayList)sets.get(4Cool).size(); aw++) {
ArrayList x = new
ArrayList();
x.add(((ArrayList)sets.get(0)).get(a));
x.add(((ArrayList)sets.get(1)).get(b));
x.add(((ArrayList)sets.get(2)).get(c));
x.add(((ArrayList)sets.get(3)).get(d));

....

x.add(((ArrayList)sets.get(64)).get(M));
x.add(((ArrayList)sets.get(65)).get(N));

sudokusolver.assignOptions(x);
sudokusolver.boardSolved();
....

}
}
}
}
}
}
}
}
}
}
}
}
Back to top
Kevin Dean [TeamB]
Guest





PostPosted: Fri Feb 02, 2007 1:30 am    Post subject: Re: Method too long Reply with quote

Howard Brazee wrote:

Quote:
This is mostly 3400 lines of code like this (note array size) - and I
want to see how it compares to more concise solutions:

A Sudoku solver in 3400 lines?! Sheesh; I wrote a Sudoku solver in Excel
macros that solves 95% of puzzles in less than 300 lines. Don't use that
code as an example of good application design.

--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/

Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
Back to top
Howard Brazee
Guest





PostPosted: Fri Feb 02, 2007 2:02 am    Post subject: Re: Method too long Reply with quote

On 1 Feb 2007 11:30:51 -0800, "Kevin Dean [TeamB]"
<NkOdSePaAnM (AT) datadevelopment (DOT) com> wrote:

Quote:
This is mostly 3400 lines of code like this (note array size) - and I
want to see how it compares to more concise solutions:

A Sudoku solver in 3400 lines?! Sheesh; I wrote a Sudoku solver in Excel
macros that solves 95% of puzzles in less than 300 lines. Don't use that
code as an example of good application design.

That wasn't my intention. That method just created a huge table of
arrays. I was wanting to compare it to other ways of setting things
up. This method didn't have any real logic.
Back to top
Shankar Unni
Guest





PostPosted: Fri Feb 02, 2007 3:02 am    Post subject: Re: Method too long Reply with quote

Howard Brazee wrote:

Quote:
x.add(((ArrayList)sets.get(0)).get(a));
x.add(((ArrayList)sets.get(1)).get(b));
x.add(((ArrayList)sets.get(2)).get(c));
x.add(((ArrayList)sets.get(3)).get(d));

Try to abstract this into a method that takes "x", "sets", and two
arrays of indexes (0,1,2,3,... and a,b,c,d,...). Or something like that
- basically, refactor this routine to move the boilerplate out into a
common routine. The refactored routine can use a pair of nested loops
to go over the steps, instead of all these straight-line statements..
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder IDE All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.