Skip to content

Commit 70c683c

Browse files
Mailaenderakurtakov
authored andcommitted
Add syntax highlighting.
1 parent 45008d8 commit 70c683c

File tree

163 files changed

+907
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+907
-465
lines changed

docs/ApiRemovalProcess.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ See [Eclipse Project Deprecation Policy](Eclipse_API_Central_Deprecation_Policy.
44

55
For new API planned removals use:
66

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.
88
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
99
* If appropriate the @noextend @noreference and @noinstantiate Javadoc annotation should be added to code
1010

@@ -15,15 +15,15 @@ Javadoc generates a detailed [list of forRemoval](https://help.eclipse.org/lates
1515

1616
Example of a deprecation comment:
1717

18-
```
18+
```java
1919
* XXX
2020
* @noreference
2121
* @noextend
2222
* @noimplement
2323
* @deprecated This XXX (class/method/field) will be removed in a future release. Use XXX instead.
2424
*/
2525
@Deprecated(forRemoval = true, since = "2025-06")
26-
```
26+
```
2727
* The PMC may decide to back out of an API removal
2828
* In general, removing a deprecated API does NOT cause the increase of the major version segment.
2929

docs/Coding_Conventions.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Coding Conventions
33

44
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.
55

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.
88
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.)
99

1010
* Section 3.1.1 Beginning Comments
@@ -21,10 +21,11 @@ The Eclipse project has more specific naming conventions. See Eclipse Project [N
2121

2222
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-):
2323

24+
```java
2425
public protected private
2526
abstract default static final
2627
synchronized native strictfp transient volatile
27-
28+
```
2829

2930
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).
3031

docs/Eclipse_API_Central_Deprecation_Policy.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Eclipse/API Central/Deprecation Policy
22
======================================
33

