This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 189638

Summary: Separate and deprecate the old formatting API
Product: editor Reporter: Vitezslav Stejskal <vstejskal>
Component: Formatting & IndentationAssignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED FIXED    
Severity: normal Keywords: API, API_REVIEW_FAST
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Bug Depends on: 152655    
Bug Blocks: 120357    
Attachments: editor.lib signature changes against trunk (~Nb6.9)
editor signature changes against trunk (~Nb6.9)
Cumulative patch with changes in trunk
Cumulative patch with changes in contrib

Description Vitezslav Stejskal 2010-08-18 13:05:08 UTC
Although editor.indent has been around for a while, the editor and editor.lib modules still contain classes and code that support and use the old formatting API. This situation is confusing for module owners who tend to ignore editor.indent API and keep using the old formatting API.

We should separate the old formatting API to a deprecated autoload module the same way as we did with the old settings and code completion APIs. This issue is here to track progress on this task.
Comment 1 Vitezslav Stejskal 2010-08-18 13:47:57 UTC
I have done the separation together with my work on Typing Hooks SPI (issue #152655), which has now pretty much gone through the API review and can be applied to trunk.

I'll try to prepare a patch the way that Jesse suggested in #152655 and attach it here, but it's going to be quite large. It might be better to just give a brief overview of the changes:

- the old API was separated to editor.deprecated.pre65formatting autoload module
- all trunk and contrib modules that could be easily migrated to editor.indent were changed; the only remaining (active) modules that still need to depend on e.d.pre65formatting are:

  db.sql.editor - SQL Editor
  editor.structure - XML Editor
  java.editor - Java Editor
  java.editor.lib - Java Editor
  web.core.syntax - JSP Editor
  xml.text - XML Editor

These modules are SPI clients (eg. implement the old Formatter) and could not be easily migrated. They work as before (AFAICT), but should be rewritten to use the new editor.indent API.

- The changes has been made as much backwards compatible as it was practical. Unfortunately there were methods in BaseKit and BaseDocument that required some of the old formatting API classes (eg. used Formatter as a return type, etc) and these had to be removed. I'll attach signature test diff files for editor and editor.lib modules as a reference.
Comment 2 Vitezslav Stejskal 2010-08-18 13:49:58 UTC
Created attachment 101489 [details]
editor.lib signature changes against trunk (~Nb6.9)
Comment 3 Vitezslav Stejskal 2010-08-18 13:50:35 UTC
Created attachment 101491 [details]
editor signature changes against trunk (~Nb6.9)
Comment 4 Vitezslav Stejskal 2010-08-19 12:53:18 UTC
The migration guide for module owners can be found on this wiki - http://wiki.netbeans.org/EditorFormattingAPIUpgrade
Comment 5 Vitezslav Stejskal 2010-08-24 11:13:41 UTC
Created attachment 101626 [details]
Cumulative patch with changes in trunk
Comment 6 Vitezslav Stejskal 2010-08-24 11:14:13 UTC
Created attachment 101627 [details]
Cumulative patch with changes in contrib
Comment 7 Vitezslav Stejskal 2010-08-24 11:17:34 UTC
The two cumulative patches (trunk and contrib) contain all the changes done in order to separate the old editor formatting API and also to implement Typing Hooks SPI (issue #152655).
Comment 8 Vitezslav Stejskal 2010-08-24 13:03:32 UTC
This is more just a heads up than a review request. I've done separating the old formatting API from editor.lib and editor modules. Please read my previous posts in this issue for details (patches, signature changes, migration guide, etc). Besides of the few modules listed above no other modules need the old API. All the modules in -Dcluster.config=experimental are buildable and run fine in the IDE as far as I can tell. I'll also check that the tests are compilable before the final push.

Since the changes in editor.lib are not backwards compatible I incremented the release and spec versions of this module and updated all other modules dependencies. The same was done for editor module's spec version.

If there are any questions or concerns please post them here. Otherwise, I'd like to integrate this by the end of this week. Thanks
Comment 9 Vitezslav Stejskal 2010-08-27 11:19:43 UTC
This has been just pushed to jet-main clone.

One thing to note: I had to add org.netbeans.modules.editor.deprecated.pre65formatting to the list of modules that are ignored in ValidateModulesTest, otherwise commit-validation was failing. Once the remaining modules that still require e.d.pre65formatting are updated (see the list in comment #1) the change can be reverted.

http://hg.netbeans.org/jet-main/rev/fc54a517938d
Comment 10 Quality Engineering 2010-08-31 03:23:45 UTC
Integrated into 'main-golden', will be available in build *201008310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/dfce778acb96
User: Vita Stejskal <vstejskal@netbeans.org>
Log: fixing javadoc tests after #189638 integration; LegacyFormattersProvider allowing to inject old Formatter implementations to the new editor.indent infrastructure relies on KitsTracker, which needs true module layer registrations and does not work well with MockMimeLookp
Comment 11 Quality Engineering 2010-09-07 03:14:36 UTC
Integrated into 'main-golden', will be available in build *201009070000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/49c9599a78dd
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #189638: updating spec. versions to force rebuild of AUC
Comment 12 Quality Engineering 2010-09-08 03:32:15 UTC
Integrated into 'main-golden', will be available in build *201009080000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/49c9599a78dd
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #189638: updating spec. versions to force rebuild of AUC
Comment 13 Quality Engineering 2011-08-27 14:16:32 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/b19a94c7a2b7
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #189638: updating spec. versions to force rebuild of AUC