objectionary / eo

EOLANG, an Experimental Pure Object-Oriented Programming Language Based on šœ‘-calculus
https://www.eolang.org
MIT License
940 stars 122 forks source link

Generate concise Java code for tests #1249

Open mximp opened 1 year ago

mximp commented 1 year ago

When +junit exists in eo code separate mechanism of Java code generation is enabled. It's driven by junit.xsl and rename-junit-inners.xsl. It generates inner Java classes for each inner EO object which leads to long class names during Java compilation. The only option is to re-design how we generate Java code for tests. Probably we need to generate normal (not inner) Java class for each object just like it's done for normal objects.

mximp commented 1 year ago

@yegor256 please assisgn

yegor256 commented 1 year ago

@mximp I think we can stay with inner objects, but do something with their names. Why not?

yegor256 commented 1 year ago

@Graur please, help with this one

mximp commented 1 year ago

@mximp I think we can stay with inner objects, but do something with their names. Why not?

@yegor256 The issues is that it's Java compiler who is generating the names for inner classes: it prepends inner class name with the outer classes. No matter what names we pick for them with certain level of nesting the compiler will produce long enough .class name to fail. For example the following is the result of 40 nesting classes:

EOorg.EOeolang.EOexamples.EOtestTest.EOĻ‰1blah0.EOĻ‰2blah1.EOĻ‰3blah2.EOĻ‰4blah3.EOĻ‰5blah4.EOĻ‰6blah5.EOĻ‰7blah6.EOĻ‰8blah7.EOĻ‰9blah8.EOĻ‰10blah9.EOĻ‰11blah10.EOĻ‰12blah11.EOĻ‰13blah12.EOĻ‰14blah13.EOĻ‰15blah14.EOĻ‰16blah15.EOĻ‰17blah16.EOĻ‰18blah17.EOĻ‰19blah18.EOĻ‰20blah19.EOĻ‰21blah20.EOĻ‰22blah21.EOĻ‰23blah22.EOĻ‰24blah23.EOĻ‰25blah24.EOĻ‰26blah25.EOĻ‰27blah26.EOĻ‰28blah27.EOĻ‰29blah28.EOĻ‰30blah29.EOĻ‰31blah30.EOĻ‰32blah31.EOĻ‰33blah32.EOĻ‰34blah33.EOĻ‰35blah34.EOĻ‰36blah35.EOĻ‰37blah36.EOĻ‰38blah37.EOĻ‰39blah38.EOĻ‰40blah39

So the only solution I see here is to avoid nesting... Or at least nest classes into the same outer not into each other so we have names like: EOorg.EOeolang.EOexamples.EOtestTest.EOĻ‰1blah0, EOorg.EOeolang.EOexamples.EOtestTest.EOĻ‰2blah1, etc.

yegor256 commented 1 year ago

@mximp got it. I like the second option: keep all classes in the same file, but reposition them to avoid nesting.

yegor256 commented 1 year ago

@mximp let's do this?

mximp commented 1 year ago

@Graur I believe it was with you.

levBagryansky commented 1 week ago

@maxonfjvipon please assign me