sdedic commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1027149107


##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
     public static final FoldType JAVADOC_FOLD_TYPE = 
JavaElementFoldManager.JAVADOC_FOLD_TYPE;
 
     public static final FoldType CODE_BLOCK_FOLD_TYPE = 
JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;

Review Comment:
   @Chris2011 - even though APIs get deprecated, I don't remember a situation 
when an API was actually *dropped*, breaking backward compatibility - at least 
not in such (semantically) 'central' module as java editor. In the past some 
APIs were broken (see that many modules have /1 or /2 suffixes, which indicates 
a breaking change), but even during "headless split" (cca NetBeans 8.2) we did 
not actually drop APIs: see the `*.compat` modules that contain compatibility 
layer for old applications. Sadly the (deprecated) `java.editor.lib` is such 
official API with 'forever' commitment.
   
   But I have made a mistake in my reasoning ! If I suppose that an ancient 
unmantained and useful module still uses the old `editor.lib` APIs, it won't 
ship that library. So if we leave the (deprecated, misnamed) 
`JavaFoldManager.CODE_BLOCK_FOLD_TYPE` and relay it to the new, proper-named 
(but nonpublic) JavaElementFoldManager.METHOD_BLOCK_FOLD_TYPE.  So the ancient 
client links to the misnamed symbol - but from a 'new version of deprecated 
`java.editor.lib`, thus getting the fold still labeled "method". No semantic 
change, no settings change. And NB codebase can now use properly named 
`CODE_BLOCK` and `METHOD_BLOCK`.  Old code lives with past sins, new code uses 
proper names and even can correctly read the old settings !
   
   Re FoldCreator: the `createCodeBlockFold` seems to be also now called for 
initializers and static initializers: we should preserve the fold behaviour 
here IMHO - that an initializer's fold is controlled by method's settings - but 
then `createMethodFold` would be awkward for an initializer - wouldn't it ? BTW 
- isn't there a typo ? The other `FoldCreator` methods use singular nouns but 
`createMethodsFold` uses plural.



-- 
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