4-
This page contains Eclipse Project guidelines on API deprecation.
4+
This page contains Eclipse Project guidelines on API deprecation.
55
This page is maintained by the [Eclipse/PMC](https://eclipse.dev/eclipse/team-leaders.php).
66

77

88
What is Deprecation?
99
====================
1010

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.
1212
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.
1313
Deprecation does not necessary implies that the API will be deleted in a future release unless it is explicitely marked for deletion.
1414

@@ -20,7 +20,7 @@ Process to deprecate an API
2020
Identifying Deprecated API
2121
==========================
2222

23-
This section describes how clients can identify what API is deprecated.
23+
This section describes how clients can identify what API is deprecated.
2424
To identify API from non-API, see [Provisional API Guidelines](Provisional_API_Guidelines.md)
2525

2626
Java API
@@ -31,16 +31,17 @@ Java API is deprecated through use of the @Deprecate annotation.
3131
If it is planned to be removed in the future set the forRemoval = true property.
3232
In this case, the since tag should include the release in which is was marked for deletion.
3333

34+
```java
3435
@Deprecated(forRemoval = true, since="2024-12")
36+
```
3537

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.
3839
The javadoc paragraph following the @deprecated tag defines the rationale for the deprecation and instructions on moving to equivalent new API.
3940

4041
Extension Points
4142
----------------
4243

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.
4445
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.
4546

4647
![Schema-deprecation.png](images/Schema-deprecation.png)

docs/Evolving-Java-based-APIs-3.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Other notes
1010
Data Compatibility
1111
------------------
1212

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.
1414
**Data compatibility** is an additional issue for components with persistent data.
1515

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

3535
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:
3636

37+
```java
3738
public void inputChanged(Object input, Object oldInput) {
3839
inputChanged(input);
3940
}
41+
```
4042

4143
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.
4244

@@ -48,37 +50,45 @@ Since Java 8, this technique also works for interface methods (new method is a d
4850

4951
The first release of an API callback-style interface didn't work as well as hoped. For example, the first release contained:
5052

53+
```java
5154
public interface IProgressMonitor {
5255
void start();
5356
void stop();
5457
}
55-
58+
```
59+
5660
You now wish you had something like:
5761

62+
```java
5863
public interface IProgressMonitor {
5964
void start(int total);
6065
void worked(int units);
6166
void stop();
6267
}
63-
68+
```
69+
6470
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):
6571

72+
```java
6673
public interface IProgressMonitor2 extends IProgressMonitor {
6774
void start(int total);
6875
void worked(int units);
6976
void stop();
7077
}
71-
78+
```
79+
7280
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.:
7381

82+
```java
7483
/**
7584
* [...]
7685
* @see IProgressMonitor2
7786
*/
7887
public interface IProgressMonitor {
7988
[...]
8089
}
81-
90+
```
91+
8292
### COM Style
8393

8494
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
168178
Versioning
169179
----------
170180

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.
172182
Eclipse projects implement semantic versioning according to the [Version Numbering](VersionNumbering.md) specification.

docs/Evolving-Java-based-APIs.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Document is currently split in 3 parts:
77
* [Part 2: Achieving API Binary Compatibility](Evolving-Java-based-APIs-2.md)
88
* [Part 3: Other Notes](Evolving-Java-based-APIs-3.md)
99

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.
1212
The other party, or parties, write **Client** code that use the Component's services through its API. This is a very typical arrangement.
1313

1414

@@ -43,7 +43,7 @@ Changing an API in a way that is incompatible with existing Clients would mean t
4343

4444
As the Component API evolves, all pre-existing Clients are expected to continue to work, both in principle and in practice.
4545

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.
4747
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.
4848

4949
> **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
7979

8080
When contemplating changing an existing API contract, the key questions to ask are:
8181

82-
* What roles does the API contract involve?
82+
* What roles does the API contract involve?
8383
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?
8585
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?
8787
Component API changes coincide with Component releases, making it feasible to change Component code to accommodate the changed APIs.
8888
* For roles played by Clients, would the contemplated API change render invalid a hypothetical Client making legal usage of the existing API?
8989

@@ -95,24 +95,30 @@ Standard method contracts have two roles: caller and implementor. Method postcon
9595

9696
Consider the following API method specification:
9797

98+
```java
9899
/** Returns the list of children of this widget.
99100
* @return a non-empty list of widgets
100101
*/
101102
Widget[] getChildren();
103+
```
102104

103105
The contemplated API change is to allow the empty list of widgets to be returned as well, as captured by this revised specification:
104106

107+
```java
105108
/** Returns the list of children of this widget.
106109
* @return a list of widgets
107110
*/
108111
Widget[] getChildren();
112+
```
109113

110114
Would this change break compatibility with existing Clients? It depends on the role played by the Client.
111115

112116
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:
113117

118+
```java
114119
Widget[] children = widget.getChildren();
115120
Widget firstChild = children[0];
121+
```
116122

117123
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.
118124

@@ -128,25 +134,31 @@ Method preconditions are those things that a caller must arrange to be true befo
128134

129135
Consider the following API method specification:
130136

137+
```java
131138
/** Removes the given widgets from this widget's list of children.
132139
* @param widgets a non-empty list of widgets
133140
*/
134141
void remove(Widget[] widgets);
135-
142+
```
143+
136144
The contemplated API change is to allow empty lists of widgets to be passed in as well:
137145

146+
```java
138147
/** Removes the given widgets from this widget's list of children.
139148
* @param widgets a list of widgets
140149
*/
141150
void remove(Widget[] widgets);
151+
```
142152

143153
Would this change break compatibility with existing Clients? Again, it hinges on the role played by the Client.
144154

145155
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.
146156

147157
The relevant snippet from this hypothetical implementor might read:
148158

159+
```java
149160
Widget firstChild = widgets[0];
161+
```
150162

151163
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.
152164

@@ -156,15 +168,19 @@ Fields can be analyzed as having two roles: a getter and a setter. The Java lang
156168

157169
Consider the following API field specification:
158170

171+
```java
159172
/** This widget's list of children, or <code>null</code>.
160173
*/
161174
Widget[] children;
162-
175+
```
176+
163177
The contemplated API change is to get rid of the possibility of the `null` value:
164178

179+
```java
165180
/** This widget's list of children.
166181
*/
167182
Widget[] children;
183+
```
168184

169185
Would this change break compatibility with existing Clients?
170186

@@ -182,7 +198,7 @@ However, if the method is added to a class which Clients may subclass, then the
182198

183199
### General Rules for Contract Compatibility
184200

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

187203
| | | | |
188204
| --- | --- | --- | --- |

0 commit comments

Comments
 (0)