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

#3058: Fixed access modifier in EOorg/EOeolang/ #3103

Merged
merged 24 commits into from May 2, 2024

Conversation

levBagryansky
Copy link
Member

@levBagryansky levBagryansky commented Apr 17, 2024

Closes #3058


PR-Codex overview

This PR adds a test to ensure all EO.. classes are public in the EOorg.EOeolang package.

Detailed summary

  • Added a test class EoClassesArePublicTest to check public access for EO.. classes
  • Included license information in the test file
  • Imported necessary classes for the test
  • Implemented logic to filter and check public access for EO.. classes

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@levBagryansky
Copy link
Member Author

@maxonfjvipon Please review

@levBagryansky
Copy link
Member Author

@yegor256 please check

@yegor256
Copy link
Member

@levBagryansky just setting it to public is not a solution. We should introduce a test first, which will fail if public is not there. Then, we make a fix.

@yegor256
Copy link
Member

@levBagryansky isn't it easier to use Reflection for this, in runtime? When unit tests in the eo-runtime package are executed, all Java classes are parsed and available in classpath. Just search for all classes in the package and check their access modifiers.

@levBagryansky
Copy link
Member Author

@yegor256 I tried to use Dataized in this script and get the error

[ERROR] /home/tardis3/eo/eo-runtime/src/test/groovy/check-eo-classes-are-public.groovy: 29: unable to resolve class org.eolang.Dataized
[ERROR]  @ line 29, column 1.
[ERROR]    import org.eolang.Dataized
[ERROR]   

Looks like the main issue is how to use foreign dependencies in groovy-maven-plugin

@yegor256
Copy link
Member

@levBagryansky that's what I'm saying. You don't need Groovy for this task. Just create a normal unit test in the eo-runtime: it should scan the classpath, find all classes in the EOorg.EOeolang package, and check their access modifiers (through reflection). Should be easy. Most probably you should use this lib: https://github.com/ronmamo/reflections

@levBagryansky
Copy link
Member Author

@yegor256 please check. For some reason reflections did not counted all classes, so I used guava here. Here we check 827 classes

@levBagryansky
Copy link
Member Author

@yegor256 please check

@yegor256
Copy link
Member

yegor256 commented May 2, 2024

@rultor merge

@rultor
Copy link
Contributor

rultor commented May 2, 2024

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 7b44858 into objectionary:master May 2, 2024
20 checks passed
@rultor
Copy link
Contributor

rultor commented May 2, 2024

@rultor merge

@yegor256 Done! FYI, the full log is here (took me 17min)

yegor256 added a commit that referenced this pull request May 3, 2024
@levBagryansky levBagryansky deleted the 3058_all-atoms-are-public branch May 3, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We can speed up switch object
4 participants