Author: kentam
Date: Mon Apr 25 11:11:19 2005
New Revision: 164613
URL: http://svn.apache.org/viewcvs?rev=164613&view=rev
Log:
BEEHIVE-135: Version checking code-gen cleanup
Directly inject the appropriate base control interface classname into downstream
JCX classes for runtime version checking purposes, and only generate the code
when
the JCX has a VersionRequired annotation.
BEEHIVE-385: Beehive apt tasks warn "no processors registered" for many
annotations
Add a place-holder annotation processor (ControlSecondaryAnnotationProcessor) to
quiet warnings about unhandled annotations. There are still warnings emitted
for
user authored annotations (namely property sets), but there's not much we can do
about that. apt should eventually provide a way to shut this up for good.
Added:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessor.java
(with props)
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessorFactory.java
(with props)
Modified:
incubator/beehive/trunk/controls/src/runtime/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessorFactory.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlMemberTypeAnnotationProcessorFactory.java
Modified:
incubator/beehive/trunk/controls/src/runtime/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory?rev=164613&r1=164612&r2=164613&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
(original)
+++
incubator/beehive/trunk/controls/src/runtime/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
Mon Apr 25 11:11:19 2005
@@ -3,4 +3,5 @@
#
org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessorFactory
org.apache.beehive.controls.runtime.generator.apt.ControlClientAnnotationProcessorFactory
-org.apache.beehive.controls.runtime.generator.apt.ControlMemberTypeAnnotationProcessorFactory
\ No newline at end of file
+org.apache.beehive.controls.runtime.generator.apt.ControlMemberTypeAnnotationProcessorFactory
+org.apache.beehive.controls.runtime.generator.apt.ControlSecondaryAnnotationProcessorFactory
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm?rev=164613&r1=164612&r2=164613&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
Mon Apr 25 11:11:19 2005
@@ -526,7 +526,11 @@
/*
* Enforce VersionRequired
*/
- Class controlIntf =
org.apache.beehive.controls.runtime.bean.ControlBean.getMostDerivedInterface(${intf.className}.class);
+ Class controlIntf = null;
+
+ #if ($intf.getMostDerivedInterface())
+ controlIntf = ${intf.getMostDerivedInterface().className}.class;
+ #end
Version versionPresent = (Version)controlIntf.getAnnotation(Version.class);
VersionRequired versionRequired =
(${bean.shortName}.class).getAnnotation(VersionRequired.class);
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessorFactory.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessorFactory.java?rev=164613&r1=164612&r2=164613&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessorFactory.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessorFactory.java
Mon Apr 25 11:11:19 2005
@@ -34,10 +34,10 @@
private static final Collection<String> _supportedAnnotations =
Collections.unmodifiableCollection(
Arrays.asList(new String[] {
- "org.apache.beehive.controls.api.bean.ControlInterface",
- "org.apache.beehive.controls.api.bean.ControlExtension",
-
"org.apache.beehive.controls.api.bean.ControlImplementation",
- "org.apache.beehive.controls.api.properties.PropertySet"
+
org.apache.beehive.controls.api.bean.ControlInterface.class.getName(),
+
org.apache.beehive.controls.api.bean.ControlExtension.class.getName(),
+
org.apache.beehive.controls.api.bean.ControlImplementation.class.getName(),
+
org.apache.beehive.controls.api.properties.PropertySet.class.getName()
}));
private static final Collection<String> _supportedOptions =
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlMemberTypeAnnotationProcessorFactory.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlMemberTypeAnnotationProcessorFactory.java?rev=164613&r1=164612&r2=164613&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlMemberTypeAnnotationProcessorFactory.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlMemberTypeAnnotationProcessorFactory.java
Mon Apr 25 11:11:19 2005
@@ -36,7 +36,18 @@
private static final Collection<String> _supportedAnnotations =
Collections.unmodifiableCollection(
Arrays.asList(new String[] {
-
"org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Date"
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Date.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Decimal.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.FilePath.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Int.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.JndiName.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Optional.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.QName.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.Text.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.URI.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.URL.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.URN.class.getName(),
+
org.apache.beehive.controls.api.bean.AnnotationMemberTypes.XML.class.getName()
}));
private static final Collection<String> _supportedOptions =
Added:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessor.java?rev=164613&view=auto
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessor.java
(added)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessor.java
Mon Apr 25 11:11:19 2005
@@ -0,0 +1,64 @@
+package org.apache.beehive.controls.runtime.generator.apt;
+
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.Declaration;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+import org.apache.beehive.controls.runtime.generator.*;
+
+/**
+ * Currently, the sole purpose of this annotation processor is to suppress
warning messages from apt regarding
+ * "annotations without processors".
+ */
+public class ControlSecondaryAnnotationProcessor extends
TwoPhaseAnnotationProcessor
+{
+ public ControlSecondaryAnnotationProcessor(Set<AnnotationTypeDeclaration>
atds,
+ AnnotationProcessorEnvironment env)
+ {
+ super(atds, env);
+ }
+
+ @Override
+ public void check(Declaration decl)
+ {
+ }
+
+ @Override
+ public void generate(Declaration decl)
+ {
+ }
+}
Propchange:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessorFactory.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessorFactory.java?rev=164613&view=auto
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessorFactory.java
(added)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessorFactory.java
Mon Apr 25 11:11:19 2005
@@ -0,0 +1,83 @@
+package org.apache.beehive.controls.runtime.generator.apt;
+
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+public class ControlSecondaryAnnotationProcessorFactory implements
AnnotationProcessorFactory
+{
+ private static final Collection<String> _supportedAnnotations =
+ Collections.unmodifiableCollection(
+ Arrays.asList(new String[] {
+ java.lang.annotation.Target.class.getName(),
+ java.lang.annotation.Retention.class.getName(),
+
org.apache.beehive.controls.api.bean.ExternalPropertySets.class.getName(),
+
org.apache.beehive.controls.api.bean.ControlReferences.class.getName(),
+
org.apache.beehive.controls.api.bean.Threading.class.getName(),
+
org.apache.beehive.controls.api.context.Context.class.getName(),
+
org.apache.beehive.controls.api.events.Client.class.getName(),
+
org.apache.beehive.controls.api.events.EventHandler.class.getName(),
+
org.apache.beehive.controls.api.events.EventSet.class.getName(),
+
org.apache.beehive.controls.api.packaging.BeanInfo.class.getName(),
+
org.apache.beehive.controls.api.packaging.EventSetInfo.class.getName(),
+
org.apache.beehive.controls.api.packaging.FeatureAttribute.class.getName(),
+
org.apache.beehive.controls.api.packaging.FeatureInfo.class.getName(),
+
org.apache.beehive.controls.api.packaging.ManifestAttribute.class.getName(),
+
org.apache.beehive.controls.api.packaging.ManifestAttributes.class.getName(),
+
org.apache.beehive.controls.api.packaging.PropertyInfo.class.getName(),
+
org.apache.beehive.controls.api.packaging.PropertyInfo.class.getName(),
+
org.apache.beehive.controls.api.packaging.PropertyInfo.class.getName(),
+
org.apache.beehive.controls.api.packaging.PropertyInfo.class.getName(),
+
org.apache.beehive.controls.api.properties.BaseProperties.class.getName(),
+
org.apache.beehive.controls.api.versioning.Version.class.getName(),
+
org.apache.beehive.controls.api.versioning.VersionRequired.class.getName(),
+
org.apache.beehive.controls.api.versioning.VersionSupported.class.getName()
+ }));
+
+ private static final Collection<String> _supportedOptions =
+ Collections.unmodifiableCollection(
+ Arrays.asList(new String[] {
+ "-AcontrolGenerator", // sets CodeGenerator class
+ }));
+
+ public Collection<String> supportedOptions()
+ {
+ return _supportedOptions;
+ }
+
+ public Collection<String> supportedAnnotationTypes()
+ {
+ return _supportedAnnotations;
+ }
+
+ public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration>
atds,
+ AnnotationProcessorEnvironment
env)
+ {
+ return new ControlSecondaryAnnotationProcessor(atds, env);
+ }
+}
Propchange:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlSecondaryAnnotationProcessorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native