diff -r c9107ffe9d57 api.annotations.common/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/build.xml Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,80 @@
+
+
+ Builds, tests, and runs the project org.netbeans.annotations.common
+
+
+
+
+ Building common annotations for usage with FindBugs...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r c9107ffe9d57 api.annotations.common/manifest.mf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/manifest.mf Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.api.annotations.common/1
+OpenIDE-Module-Localizing-Bundle: org/netbeans/annotations/common/resources/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff -r c9107ffe9d57 api.annotations.common/nbproject/project.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/nbproject/project.properties Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,41 @@
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+#
+# The contents of this file are subject to the terms of either the GNU
+# General Public License Version 2 only ("GPL") or the Common
+# Development and Distribution License("CDDL") (collectively, the
+# "License"). You may not use this file except in compliance with the
+# License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html
+# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+# specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header
+# Notice in each file and include the License file at
+# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the GPL Version 2 section of the License file that
+# accompanied this code. If applicable, add the following below the
+# License Header, with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original
+# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+# Microsystems, Inc. All Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL
+# or only the GPL Version 2, indicate your decision by adding
+# "[Contributor] elects to include this software in this distribution
+# under the [CDDL or GPL Version 2] license." If you do not indicate a
+# single choice of license, a recipient has the option to distribute
+# your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above.
+# However, if you add GPL Version 2 code and therefore, elected the GPL
+# Version 2 license, then the option applies only if the new code is
+# made subject to such option by the copyright holder.
+
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial
diff -r c9107ffe9d57 api.annotations.common/nbproject/project.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/nbproject/project.xml Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,13 @@
+
+
+ org.netbeans.modules.apisupport.project
+
+
+ org.netbeans.api.annotations.common
+
+
+ org.netbeans.api.annotations.common
+
+
+
+
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/annotations/common/resources/Bundle.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/annotations/common/resources/Bundle.properties Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,1 @@
+OpenIDE-Module-Name=Common Annotations
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/api/annotations/common/CheckForNull.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/api/annotations/common/CheckForNull.java Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,59 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.api.annotations.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated method might return null
, thus code using it
+ * should check for nullity.
+ *
+ * @author Petr Hejl
+ */
+@Documented
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.SOURCE)
+public @interface CheckForNull {
+
+}
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/api/annotations/common/CheckReturnValue.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/api/annotations/common/CheckReturnValue.java Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,59 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.api.annotations.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The return value of annotated element (method) should be checked. Consider
+ * {@link java.io.File#delete()} as an example of such a method.
+ *
+ * @author Petr Hejl
+ */
+@Documented
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface CheckReturnValue {
+
+}
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/api/annotations/common/ConditionalNull.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/api/annotations/common/ConditionalNull.java Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,63 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ */
+
+package org.netbeans.api.annotations.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated element might be null under certain circumstances.
+ * The necessity of the non-null check depends on situations described
+ * in the javadoc (so the non-null check is not required by default).
+ *
+ * @author Andrei Badea
+ */
+@Documented
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
+ ElementType.LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface ConditionalNull {
+
+}
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/api/annotations/common/NonNull.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/api/annotations/common/NonNull.java Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,59 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.api.annotations.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated element must not be null
.
+ *
+ * @author Petr Hejl
+ */
+@Documented
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
+ ElementType.LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface NonNull {
+
+}
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/api/annotations/common/NullAllowed.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/api/annotations/common/NullAllowed.java Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,59 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.api.annotations.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated element might be null
, thus code using it
+ * should check for nullity.
+ *
+ * @author Petr Hejl
+ */
+@Documented
+@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface NullAllowed {
+
+}
diff -r c9107ffe9d57 api.annotations.common/src/org/netbeans/api/annotations/common/SupressWarnings.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.annotations.common/src/org/netbeans/api/annotations/common/SupressWarnings.java Fri Jul 18 16:12:38 2008 +0200
@@ -0,0 +1,62 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.api.annotations.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Supress the warning reported by the code analyzing tool.
+ *
+ * @author Petr Hejl
+ */
+@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface SupressWarnings {
+
+ /**
+ * The names of the warnings to supress.
+ */
+ String[] value() default {};
+
+}
diff -r c9107ffe9d57 apisupport.harness/release/build.xml
--- a/apisupport.harness/release/build.xml Thu Jul 17 10:49:30 2008 +0200
+++ b/apisupport.harness/release/build.xml Fri Jul 18 16:12:38 2008 +0200
@@ -136,6 +136,7 @@
+
diff -r c9107ffe9d57 apisupport.project/src/org/netbeans/modules/apisupport/project/Evaluator.java
--- a/apisupport.project/src/org/netbeans/modules/apisupport/project/Evaluator.java Thu Jul 17 10:49:30 2008 +0200
+++ b/apisupport.project/src/org/netbeans/modules/apisupport/project/Evaluator.java Fri Jul 18 16:12:39 2008 +0200
@@ -388,7 +388,13 @@
providers.add(PropertyUtils.fixedPropertyProvider(Collections.singletonMap("module.classpath", computeModuleClasspath(ml)))); // NOI18N
Map buildDefaults = new HashMap();
buildDefaults.put("cp.extra", ""); // NOI18N
- buildDefaults.put("cp", "${module.classpath}:${cp.extra}"); // NOI18N
+ ModuleEntry annotations = ml.getEntry("org.netbeans.api.annotations.common"); // NOI18N
+ if (annotations != null) {
+ providers.add(PropertyUtils.fixedPropertyProvider(Collections.singletonMap("annotations.common.cp", annotations.getJarLocation().getAbsolutePath()))); // NOI18N
+ buildDefaults.put("cp", "${module.classpath}:${annotations.common.cp}:${cp.extra}"); // NOI18N
+ } else {
+ buildDefaults.put("cp", "${module.classpath}:${cp.extra}"); // NOI18N
+ }
buildDefaults.put("run.cp", computeRuntimeModuleClasspath(ml) + ":${cp.extra}:${build.classes.dir}"); // NOI18N
baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
diff -r c9107ffe9d57 nbbuild/cluster.properties
--- a/nbbuild/cluster.properties Thu Jul 17 10:49:30 2008 +0200
+++ b/nbbuild/cluster.properties Fri Jul 18 16:12:39 2008 +0200
@@ -182,6 +182,7 @@
nb.cluster.platform.dir=platform8
nb.cluster.platform.depends=
nb.cluster.platform=\
+ api.annotations.common,\
api.progress,\
api.visual,\
applemenu,\
diff -r c9107ffe9d57 nbbuild/templates/common.xml
--- a/nbbuild/templates/common.xml Thu Jul 17 10:49:30 2008 +0200
+++ b/nbbuild/templates/common.xml Fri Jul 18 16:12:39 2008 +0200
@@ -72,6 +72,7 @@
+
diff -r c9107ffe9d57 nbbuild/templates/projectized.xml
--- a/nbbuild/templates/projectized.xml Thu Jul 17 10:49:30 2008 +0200
+++ b/nbbuild/templates/projectized.xml Fri Jul 18 16:12:39 2008 +0200
@@ -141,7 +141,9 @@
+
+
@@ -650,6 +652,7 @@
+
diff -r c9107ffe9d57 openide.util/src/org/openide/util/Lookup.java
--- a/openide.util/src/org/openide/util/Lookup.java Thu Jul 17 10:49:30 2008 +0200
+++ b/openide.util/src/org/openide/util/Lookup.java Fri Jul 18 16:12:39 2008 +0200
@@ -45,6 +45,9 @@
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NullAllowed;
+import org.netbeans.api.annotations.common.NonNull;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;
@@ -98,6 +101,7 @@
*
* @return the global lookup in the system
*/
+ @NonNull
public static synchronized Lookup getDefault() {
if (defaultLookup != null) {
return defaultLookup;
@@ -185,7 +189,8 @@
* @return an object implementing the given class or null
if no such
* implementation is found
*/
- public abstract T lookup(Class clazz);
+ @CheckForNull
+ public abstract T lookup(@NonNull Class clazz);
/** The general lookup method. Callers can get list of all instances and classes
* that match the given template
, request more info about
@@ -198,7 +203,8 @@
* @param template a template describing the services to look for
* @return an object containing the results
*/
- public abstract Result lookup(Template template);
+ @NonNull
+ public abstract Result lookup(@NonNull Template template);
/** Look up the first item matching a given template.
* Includes not only the instance but other associated information.
@@ -207,7 +213,8 @@
*
* @since 1.8
*/
- public Item lookupItem(Template template) {
+ @CheckForNull
+ public Item lookupItem(@NonNull Template template) {
Result res = lookup(template);
Iterator extends Item> it = res.allItems().iterator();
return it.hasNext() ? it.next() : null;
@@ -221,7 +228,8 @@
* @return a live object representing instances of that type
* @since org.openide.util 6.10
*/
- public Lookup.Result lookupResult(Class clazz) {
+ @NonNull
+ public Lookup.Result lookupResult(@NonNull Class clazz) {
return lookup(new Lookup.Template(clazz));
}
@@ -241,7 +249,8 @@
* @return all currently available instances of that type
* @since org.openide.util 6.10
*/
- public Collection extends T> lookupAll(Class clazz) {
+ @NonNull
+ public Collection extends T> lookupAll(@NonNull Class clazz) {
return lookupResult(clazz).allInstances();
}
@@ -291,7 +300,7 @@
/** Create a simple template matching by class.
* @param type the class of service we are looking for (subclasses will match)
*/
- public Template(Class type) {
+ public Template(@NullAllowed Class type) {
this(type, null, null);
}
@@ -300,7 +309,7 @@
* @param id the ID of the item/service we are looking for or null
to leave unspecified
* @param instance a specific known instance to look for or null
to leave unspecified
*/
- public Template(Class type, String id, T instance) {
+ public Template(@NullAllowed Class type, @NullAllowed String id, @NullAllowed T instance) {
this.type = extractType(type);
this.id = id;
this.instance = instance;
@@ -316,6 +325,7 @@
* this will match any instance.
* @return the class to search for
*/
+ @NonNull
public Class getType() {
return type;
}
@@ -326,6 +336,7 @@
*
* @since 1.8
*/
+ @CheckForNull
public String getId() {
return id;
}
@@ -338,6 +349,7 @@
*
* @since 1.8
*/
+ @CheckForNull
public T getInstance() {
return instance;
}
@@ -345,6 +357,7 @@
/* Computes hashcode for this template. The hashcode is cached.
* @return hashcode
*/
+ @Override
public int hashCode() {
if (hashCode != 0) {
return hashCode;
@@ -360,7 +373,8 @@
* @param obj another template to check
* @return true if so, false otherwise
*/
- public boolean equals(Object obj) {
+ @Override
+ public boolean equals(@NullAllowed Object obj) {
if (!(obj instanceof Template)) {
return false;
}
@@ -395,6 +409,7 @@
}
/* for debugging */
+ @NonNull
public String toString() {
return "Lookup.Template[type=" + type + ",id=" + id + ",instance=" + instance + "]"; // NOI18N
}
@@ -411,17 +426,18 @@
*
* @param l the listener to add
*/
- public abstract void addLookupListener(LookupListener l);
+ public abstract void addLookupListener(@NonNull LookupListener l);
/** Unregisters a listener previously added.
* @param l the listener to remove
*/
- public abstract void removeLookupListener(LookupListener l);
+ public abstract void removeLookupListener(@NonNull LookupListener l);
/** Get all instances in the result. The return value type
* should be List instead of Collection, but it is too late to change it.
* @return unmodifiable collection of all instances that will never change its content
*/
+ @NonNull
public abstract Collection extends T> allInstances();
/** Get all classes represented in the result.
@@ -432,6 +448,7 @@
*
* @since 1.8
*/
+ @NonNull
public Set> allClasses() {
return Collections.emptySet();
}
@@ -444,6 +461,7 @@
*
* @since 1.8
*/
+ @NonNull
public Collection extends Item> allItems() {
return Collections.emptyList();
}
@@ -459,11 +477,13 @@
/** Get the instance itself.
* @return the instance or null if the instance cannot be created
*/
+ @CheckForNull
public abstract T getInstance();
/** Get the implementing class of the instance.
* @return the class of the item
*/
+ @NonNull
public abstract Class extends T> getType();
// XXX can it be null??
@@ -479,6 +499,7 @@
*
* @return a string ID of the item
*/
+ @NonNull
public abstract String getId();
/** Get a human presentable name for the item.
@@ -486,9 +507,11 @@
* lookup result in some part of a GUI.
* @return the string suitable for presenting the object to a user
*/
+ @NonNull
public abstract String getDisplayName();
/* show ID for debugging */
+ @NonNull
public String toString() {
return getId();
}