Skip to content

Commit

Permalink
A noextend API class that implements noimplement interface isn't a leak
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Jan 22, 2024
1 parent c4c5104 commit 25a06e7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -340,5 +340,20 @@ private void x12(boolean inc) {
deployLeakTest(typename + ".java", inc); //$NON-NLS-1$
}

/**
* Tests that an noextend API class that implements noimplement interface
* is not a leak
*/
public void testNoExtendClassImplementsNoImplementInterface13F() {
x13(false);
}

public void testNoExtendClassImplementsNoImplementInterface13I() {
x13(true);
}

private void x13(boolean inc) {
String typename = "test37"; //$NON-NLS-1$
deployLeakTest(typename + ".java", inc); //$NON-NLS-1$
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2017 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package x.y.z;

import x.y.z.interfaceNoImplement;

/**
* @noextend
*/
public class test37 implements interfaceNoImplement {
public void exposeMethod() {}
}

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public boolean isProblem(IReference reference, IProgressMonitor monitor) {
if (annotations != null) {
if (RestrictionModifiers.isImplementRestriction(annotations.getRestrictions())) {
IApiAnnotations annotationsSource = member.getApiComponent().getApiDescription().resolveAnnotations(sourceMember.getHandle());
if (annotationsSource != null && !RestrictionModifiers.isImplementRestriction(annotationsSource.getRestrictions())) {
if (annotationsSource != null
&& !RestrictionModifiers.isImplementRestriction(annotationsSource.getRestrictions())
&& !RestrictionModifiers.isExtendRestriction(annotationsSource.getRestrictions())) {
isProb= true;
}
}
Expand Down

0 comments on commit 25a06e7

Please sign in to comment.