mbien commented on code in PR #9307:
URL: https://github.com/apache/netbeans/pull/9307#discussion_r3034555386


##########
platform/openide.modules/src/org/openide/modules/Dependency.java:
##########
@@ -361,6 +365,39 @@ public static Set<Dependency> create(int type, String 
body) throws IllegalArgume
         return deps;
     }
 
+    /**

Review Comment:
   the class itself can be only constructed from the inside. The `create(String 
body)` factory method is essentially a parsing constructor and can be fed 
Strings like `org.netbeans.bootstrap/1` to create dependencies (which is done 
in some cases).
   
   Even `Dependency.create(Dependency.TYPE_MODULE, "hugo");` would already 
return a dependency.
   
   The first impl for performance measurements had the constructor made public 
and the new `read/write()` methods were outside. However, the code was also a 
bit less maintainable since `read/write()` are used from two different places:
   
   `org.netbeans.ModuleData` and `org.netbeans.core.startup.ModuleList` both 
use `read()/write()`
   
   I couldn't come up with a better solution, since the goal is to avoid using 
`ObjectOutputStream`. Using `read/writeObject` actually performed worse and 
produced larger files, `Externalizable` would require a public no-arg 
constructor so I discarded that thought early + I believe it would also have 
required to keep `ObjectOutputStream`. (both cases would also have public 
methods)
   
   Having them package private would require accessor utilities in two modules 
using the same namespace. Also not pretty. Maybe a comment that the methods are 
only meant for short term storage would be sufficient?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to