Skip to content

Commit

Permalink
IApiAnnotations.isExact for CompositeApiDescription.resolveAnnotations
Browse files Browse the repository at this point in the history
- CompositeApiDescription.resolveAnnotations should be able to properly
find the best match annotation using IApiAnnotations.isExact which is
now also implemented by TypeAnnotations.isExact.

eclipse-pde#1386
  • Loading branch information
merks authored and iloveeclipse committed Sep 5, 2024
1 parent 7c21dfb commit 15bf1d1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.api.tools;singleton:=true
Bundle-Version: 1.3.500.qualifier
Bundle-Version: 1.3.600.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void setExact(boolean equals) {
isExact = equals;
}

@Override
public boolean isExact() {
return isExact;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,12 @@ public IApiAnnotations resolveAnnotations(IElementDescriptor element) {
IApiAnnotations bestMatchAnnotation = null;
for (IApiDescription fDescription : fDescriptions) {
IApiAnnotations ann = fDescription.resolveAnnotations(element);
boolean isExact = false;
if (ann != null) {
bestMatchAnnotation = ann;
if (ann.isExact()) {
return ann; // if exact, return else keep looking for best match
}
}
if (ann instanceof ApiAnnotations) {
isExact = ((ApiAnnotations) ann).isExact();
}
if (isExact) {
return ann; // if exact, return else keep looking for best match
}

}
return bestMatchAnnotation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ public int getRestrictions() {
return fAnnotations.getRestrictions();
}

@Override
public boolean isExact() {
return fAnnotations != null && fAnnotations.isExact();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,17 @@ public interface IApiAnnotations {
*/
public int getRestrictions();

/**
* Returns whether these API annotations are based on an exact match of the
* originating element.
*
* @return whether these API annotations are based on an exact match of the
* originating element.
*
* @since 1.3.600
*/
default boolean isExact() {
return false;
}

}

0 comments on commit 15bf1d1

Please sign in to comment.