You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ApiRemovalProcess.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ See [Eclipse Project Deprecation Policy](Eclipse_API_Central_Deprecation_Policy.
4
4
5
5
For new API planned removals use:
6
6
7
-
* For Java code use the @Deprecated annotation (see below for an example) and optional additional Javadoc.
7
+
* For Java code use the @Deprecated annotation (see below for an example) and optional additional Javadoc.
8
8
An extra entry in the removal document from [removal document](https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fporting%2Fremovals.html) is not necessary anymore
9
9
* If appropriate the @noextend@noreference and @noinstantiate Javadoc annotation should be added to code
10
10
@@ -15,15 +15,15 @@ Javadoc generates a detailed [list of forRemoval](https://help.eclipse.org/lates
15
15
16
16
Example of a deprecation comment:
17
17
18
-
```
18
+
```java
19
19
*XXX
20
20
*@noreference
21
21
*@noextend
22
22
*@noimplement
23
23
*@deprecatedThisXXX (class/method/field) will be removed in a future release. UseXXX instead.
24
24
*/
25
25
@Deprecated(forRemoval=true, since="2025-06")
26
-
```
26
+
```
27
27
* The PMC may decide to back out of an API removal
28
28
* In general, removing a deprecated API does NOT cause the increase of the major version segment.
Copy file name to clipboardExpand all lines: docs/Coding_Conventions.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@ Coding Conventions
3
3
4
4
Oracle has established coding standards that are generally considered reasonable, as evidenced by their widespread adoption by other Java-based development efforts. One of the goals is to make the Eclipse Platform blend in with the Java platform. This goal is furthered by our following suit.
5
5
6
-
[Oracle's Code Conventions for the Java Programming Language](https://www.oracle.com/java/technologies/javase/codeconventions-contents.html) covers filenames, file organization, indentation, comments, declarations, statements, white space, naming conventions, and programming practices.
7
-
All code written for the Eclipse Platform should follow these conventions except as noted below.
6
+
[Oracle's Code Conventions for the Java Programming Language](https://www.oracle.com/java/technologies/javase/codeconventions-contents.html) covers filenames, file organization, indentation, comments, declarations, statements, white space, naming conventions, and programming practices.
7
+
All code written for the Eclipse Platform should follow these conventions except as noted below.
8
8
We deviate only in places where our needs differ from Oracle's; when we do deviate, we explain why. (The section numbers shown below are Oracle's.)
9
9
10
10
* Section 3.1.1 Beginning Comments
@@ -21,10 +21,11 @@ The Eclipse project has more specific naming conventions. See Eclipse Project [N
21
21
22
22
Modifiers should be ordered as specified in the JLS and summarized in [AST#newModifiers(int)](http://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/dom/AST.html#newModifiers-int-):
23
23
24
+
```java
24
25
publicprotectedprivate
25
26
abstractdefaultstaticfinal
26
27
synchronizednative strictfp transientvolatile
27
-
28
+
```
28
29
29
30
For Javadoc conventions, see Oracle's [How to Write Doc Comments for the Javadoc Tool](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html) and [Eclipse/API_Central](API_Central.md).
Copy file name to clipboardExpand all lines: docs/Eclipse_API_Central_Deprecation_Policy.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
Eclipse/API Central/Deprecation Policy
2
2
======================================
3
3
4
-
This page contains Eclipse Project guidelines on API deprecation.
4
+
This page contains Eclipse Project guidelines on API deprecation.
5
5
This page is maintained by the [Eclipse/PMC](https://eclipse.dev/eclipse/team-leaders.php).
6
6
7
7
8
8
What is Deprecation?
9
9
====================
10
10
11
-
API deprecation is used to inform API clients that a particular API element is no longer recommended for use.
11
+
API deprecation is used to inform API clients that a particular API element is no longer recommended for use.
12
12
The deprecation comment should describe the reason for the deprecation, and directions for how to replace their usage with the new recommended way of doing things.
13
13
Deprecation does not necessary implies that the API will be deleted in a future release unless it is explicitely marked for deletion.
14
14
@@ -20,7 +20,7 @@ Process to deprecate an API
20
20
Identifying Deprecated API
21
21
==========================
22
22
23
-
This section describes how clients can identify what API is deprecated.
23
+
This section describes how clients can identify what API is deprecated.
24
24
To identify API from non-API, see [Provisional API Guidelines](Provisional_API_Guidelines.md)
25
25
26
26
Java API
@@ -31,16 +31,17 @@ Java API is deprecated through use of the @Deprecate annotation.
31
31
If it is planned to be removed in the future set the forRemoval = true property.
32
32
In this case, the since tag should include the release in which is was marked for deletion.
33
33
34
+
```java
34
35
@Deprecated(forRemoval=true, since="2024-12")
36
+
```
35
37
36
-
37
-
Older code used @deprecated javadoc tag on types, methods, and fields.
38
+
Older code used @deprecated javadoc tag on types, methods, and fields.
38
39
The javadoc paragraph following the @deprecated tag defines the rationale for the deprecation and instructions on moving to equivalent new API.
39
40
40
41
Extension Points
41
42
----------------
42
43
43
-
Elements and attributes in extension points are deprecated by setting the "Deprecated" property to true in the PDE extension point schema editor.
44
+
Elements and attributes in extension points are deprecated by setting the "Deprecated" property to true in the PDE extension point schema editor.
44
45
The entire extension point can be deprecated by deprecating the "extension" element, which is the top level element at the root of any contribution to the extension point.
Copy file name to clipboardExpand all lines: docs/Evolving-Java-based-APIs-3.md
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Other notes
10
10
Data Compatibility
11
11
------------------
12
12
13
-
The Component implementation may need to store and retrieve its internal data from a file. For example, Microsoft Word stores a document in a file. When one of these files may live from release to release, clients would break if the format or interpretation of that data changed in an incompatible way.
13
+
The Component implementation may need to store and retrieve its internal data from a file. For example, Microsoft Word stores a document in a file. When one of these files may live from release to release, clients would break if the format or interpretation of that data changed in an incompatible way.
14
14
**Data compatibility** is an additional issue for components with persistent data.
15
15
16
16
The standard technique is to tag all stored data with its format version number. The format version number is increased when the format is changed from one release to the next. The Component implementation contains readers for the current format version and for all past versions, but usually only the writer for the current format version (unless for some reason there is an ongoing need to write older versions).
@@ -34,9 +34,11 @@ Even simpler than Deprecate and Forward, the Component API and implementation ca
34
34
35
35
Here is a simple technique for adding an argument to a method that is intended to be overridden by subclasses. For example the `Viewer.inputChanged(Object input)` method should get an additional argument `Object oldInput`. Adding the argument results in pre-existing clients overridding the wrong method. The workaround is to call the old method as the default implementation of the new method:
Pre-existing clients which override the old method continue to work; and all calls to the old method continue to work. New or upgraded clients will override the new method; and all calls to the new method will work, even if they happen to invoke an old implementation.
42
44
@@ -48,37 +50,45 @@ Since Java 8, this technique also works for interface methods (new method is a d
48
50
49
51
The first release of an API callback-style interface didn't work as well as hoped. For example, the first release contained:
50
52
53
+
```java
51
54
publicinterfaceIProgressMonitor {
52
55
voidstart();
53
56
voidstop();
54
57
}
55
-
58
+
```
59
+
56
60
You now wish you had something like:
57
61
62
+
```java
58
63
publicinterfaceIProgressMonitor {
59
64
voidstart(inttotal);
60
65
voidworked(intunits);
61
66
voidstop();
62
67
}
63
-
68
+
```
69
+
64
70
But it's too late to change `IProgressMonitor` to be that API. So you mark `IProgressMonitor` as deprecated and introduce the new and improved one under the name `IProgressMonitor2` (a name everyone recognizes as the second attempt):
By declaring the new interface to extend the old one, any object of type `IProgressMonitor2` can be passed to a method expecting an old `IProgressMonitor`. Don't forget to mention `IProgressMonitor2` in the API of `IProgressMonitor`, even if you don't deprecate it, e.g.:
73
81
82
+
```java
74
83
/**
75
84
* [...]
76
85
* @see IProgressMonitor2
77
86
*/
78
87
publicinterfaceIProgressMonitor {
79
88
[...]
80
89
}
81
-
90
+
```
91
+
82
92
### COM Style
83
93
84
94
The "COM style" is to not implement interfaces directly but to ask for an interface by using `getAdapter(someInterfaceID)`. This allows adding new interfaces in the implementation without breaking existing classes.
@@ -168,5 +178,5 @@ On the other hand, clients should avoid all `Class.getDeclared_XXX_` methods as
168
178
Versioning
169
179
----------
170
180
171
-
It should be easy for API clients to know whether a new version of your components broke APIs or not.
181
+
It should be easy for API clients to know whether a new version of your components broke APIs or not.
172
182
Eclipse projects implement semantic versioning according to the [Version Numbering](VersionNumbering.md) specification.
Copy file name to clipboardExpand all lines: docs/Evolving-Java-based-APIs.md
+25-9Lines changed: 25 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@ Document is currently split in 3 parts:
7
7
*[Part 2: Achieving API Binary Compatibility](Evolving-Java-based-APIs-2.md)
8
8
*[Part 3: Other Notes](Evolving-Java-based-APIs-3.md)
9
9
10
-
This document is about how to evolve Java-based APIs while maintaining compatibility with existing client code.
11
-
Without loss of generality, we'll assume that there is a generic **Component** with a **Component API**, with one party providing the Component and controlling its API.
10
+
This document is about how to evolve Java-based APIs while maintaining compatibility with existing client code.
11
+
Without loss of generality, we'll assume that there is a generic **Component** with a **Component API**, with one party providing the Component and controlling its API.
12
12
The other party, or parties, write **Client** code that use the Component's services through its API. This is a very typical arrangement.
13
13
14
14
@@ -43,7 +43,7 @@ Changing an API in a way that is incompatible with existing Clients would mean t
43
43
44
44
As the Component API evolves, all pre-existing Clients are expected to continue to work, both in principle and in practice.
45
45
46
-
Suppose a Client was written to a given release of the Component and abided by the contracts spelled out in the Component API specification.
46
+
Suppose a Client was written to a given release of the Component and abided by the contracts spelled out in the Component API specification.
47
47
The first requirement is that when the Component API evolves to follow-on releases, all pre-existing Client must still be legal according to the contracts spelled out in the revised Component API specification, without having to change the Clients source code. This is what is meant by continuing to work in principle.
48
48
49
49
> **API Contract Compatibility:**_API changes must not invalidate formerly legal Client code._
@@ -79,11 +79,11 @@ Note that in some cases, the contractual roles are reversed. The party responsib
79
79
80
80
When contemplating changing an existing API contract, the key questions to ask are:
81
81
82
-
* What roles does the API contract involve?
82
+
* What roles does the API contract involve?
83
83
For a method contract, there is the caller and the implementor. In the case of frameworks, there is also an additional contract between superclass and subclass regarding default behavior, extending, and overriding.
84
-
* Which role or roles will each party play?
84
+
* Which role or roles will each party play?
85
85
For many Component API methods, the Component plays the role of exclusive implementor and the Client plays the role of caller. In the case of Component callbacks, the Component plays the caller role and the Client plays the implementor role. In some cases, the Client might play more than one role.
86
-
* Is a role played exclusively by the Component?
86
+
* Is a role played exclusively by the Component?
87
87
Component API changes coincide with Component releases, making it feasible to change Component code to accommodate the changed APIs.
88
88
* For roles played by Clients, would the contemplated API change render invalid a hypothetical Client making legal usage of the existing API?
89
89
@@ -95,24 +95,30 @@ Standard method contracts have two roles: caller and implementor. Method postcon
95
95
96
96
Consider the following API method specification:
97
97
98
+
```java
98
99
/** Returns the list of children of this widget.
99
100
* @return a non-empty list of widgets
100
101
*/
101
102
Widget[] getChildren();
103
+
```
102
104
103
105
The contemplated API change is to allow the empty list of widgets to be returned as well, as captured by this revised specification:
104
106
107
+
```java
105
108
/** Returns the list of children of this widget.
106
109
* @return a list of widgets
107
110
*/
108
111
Widget[] getChildren();
112
+
```
109
113
110
114
Would this change break compatibility with existing Clients? It depends on the role played by the Client.
111
115
112
116
Looking at the caller role, this change would break a hypothetical pre-existing caller that legitimately counts on the result being non-empty. The relevant snippet from this hypothetical caller might read:
113
117
118
+
```java
114
119
Widget[] children = widget.getChildren();
115
120
Widget firstChild = children[0];
121
+
```
116
122
117
123
Under the revised contract, this code would be seen to be in error because it assumes that the result of invoking `getChildren` is non-empty; under the previous contract, this assumption was just fine. This API change weakens a postcondition for the caller, and is not contract compatible for the caller role. The contemplated change would break Clients playing the caller role.
118
124
@@ -128,25 +134,31 @@ Method preconditions are those things that a caller must arrange to be true befo
128
134
129
135
Consider the following API method specification:
130
136
137
+
```java
131
138
/** Removes the given widgets from this widget's list of children.
132
139
* @param widgets a non-empty list of widgets
133
140
*/
134
141
void remove(Widget[] widgets);
135
-
142
+
```
143
+
136
144
The contemplated API change is to allow empty lists of widgets to be passed in as well:
137
145
146
+
```java
138
147
/** Removes the given widgets from this widget's list of children.
139
148
* @param widgets a list of widgets
140
149
*/
141
150
void remove(Widget[] widgets);
151
+
```
142
152
143
153
Would this change break compatibility with existing Clients? Again, it hinges on the role played by the Client.
144
154
145
155
Looking at the caller role, this change would not break hypothetical pre-existing callers since they pass in non-empty lists. However, this change would break a hypothetical pre-existing implementations that legitimately assumed that the argument is not empty.
146
156
147
157
The relevant snippet from this hypothetical implementor might read:
148
158
159
+
```java
149
160
Widget firstChild = widgets[0];
161
+
```
150
162
151
163
Under the revised contract, this code would be seen to be in error because it assumes that the argument is non-empty; under the previous contract, this assumption was just fine. This API change weakens a method precondition, and is not contract compatible for the implementor role. The contemplated change would break Clients that implement this method.
152
164
@@ -156,15 +168,19 @@ Fields can be analyzed as having two roles: a getter and a setter. The Java lang
156
168
157
169
Consider the following API field specification:
158
170
171
+
```java
159
172
/** This widget's list of children, or <code>null</code>.
160
173
*/
161
174
Widget[] children;
162
-
175
+
```
176
+
163
177
The contemplated API change is to get rid of the possibility of the `null` value:
164
178
179
+
```java
165
180
/** This widget's list of children.
166
181
*/
167
182
Widget[] children;
183
+
```
168
184
169
185
Would this change break compatibility with existing Clients?
170
186
@@ -182,7 +198,7 @@ However, if the method is added to a class which Clients may subclass, then the
182
198
183
199
### General Rules for Contract Compatibility
184
200
185
-
Whether a particular Component API change breaks or maintains contract compatibility with hypothetical pre-existing Clients hinges on which role, or roles, the Client plays in the API contract(s) being changed. The following table summarizes the pattern seen in the above examples:
201
+
Whether a particular Component API change breaks or maintains contract compatibility with hypothetical pre-existing Clients hinges on which role, or roles, the Client plays in the API contract(s) being changed. The following table summarizes the pattern seen in the above examples:
0 commit comments