Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 507701 | Differences between
and this patch

Collapse All | Expand All

(-)a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/compatibility/MissingSinceTagTests.java (+19 lines)
Lines 191-196 Link Here
191
	}
191
	}
192
192
193
	/**
193
	/**
194
	 * Tests that @noreference should not exclude all overriding methods from
195
	 * API change analysis - See bug 507701
196
	 */
197
	private void xAddInheritedMethod2(boolean incremental) throws Exception {
198
		IPath filePath = WORKSPACE_CLASSES_PACKAGE_A.append("AddInheritedMethod2.java"); //$NON-NLS-1$
199
		// expect a since tag
200
		configureExpectedProblems(IDelta.METHOD_ELEMENT_TYPE, "newMethod()"); //$NON-NLS-1$
201
		performCompatibilityTest(filePath, incremental);
202
	}
203
204
	public void testAddInheritedMethodI2() throws Exception {
205
		xAddInheritedMethod2(true);
206
	}
207
208
	public void testAddInheritedMethodF2() throws Exception {
209
		xAddInheritedMethod2(false);
210
	}
211
212
	/**
194
	 * Tests adding a non-visible method
213
	 * Tests adding a non-visible method
195
	 */
214
	 */
196
	private void xAddNonVisibleMethod(boolean incremental) throws Exception {
215
	private void xAddNonVisibleMethod(boolean incremental) throws Exception {
(-)a/apitools/org.eclipse.pde.api.tools.tests/test-builder/baseline/bundle.a/src/a/since/AddInheritedBase.java (+24 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2016 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.since;
12
13
/**
14
 *
15
 */
16
public class AddInheritedBase {
17
	/**
18
	 *
19
	 * @noreference 
20
	 */
21
	public void newMethod() {
22
	}
23
24
}
(-)a/apitools/org.eclipse.pde.api.tools.tests/test-builder/baseline/bundle.a/src/a/since/AddInheritedMethod2.java (+18 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2016 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.since;
12
13
/**
14
 *
15
 */
16
public class AddInheritedMethod2 extends AddInheritedBase{
17
18
}
(-)a/apitools/org.eclipse.pde.api.tools.tests/test-builder/compat/since/AddInheritedBase.java (+24 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2016 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.since;
12
13
/**
14
 *
15
 */
16
public class AddInheritedBase {
17
	/**
18
	 *
19
	 * @noreference 
20
	 */
21
	public void newMethod() {
22
	}
23
24
}
(-)a/apitools/org.eclipse.pde.api.tools.tests/test-builder/compat/since/AddInheritedMethod2.java (+20 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2016 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.since;
12
13
/**
14
 *
15
 */
16
public class AddInheritedMethod2 extends AddInheritedBase{
17
	public void newMethod() {
18
	}
19
20
}
(-)a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java (+27 lines)
Lines 2104-2109 Link Here
2104
								} else {
2104
								} else {
2105
									int access3 = method3.getModifiers();
2105
									int access3 = method3.getModifiers();
2106
									if (Flags.isPublic(access3) || Flags.isProtected(access3)) {
2106
									if (Flags.isPublic(access3) || Flags.isProtected(access3)) {
2107
										IApiAnnotations apiAnnotations = null;
2108
										if (apiDescription != null) {
2109
											apiAnnotations = apiDescription.resolveAnnotations(method3.getHandle());
2110
										}
2111
										if (apiAnnotations != null) {
2112
											int restrictions = apiAnnotations.getRestrictions();
2113
											// if overriding no reference method, break the loop and report method addition
2114
											if (RestrictionModifiers.isReferenceRestriction(restrictions)) {
2115
												found = false;
2116
												break loop;
2117
											}
2118
										}
2107
										// method has been move up in the
2119
										// method has been move up in the
2108
										// hierarchy - report the delta and
2120
										// hierarchy - report the delta and
2109
										// abort loop
2121
										// abort loop
Lines 2153-2158 Link Here
2153
									} else {
2165
									} else {
2154
										int access3 = method3.getModifiers();
2166
										int access3 = method3.getModifiers();
2155
										if (Flags.isPublic(access3) || Flags.isProtected(access3)) {
2167
										if (Flags.isPublic(access3) || Flags.isProtected(access3)) {
2168
											IApiAnnotations apiAnnotations = null;
2169
											if (apiDescription != null) {
2170
												apiAnnotations = apiDescription.resolveAnnotations(method3.getHandle());
2171
											}
2172
											if (apiAnnotations != null) {
2173
												int restrictions = apiAnnotations.getRestrictions();
2174
												// if overriding no reference
2175
												// method, break the loop and
2176
												// report method addition
2177
												if (RestrictionModifiers.isReferenceRestriction(restrictions)) {
2178
													found = false;
2179
													break loop;
2180
												}
2181
2182
											}
2156
											// method has been pushed down in
2183
											// method has been pushed down in
2157
											// the hierarchy - report the delta
2184
											// the hierarchy - report the delta
2158
											// and abort loop
2185
											// and abort loop

Return to bug 507701