Skip to content

Commit

Permalink
Fix the annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Oct 13, 2016
1 parent 9e3e34e commit f909068
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/main/java/jenkins/scm/api/SCMFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
*/
package jenkins.scm.api;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.WebApp;

import javax.annotation.CheckForNull;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jenkins/scm/api/SCMNavigator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

package jenkins.scm.api;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionPoint;
import hudson.model.AbstractDescribableImpl;
import java.io.IOException;
import javax.annotation.Nonnull;

/**
* An API for discovering new and navigating already discovered {@link SCMSource}s within an organization.
Expand All @@ -46,7 +46,7 @@ protected SCMNavigator() {}
* @throws IOException if scanning fails
* @throws InterruptedException if scanning is interrupted
*/
public abstract void visitSources(@Nonnull SCMSourceObserver observer) throws IOException, InterruptedException;
public abstract void visitSources(@NonNull SCMSourceObserver observer) throws IOException, InterruptedException;

@Override
public SCMNavigatorDescriptor getDescriptor() {
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/jenkins/scm/api/SCMNavigatorDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@

package jenkins.scm.api;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.model.Descriptor;
import hudson.model.TopLevelItemDescriptor;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import org.jenkins.ui.icon.IconSpec;

/**
* Definition of a kind of {@link SCMNavigator}.
* @since 0.3-beta-1
*/
public abstract class SCMNavigatorDescriptor extends Descriptor<SCMNavigator> {
public abstract class SCMNavigatorDescriptor extends Descriptor<SCMNavigator> implements IconSpec {

protected SCMNavigatorDescriptor() {}

Expand All @@ -50,7 +50,7 @@ protected SCMNavigatorDescriptor(Class<? extends SCMNavigator> clazz) {
*
* @since 1.2
*/
@Nonnull
@NonNull
public String getDescription() {
return Messages.SCMNavigator_Description();
}
Expand All @@ -63,7 +63,7 @@ public String getDescription() {
*
* @since 1.2
*/
@Nonnull
@NonNull
public String getCategoryId() {
return "nested-projects";
}
Expand All @@ -84,6 +84,11 @@ public String getIconFilePathPattern() {
return null;
}

@CheckForNull
public String getIconClassName() {
return null;
}

/**
* Creates a default navigator, if there should be one displayed.
* May be interpreted by {@code jenkins.branch.CustomOrganizationFolderDescriptor}.
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/jenkins/scm/api/SCMSourceDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionList;
import hudson.model.Descriptor;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

Expand All @@ -39,7 +40,7 @@
*
* @author Stephen Connolly
*/
public abstract class SCMSourceDescriptor extends Descriptor<SCMSource> {
public abstract class SCMSourceDescriptor extends Descriptor<SCMSource> implements IconSpec {

/**
* Return or generate the ID for a source instance.
Expand Down Expand Up @@ -137,4 +138,12 @@ public static List<SCMSourceDescriptor> forOwner(Class<? extends SCMSourceOwner>
return result;
}

/**
* Used to categorize this kind of {@link SCMSource}
* @return The Icon class specification e.g. 'icon-notepad'.
*/
@Override
public String getIconClassName() {
return null;
}
}
18 changes: 9 additions & 9 deletions src/main/java/jenkins/scm/api/SCMSourceObserver.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

package jenkins.scm.api;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import hudson.model.Item;
import hudson.model.TaskListener;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
* Callback used by {@link SCMNavigator}.
Expand All @@ -39,14 +39,14 @@ public abstract class SCMSourceObserver {
* Indicates who is asking for sources.
* @return a contextual item, typically a {@code OrganizationFolder}
*/
@Nonnull
@NonNull
public abstract SCMSourceOwner getContext();

/**
* Provides a way of reporting progress.
* @return a logger
*/
@Nonnull
@NonNull
public abstract TaskListener getListener();

/**
Expand All @@ -55,8 +55,8 @@ public abstract class SCMSourceObserver {
* @return a secondary callback to customize the project, on which you must call {@link ProjectObserver#complete}
* @throws IllegalArgumentException if this {@code projectName} has already been encountered
*/
@Nonnull
public abstract ProjectObserver observe(@Nonnull String projectName) throws IllegalArgumentException;
@NonNull
public abstract ProjectObserver observe(@NonNull String projectName) throws IllegalArgumentException;

/**
* Adds extra metadata about the overall organization.
Expand All @@ -66,7 +66,7 @@ public abstract class SCMSourceObserver {
* @throws IllegalArgumentException if the attribute name is unrecognized, or this attribute was already added
* @throws ClassCastException if the attribute value is inappropriate for its type
*/
public abstract void addAttribute(@Nonnull String key, @Nullable Object value) throws IllegalArgumentException, ClassCastException;
public abstract void addAttribute(@NonNull String key, @Nullable Object value) throws IllegalArgumentException, ClassCastException;

/**
* Nested callback produced by {@link #observe}.
Expand All @@ -77,7 +77,7 @@ public static abstract class ProjectObserver {
* Adds a source repository to be used from a new project.
* @param source a potential SCM source as in {@code MultiBranchProject.getSCMSources}; do not call {@link SCMSource#setOwner} on it
*/
public abstract void addSource(@Nonnull SCMSource source);
public abstract void addSource(@NonNull SCMSource source);

/**
* Adds extra metadata about a specific project.
Expand All @@ -87,7 +87,7 @@ public static abstract class ProjectObserver {
* @throws IllegalArgumentException if the attribute name is unrecognized, or this attribute was already added
* @throws ClassCastException if the attribute value is inappropriate for its type
*/
public abstract void addAttribute(@Nonnull String key, @Nullable Object value) throws IllegalArgumentException, ClassCastException;
public abstract void addAttribute(@NonNull String key, @Nullable Object value) throws IllegalArgumentException, ClassCastException;

/**
* To be called when finished defining one project.
Expand Down

0 comments on commit f909068

Please sign in to comment.