Skip to content

Conversation

johnmay
Copy link
Member

@johnmay johnmay commented Jan 10, 2025

…rce the RDfile reader has one.

Different Java version's didn't like a piece of code the the RDfile reader constructor - I spotted it when I wrote the sample code for the release and accidentally committed it here: f351dd0#diff-c8b0d51b33ab2fde91ce878d3b9887e6063201b65be2fa98b6a842643a4b4fceL138-R140.

I have added the option for the IChemObjectBuilder to look one up via reflection, @egonw and I have talked about this previously.

@johnmay johnmay requested a review from uli-f January 10, 2025 10:24
@egonw
Copy link
Member

egonw commented Jan 10, 2025

Looks good. Same as for the other PR, for 2.10.x or 2.11?

Copy link
Member

@uli-f uli-f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the concept of the builder cache. The reason it's required for RdfileReader might be an oversight on my end (see comment below).
Happy to carry out the suggested changes myself, whatever suits you better.

@@ -137,7 +137,7 @@ public RdfileReader(InputStream in, IChemObjectBuilder chemObjectBuilder, boolea
* @param reader the Reader providing the RDfile data
*/
public RdfileReader(Reader reader) {
Copy link
Member

@uli-f uli-f Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method signature looks like an oversight on my end, my apologies. Looking at the javadocs it states that it takes an IChemObjectBuilder; moreover, both constructors that accept an InputStream also require an IChemObjectBuilder.

Suggestion: I would mark this constructor @deprecated and add a new one:

public RdfileReader(Reader reader, IChemObjectBuilder chemObjectBuilder) {
  this(reader, chemObjectBuilder, true);
}

Comment on lines 21 to 24
import org.openscience.cdk.tools.LoggingToolFactory;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused imports

Copy link

@johnmay
Copy link
Member Author

johnmay commented Jan 10, 2025

I think we still have the IChemObjectBuilder cache as Egon and I had considered this previously. @egonw good to merge if you like.

@egonw egonw merged commit bb6a216 into main Jan 11, 2025
9 checks passed
@egonw egonw deleted the patch/rdfile-reader branch March 1, 2025 08:48
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.

3 participants