-
Notifications
You must be signed in to change notification settings - Fork 172
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
Separate API from the JRuby implementation #589
Comments
This seems like a great direction for the 1.6.0 branch. 👍 |
Sounds good. |
I have started with the
Any Idea what I should do with:
They depend on JRuby and they should stay in the I guess this is a split-package problem. Isn’t it? |
I have started something here: With commit 8742acd I have moved the |
This is a nice start! NodeCache is a utility class that helps to keep the association between a Ruby node and the corresponding Java counterpart. It hides the Java node as a property of the Ruby node. The split package problem with Java 9 modules would require us to not share any packages between two jars, i.e. if org.asciidoctor.ast is in the api module, org.asciidoctor.ast.impl cannot be in another module. |
I was not aware that the packages are hierachical in Java 9. |
Just tested and you're right. Somehow I thought that if module A has package p1, the module B could not have p1.p2. But it seems like it seems to work indeed. So simply forget my comment ;-) |
BTW it's probably best if you forget everything I was saying wrt Java 9. |
The packages also plays an important role for OSGi. I need to perform some tests in this area (since 2015 I stopped to use Equinox when I stop to work on Eclipse RCP Application), because if we let it like this About your remark on There are 4 classes in
What is the idea here? Transform them to interfaces (this is probabelly more correct for an API project). As user I have a good idea of the difference between an API project and one implementation, but I am really new at coding one. I really like the approach of doing steps that are as small as possible (considering Java 9 modules later, just moving a first package, ...). I also would like to thank you for your advices and for your quick answers. |
These 4 classes seem to sit on top of the other AST classes. But yes, it would be good to split out interfaces for these as well. |
I have started a first Pull Request with the move of This a first step to solve this issue, but this is not the complete story. My next step would be to create the testing support for the api project (input welcomed). Then other packages should also be moved into the As far as I have tested, it is OK to have the same package in 2 OSGi modules. That said, the two classes ( |
While I was working on an alternative implementation, I noticed that it would be nice if the method signature for method returning list would be changed. The generics parameter should contains a wildcard. Example: OLD:
NEW:
See commit: c36f894 For me this is a second step/topic. What is your opinion, should I push something like that in PR #590 or should I wait? |
Makes sense to me as these lists are never passed back again as parameters to AsciidoctorJ. |
Thank you for your feedback... What is your workflow for the multiple changes:
|
Just do it in one PR, that's fine. (Sorry for being so slow in responding, days are long at the moment.) |
I have pushed more commits to #590. The discussed change with wildcard and other cleanup commits that I made by reviewing the code. (No worries about your review pace, for a non-commercial open-source project, it is good. I am very happy to get your feedback) |
In order to write tests I need that are decoupled from the parser, I need to be able to instanciate a AST based on the ruby implementation from scratch. See my question on the mailing list: API to create a valid AST from scratch |
I can't imagine that this is possible at the moment. |
new PR for the next package: #603 ( |
new PR for the |
For the moment, interfaces like the one defined in the
org.asciidoctor.ast
package for the AST are available in the asciidoctorj project. In my opinion, they should be separated in a asciidoctorj-api project, that have no dependency on JRuby.In order to perform tests, there is the need to have a second project: asciidoctorj-tck that define tests on the object defined in asciidoctorj-api regardless of the underlying implementation.
I am not really familiar with this construct, but the tests in asciidoctorj-tck needs to be abstract and needs to delegate some functionality to the underlying implementation.
Take as example the test:
WhenAsciiDocIsRenderedToDocument# should_find_elements_from_document()
The first line is implementation specific:
This could correspond to an abstract method in the TCK:
(of course the DOCUMENT String should also be part of the TCK)
The rest of the method is not implementation specific and should be in the TCK:
I will start to experiment in this direction on the
asciidoctorj-1.6.0
branch. If the result is good enough, I will propose a Pull-Request.Please provide early feedback if you think the approach is wrong or if you have better patterns in minds to separate API and JRuby-implementation.
The text was updated successfully, but these errors were encountered: