Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate concise Java code for tests #1249

Open
mximp opened this issue Sep 20, 2022 · 7 comments
Open

Generate concise Java code for tests #1249

mximp opened this issue Sep 20, 2022 · 7 comments
Labels
Milestone

Comments

@mximp
Copy link
Contributor

mximp commented Sep 20, 2022

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
Copy link
Contributor Author

mximp commented Sep 20, 2022

@yegor256 please assisgn

@yegor256
Copy link
Member

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

@yegor256
Copy link
Member

@Graur please, help with this one

@mximp
Copy link
Contributor Author

mximp commented Sep 21, 2022

@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
Copy link
Member

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

@yegor256
Copy link
Member

yegor256 commented Mar 5, 2023

@mximp let's do this?

@mximp
Copy link
Contributor Author

mximp commented Mar 6, 2023

@Graur I believe it was with you.

@mximp mximp added this to the M3 milestone May 29, 2023
@Graur Graur modified the milestones: M3, Important Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants