You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/08/15 02:23:43 UTC
svn commit: r686096 - in /tapestry/tapestry5/trunk: src/site/apt/
tapestry-core/src/main/java/org/apache/tapestry5/internal/services/
tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/
tapestry-core/src/main/java/org/apache/tapestry5/...
Author: hlship
Date: Thu Aug 14 17:23:42 2008
New Revision: 686096
URL: http://svn.apache.org/viewvc?rev=686096&view=rev
Log:
TAPESTRY-2567: Tapestry doesn't identify conflicting annotations on component fields
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FieldAnnotationConflict.java
Modified:
tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalClassTransformationImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ComponentWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EnvironmentalWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectContainerWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectPageWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/MixinWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PersistWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PropertyWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InternalClassTransformationImplTest.java
Modified: tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/upgrade.apt?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/upgrade.apt Thu Aug 14 17:23:42 2008
@@ -12,6 +12,15 @@
You should also check the {{{release-notes.html}project-wide release notes}} for information
about bugs fixes and other improvements.
+Release 5.0.15
+
+* {{{https://issues.apache.org/jira/browse/TAPESTRY-2567}TAPESTRY-2567}}
+
+ The methods findFields() and findFieldsWithAnnotation() of
+ {{{apidocs/org/apache/tapestry5/services/ClassTransformation.html}ClassTransformation}}
+ have been changed to return all fields (regardless of whether they have been claimed). The
+ method findAllFieldsWithAnnotation() has been removed.
+
Release 5.0.14
The signature of the
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalClassTransformationImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalClassTransformationImpl.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalClassTransformationImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalClassTransformationImpl.java Thu Aug 14 17:23:42 2008
@@ -125,7 +125,7 @@
* Signature for newInstance() method of Instantiator.
*/
private static final MethodSignature NEW_INSTANCE_SIGNATURE = new MethodSignature(Component.class, "newInstance",
- new Class[]{
+ new Class[] {
InternalComponentResources.class},
null);
@@ -906,18 +906,6 @@
public List<String> findFieldsWithAnnotation(final Class<? extends Annotation> annotationClass)
{
- return searchFieldsWithAnnotation(annotationClass, true);
- }
-
-
- public List<String> findAllFieldsWithAnnotation(Class<? extends Annotation> annotationClass)
- {
- return searchFieldsWithAnnotation(annotationClass, false);
- }
-
- private List<String> searchFieldsWithAnnotation(final Class<? extends Annotation> annotationClass,
- boolean skipClaimedFields)
- {
FieldFilter filter = new FieldFilter()
{
public boolean accept(String fieldName, String fieldType)
@@ -926,15 +914,11 @@
}
};
- return searchFieldsAndFilter(filter, skipClaimedFields);
+ return findFields(filter);
}
- public List<String> findFields(FieldFilter filter)
- {
- return searchFieldsAndFilter(filter, true);
- }
- private List<String> searchFieldsAndFilter(FieldFilter filter, boolean skipClaimedFields)
+ public List<String> findFields(FieldFilter filter)
{
failIfFrozen();
@@ -948,8 +932,6 @@
String fieldName = field.getName();
- if (skipClaimedFields && claimedFields.containsKey(fieldName)) continue;
-
if (filter.accept(fieldName, field.getType().getName())) result.add(fieldName);
}
@@ -964,7 +946,7 @@
return result;
}
- public List<TransformMethodSignature> findMethodsWithAnnotation(Class<? extends Annotation> annotationClass)
+ public List<TransformMethodSignature> findMethodsWithAnnotation(final Class<? extends Annotation> annotationClass)
{
failIfFrozen();
@@ -1584,7 +1566,7 @@
String fieldType = getFieldType(fieldName);
TransformMethodSignature sig = new TransformMethodSignature(Modifier.PRIVATE, "void", methodName,
- new String[]{fieldType}, null);
+ new String[] {fieldType}, null);
String message = ServicesMessages.readOnlyField(ctClass.getName(), fieldName);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ComponentWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ComponentWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ComponentWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ComponentWorker.java Thu Aug 14 17:23:42 2008
@@ -50,6 +50,8 @@
{
Component annotation = transformation.getFieldAnnotation(fieldName, Component.class);
+ transformation.claimField(fieldName, annotation);
+
String id = annotation.id();
if (InternalUtils.isBlank(id)) id = InternalUtils.stripMemberPrefix(fieldName);
@@ -74,8 +76,6 @@
addMixinClasses(fieldName, transformation, embedded);
addMixinTypes(fieldName, transformation, embedded);
-
- transformation.claimField(fieldName, annotation);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EnvironmentalWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EnvironmentalWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EnvironmentalWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/EnvironmentalWorker.java Thu Aug 14 17:23:42 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -56,6 +56,8 @@
for (String name : names)
{
Environmental annotation = transformation.getFieldAnnotation(name, Environmental.class);
+
+ transformation.claimField(name, annotation);
String type = transformation.getFieldType(name);
@@ -78,8 +80,6 @@
transformation.replaceReadAccess(name, methodName);
transformation.makeReadOnly(name);
transformation.removeField(name);
-
- transformation.claimField(name, annotation);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectContainerWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectContainerWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectContainerWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectContainerWorker.java Thu Aug 14 17:23:42 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -53,6 +53,8 @@
fieldName,
InjectContainer.class);
+ transformation.claimField(fieldName, annotation);
+
String fieldType = transformation.getFieldType(fieldName);
builder.addln("try");
@@ -71,7 +73,6 @@
builder.end();
transformation.makeReadOnly(fieldName);
- transformation.claimField(fieldName, annotation);
}
builder.end();
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectPageWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectPageWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectPageWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/InjectPageWorker.java Thu Aug 14 17:23:42 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -58,6 +58,8 @@
private void addInjectedPage(ClassTransformation transformation, String fieldName, String componentSource)
{
InjectPage annotation = transformation.getFieldAnnotation(fieldName, InjectPage.class);
+
+ transformation.claimField(fieldName, annotation);
String pageName = annotation.value();
@@ -81,7 +83,5 @@
transformation.replaceReadAccess(fieldName, methodName);
transformation.makeReadOnly(fieldName);
transformation.removeField(fieldName);
-
- transformation.claimField(fieldName, annotation);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/MixinWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/MixinWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/MixinWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/MixinWorker.java Thu Aug 14 17:23:42 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2008 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.
@@ -46,6 +46,8 @@
{
Mixin annotation = transformation.getFieldAnnotation(fieldName, Mixin.class);
+ transformation.claimField(fieldName, annotation);
+
String mixinType = annotation.value();
String fieldType = transformation.getFieldType(fieldName);
@@ -62,8 +64,6 @@
transformation
.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, body);
-
- transformation.claimField(fieldName, annotation);
}
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ParameterWorker.java Thu Aug 14 17:23:42 2008
@@ -24,6 +24,7 @@
import org.apache.tapestry5.services.*;
import java.lang.reflect.Modifier;
+import java.util.Iterator;
import java.util.List;
/**
@@ -35,7 +36,7 @@
private static final String BIND_METHOD_NAME = ParameterWorker.class.getName() + ".bind";
private final BindingSource bindingSource;
-
+
private ComponentDefaultProvider defaultProvider;
public ParameterWorker(BindingSource bindingSource, ComponentDefaultProvider defaultProvider)
@@ -46,38 +47,39 @@
public void transform(final ClassTransformation transformation, MutableComponentModel model)
{
- FieldFilter filter = new FieldFilter()
- {
- public boolean accept(String fieldName, String fieldType)
- {
- Parameter annotation = transformation
- .getFieldAnnotation(fieldName, Parameter.class);
+ List<String> fieldNames = transformation.findFieldsWithAnnotation(Parameter.class);
- return annotation != null && annotation.principal();
- }
- };
+ for (int pass = 0; pass < 2; pass++)
+ {
+ Iterator<String> i = fieldNames.iterator();
- List<String> principleFieldNames = transformation.findFields(filter);
+ while (i.hasNext())
+ {
+ String fieldName = i.next();
- convertFieldsIntoParameters(transformation, model, principleFieldNames);
+ Parameter annotation = transformation.getFieldAnnotation(fieldName, Parameter.class);
- // Now convert the rest.
+ // Process the principal annotations on the first pass, handle the others
+ // on the second pass.
- List<String> fieldNames = transformation.findFieldsWithAnnotation(Parameter.class);
+ boolean process = pass == 0
+ ? annotation.principal()
+ : true;
- convertFieldsIntoParameters(transformation, model, fieldNames);
- }
+ if (process)
+ {
+ convertFieldIntoParameter(fieldName, annotation, transformation, model);
- private void convertFieldsIntoParameters(ClassTransformation transformation, MutableComponentModel model,
- List<String> fieldNames)
- {
- for (String name : fieldNames)
- convertFieldIntoParameter(name, transformation, model);
+ i.remove();
+ }
+ }
+ }
}
- private void convertFieldIntoParameter(String name, ClassTransformation transformation, MutableComponentModel model)
+ private void convertFieldIntoParameter(String name, Parameter annotation, ClassTransformation transformation,
+ MutableComponentModel model)
{
- Parameter annotation = transformation.getFieldAnnotation(name, Parameter.class);
+ transformation.claimField(name, annotation);
String parameterName = getParameterName(name, annotation.name());
@@ -99,8 +101,6 @@
transformation);
addWriterMethod(name, cachedFieldName, cache, parameterName, type, resourcesFieldName, transformation);
-
- transformation.claimField(name, annotation);
}
/**
@@ -177,16 +177,16 @@
return;
}
-
- if(autoconnect)
+
+ if (autoconnect)
{
String defaultProviderFieldName = transformation.addInjectedField(ComponentDefaultProvider.class,
- "defaultProvider", defaultProvider);
-
+ "defaultProvider", defaultProvider);
+
builder.addln("if (! %s.isBound(\"%s\"))", resourcesFieldName, parameterName);
-
+
builder.addln(" %s.bindParameter(\"%s\", %s.defaultBinding(\"%s\", %s));", resourcesFieldName,
- parameterName, defaultProviderFieldName, parameterName, resourcesFieldName);
+ parameterName, defaultProviderFieldName, parameterName, resourcesFieldName);
return;
}
@@ -246,7 +246,7 @@
String methodName = transformation.newMemberName("update_parameter", parameterName);
TransformMethodSignature signature = new TransformMethodSignature(Modifier.PRIVATE, "void", methodName,
- new String[] { fieldType }, null);
+ new String[] {fieldType}, null);
transformation.addMethod(signature, builder.toString());
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PersistWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PersistWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PersistWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PersistWorker.java Thu Aug 14 17:23:42 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -49,6 +49,8 @@
String fieldType = transformation.getFieldType(fieldName);
Persist annotation = transformation.getFieldAnnotation(fieldName, Persist.class);
+ transformation.claimField(fieldName, annotation);
+
// Record the type of persistence, until needed later.
String logicalFieldName = model.setFieldPersistenceStrategy(fieldName, annotation.value());
@@ -117,6 +119,5 @@
TransformConstants.CONTAINING_PAGE_DID_ATTACH_SIGNATURE,
builder.toString());
- transformation.claimField(fieldName, annotation);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PropertyWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PropertyWorker.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PropertyWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/PropertyWorker.java Thu Aug 14 17:23:42 2008
@@ -34,7 +34,7 @@
{
public void transform(ClassTransformation transformation, MutableComponentModel model)
{
- for (String fieldName : transformation.findAllFieldsWithAnnotation(Property.class))
+ for (String fieldName : transformation.findFieldsWithAnnotation(Property.class))
{
Property annotation = transformation.getFieldAnnotation(fieldName, Property.class);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java Thu Aug 14 17:23:42 2008
@@ -75,17 +75,11 @@
/**
* Generates a list of the names of declared instance fields that have the indicated annotation. Non-private and
- * static fields are ignored. Only the names of private instance fields are returned. Any {@link #claimField(String,
- * Object) claimed} fields are excluded.
+ * static fields are ignored. Only the names of private instance fields are returned.
*/
List<String> findFieldsWithAnnotation(Class<? extends Annotation> annotationClass);
/**
- * As with {@link #findFieldsWithAnnotation(Class)}, but finds fields even if they are claimed.
- */
- List<String> findAllFieldsWithAnnotation(Class<? extends Annotation> annotationClass);
-
- /**
* Finds all methods defined in the class that are marked with the provided annotation.
*
* @param annotationClass
@@ -104,7 +98,7 @@
List<TransformMethodSignature> findMethods(MethodFilter filter);
/**
- * Finds all unclaimed fields matched by the provided filter. Only considers unclaimed, private, instance fields.
+ * Finds all unclaimed fields matched by the provided filter. Only considers private instance fields.
*
* @param filter passed each field name and field type
* @return the names of all matched fields, in ascending order
@@ -135,8 +129,9 @@
/**
* Claims a field so as to ensure that only a single annotation is applied to any single field. When a
- * transformation occurs (driven by a field annotation), the first thing that occurs is to claim the field, on
- * behalf of the annotation.
+ * transformation occurs (driven by a field annotation), the field is claimed (using the annotation object
+ * as the tag). If a field has multiple conflicting annotations, this will be discovered
+ * when the code attempts to claim the field a second time.
*
* @param fieldName the name of the field that is being claimed
* @param tag a non-null object that represents why the field is being tagged (this is typically a specific
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml Thu Aug 14 17:23:42 2008
@@ -67,6 +67,10 @@
--
attempt to instantiate (and return) a page instance
</li>
+ <li>
+ <a href="fieldannotationconflict">Field Annotation Conflict</a>
+ -- demo failure behavior when a field contains conflicting annotations
+ </li>
</ul>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java Thu Aug 14 17:23:42 2008
@@ -2149,4 +2149,15 @@
assertTextPresent(
"Forms require that the request method be POST and that the t:formdata query parameter have values.");
}
+
+ /**
+ * TAPESTRY-2567
+ */
+ public void field_annotation_conflict()
+ {
+ start("Field Annotation Conflict");
+
+ assertTextPresent(
+ "Field flashDemo of class org.apache.tapestry5.integration.app1.pages.FieldAnnotationConflict is already claimed by @org.apache.tapestry5.annotations.InjectPage and can not be claimed by @org.apache.tapestry5.annotations.Parameter.");
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FieldAnnotationConflict.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FieldAnnotationConflict.java?rev=686096&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FieldAnnotationConflict.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FieldAnnotationConflict.java Thu Aug 14 17:23:42 2008
@@ -0,0 +1,25 @@
+// Copyright 2008 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.
+
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.InjectPage;
+import org.apache.tapestry5.annotations.Parameter;
+
+public class FieldAnnotationConflict
+{
+ @InjectPage
+ @Parameter
+ private FlashDemo flashDemo;
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InternalClassTransformationImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InternalClassTransformationImplTest.java?rev=686096&r1=686095&r2=686096&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InternalClassTransformationImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InternalClassTransformationImplTest.java Thu Aug 14 17:23:42 2008
@@ -284,24 +284,6 @@
}
@Test
- public void find_fields_with_annotation_excludes_claimed_files() throws Exception
- {
- Logger logger = mockLogger();
-
- replay();
-
- ClassTransformation ct = createClassTransformation(ParentClass.class, logger);
-
- ct.claimField("_annotatedField", this);
-
- List<String> fields = ct.findFieldsWithAnnotation(Retain.class);
-
- assertTrue(fields.isEmpty());
-
- verify();
- }
-
- @Test
public void no_fields_contain_requested_annotation() throws Exception
{
Logger logger = mockLogger();