You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2009/01/02 20:50:46 UTC

svn commit: r730832 - in /tapestry/tapestry5/trunk: src/site/apt/ src/site/apt/guide/ tapestry-core/src/main/java/org/apache/tapestry5/internal/ tapestry-core/src/main/java/org/apache/tapestry5/test/ tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/...

Author: hlship
Date: Fri Jan  2 11:50:44 2009
New Revision: 730832

URL: http://svn.apache.org/viewvc?rev=730832&view=rev
Log:
TAP5-436: Tapestry should verify that all public methods of a module class are meaningful to Tapestry (build, decorate, contribute or bind), other methods should cause an exception to be thrown as a likely typo in the name

Added:
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ExtraMethodsModule.java
Modified:
    tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt
    tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractContributionDef.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/SyntheticSymbolSourceContributionDef.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ModuleBuilderSource.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/DecoratorDef.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ModuleDef.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/IOCMessages.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ObjectLocatorImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvoker.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/IOCStrings.properties
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/autoload.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/index.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/shadow.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/StaticModule.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SimpleModule.java
    tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java

Modified: tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/guide/conf.apt Fri Jan  2 11:50:44 2009
@@ -62,11 +62,11 @@
   
 * Tapestry IoC Configuration
 
-  Most other configuration occurs inside your application's module builder class.  The application module builder
+  Most other configuration occurs inside your application's module class.  The application module class
   will often define new services, provide overrides of services, or make contributions to service configurations.
   
-  Tapestry looks for a module builder class in the services package (under the root package). It capitalizes
-  the \<filter-name\> and appends "Module".  In the previous example, the module builder class
+  Tapestry looks for a module class in the services package (under the root package). It capitalizes
+  the \<filter-name\> and appends "Module".  In the previous example, the module class
   would be org.example.myapp.services.AppModule.
   
   If such a class exists, it is added to the IoC Registry. It is not an error for your application to not have a module, though

Modified: tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/upgrade.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/upgrade.apt Fri Jan  2 11:50:44 2009
@@ -28,4 +28,9 @@
 
   Tapestry is now more aggressive about automatically re-storing any session persisted object
   back into the session at the end of the request (this used to only apply to application state objects).  See the 
-  {{{guide/persist.html}persistent page data}} notes for more details.
\ No newline at end of file
+  {{{guide/persist.html}persistent page data}} notes for more details.
+
+  Many questionable practices in Tapestry module classes that used to produce warnings (which were
+  ignored, leading to more difficult questions) have been changed to fail early with exceptions. This includes
+  extra public methods on a module class that are not used by Tapestry IoC, and several other similar
+  scenarios.
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractContributionDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractContributionDef.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractContributionDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractContributionDef.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2009 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.
@@ -23,17 +23,17 @@
  */
 public abstract class AbstractContributionDef implements ContributionDef
 {
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            Configuration configuration)
     {
     }
 
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            OrderedConfiguration configuration)
     {
     }
 
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            MappedConfiguration configuration)
     {
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/SyntheticSymbolSourceContributionDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/SyntheticSymbolSourceContributionDef.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/SyntheticSymbolSourceContributionDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/SyntheticSymbolSourceContributionDef.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2009 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.
@@ -40,7 +40,7 @@
 
 
     @SuppressWarnings("unchecked")
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            OrderedConfiguration configuration)
     {
         configuration.add(contributionName, provider, constraints);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -113,9 +113,9 @@
             builder.add(def);
     }
 
-    public void addModules(Class... moduleBuilderClasses)
+    public void addModules(Class... moduleClasses)
     {
-        builder.add(moduleBuilderClasses);
+        builder.add(moduleClasses);
     }
 
     private void addSyntheticSymbolSourceModule()

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -77,7 +77,7 @@
      * @param appPackage    The same value you would specify using the tapestry.app-package context parameter. As this
      *                      testing environment is not run in a servlet container, you need to specify it.
      * @param appName       The same value you would specify as the filter name. It is used to form the name of the
-     *                      module builder for your app. If you don't have one, pass an empty string.
+     *                      module class for your app. If you don't have one, pass an empty string.
      * @param contextPath   The path to the context root so that Tapestry can find the templates (if they're put
      *                      there).
      * @param moduleClasses Classes of additional modules to load

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ModuleBuilderSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ModuleBuilderSource.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ModuleBuilderSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ModuleBuilderSource.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2008 The Apache Software Foundation
+// Copyright 2006, 2008, 2009 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.
@@ -15,12 +15,16 @@
 package org.apache.tapestry5.ioc;
 
 /**
- * The source for the module builder instance needed by most (but not all) service builders, service contributors and
- * service decorators. Allows the creation of the moduleBuilder instance to be deferred until actually needed; in
- * practical terms, when the builder/decorator/contributor is a <em>static</em> method on the module builder class, then
- * a module builder instance is not needed. This allows Tapestry IOC to work around a tricky chicken-and-the-egg
- * problem, whereby the constructor of a module builder instance requires contributions that originate in the same
- * module.
+ * The source for the module instance needed by any service builders, service contributors and service decorators that
+ * are mapped to instance methods.
+ * <p/>
+ * Allows the creation of the module instance to be deferred until actually needed; in practical terms, when the
+ * builder/decorator/contributor is a <em>static</em> method on the module builder class, then a module instance is not
+ * needed. This allows Tapestry IOC to work around a tricky chicken-and-the-egg problem, whereby the constructor of a
+ * module instance requires contributions that originate in the same module.
+ * <p/>
+ * The term "module builder" has been deprecated; the current term is "module class", but this interface is left as-is
+ * for backwards compatibility.
  */
 public interface ModuleBuilderSource
 {

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -103,11 +103,11 @@
      *
      * @see org.apache.tapestry5.ioc.annotations.SubModule
      */
-    public RegistryBuilder add(Class... moduleBuilderClasses)
+    public RegistryBuilder add(Class... moduleClasses)
     {
         lock.check();
 
-        List<Class> queue = CollectionFactory.newList(Arrays.asList(moduleBuilderClasses));
+        List<Class> queue = CollectionFactory.newList(Arrays.asList(moduleClasses));
 
         while (!queue.isEmpty())
         {

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -33,39 +33,34 @@
     /**
      * Performs the work needed to contribute into the standard, unordered configuration.
      *
-     * @param moduleBuilderSource the source, if needed, of the module builder instance associated with the
-     *                            contribution
-     * @param resources           allows access to services visible to the module builder instance
-     * @param configuration       the unordered configuration into which values should be loaded. This instance will
-     *                            encapsulate all related error checks (such as passing of nulls or inappropriate
-     *                            classes).
+     * @param moduleSource  the source, if needed, of the module  instance associated with the contribution
+     * @param resources     allows access to services visible to the module
+     * @param configuration the unordered configuration into which values should be loaded. This instance will
+     *                      encapsulate all related error checks (such as passing of nulls or inappropriate classes).
      */
-    void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                     Configuration configuration);
 
     /**
      * Performs the work needed to contribute into the ordered configuration.
      *
-     * @param moduleBuilderSource the source, if needed, of the module builder instance associated with the
-     *                            contribution
-     * @param resources           allows access to services visible to the module builder instance
-     * @param configuration       the ordered configuration into which values should be loaded. This instance will
-     *                            encapsulate all related error checks (such as passing of nulls or inappropriate
-     *                            classes).
+     * @param moduleSource  the source, if needed, of the module instance associated with the contribution
+     * @param resources     allows access to services visible to the module
+     * @param configuration the ordered configuration into which values should be loaded. This instance will encapsulate
+     *                      all related error checks (such as passing of nulls or inappropriate classes).
      */
-    void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                     OrderedConfiguration configuration);
 
     /**
      * Performs the work needed to contribute into the mapped configuration.
      *
-     * @param moduleBuilderSource the source, if needed, of the module builder instance associated with the
-     *                            contribution
-     * @param resources           allows access to services visible to the module builder instance
-     * @param configuration       the mapped configuration into which values should be loaded. This instance will
-     *                            encapsulate all related error checks (such as passing of null keys or values or
-     *                            inappropriate classes, or duplicate keys).
+     * @param moduleSource  the source, if needed, of the module instance associated with the contribution
+     * @param resources     allows access to services visible to the module
+     * @param configuration the mapped configuration into which values should be loaded. This instance will encapsulate
+     *                      all related error checks (such as passing of null keys or values or inappropriate classes,
+     *                      or duplicate keys).
      */
-    void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                     MappedConfiguration configuration);
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/DecoratorDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/DecoratorDef.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/DecoratorDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/DecoratorDef.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2009 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.
@@ -51,15 +51,15 @@
 
     /**
      * Creates an object that can perform the decoration (in the default case, by invoking the decorator method on the
-     * module builder instance.
+     * module class or instance.
      *
-     * @param moduleBuilderSource the module builder instance associated with the module containing the decorator (not
-     *                            necessarily the module containing the service being decorated)
-     * @param resources           the resources visible <em>to the decorator</em> (which may be in a different module
-     *                            than the service being decorated). Other resource properties (serviceId,
-     *                            serviceInterface, log, etc.) are for the service being decorated.
+     * @param moduleSource access to the the module  instance associated with the module containing the decorator (not
+     *                     necessarily the module containing the service being decorated)
+     * @param resources    the resources visible <em>to the decorator</em> (which may be in a different module than the
+     *                     service being decorated). Other resource properties (serviceId, serviceInterface, log, etc.)
+     *                     are for the service being decorated.
      */
-    ServiceDecorator createDecorator(ModuleBuilderSource moduleBuilderSource,
+    ServiceDecorator createDecorator(ModuleBuilderSource moduleSource,
                                      ServiceResources resources);
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ModuleDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ModuleDef.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ModuleDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ModuleDef.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2009 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.
@@ -50,6 +50,8 @@
     /**
      * Returns the class that will be instantiated. Annotated instance methods of this class are invoked to build
      * services, to decorate/intercept services, and make contributions to other services.
+     * <p/>
+     * Note: this name is maintained for compatibilty; the term "module builder" is now just "module class".
      */
     Class getBuilderClass();
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java Fri Jan  2 11:50:44 2009
@@ -53,22 +53,22 @@
         return serviceId;
     }
 
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            Configuration configuration)
     {
-        invokeMethod(moduleBuilderSource, resources, Configuration.class, configuration);
+        invokeMethod(moduleSource, resources, Configuration.class, configuration);
     }
 
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            OrderedConfiguration configuration)
     {
-        invokeMethod(moduleBuilderSource, resources, OrderedConfiguration.class, configuration);
+        invokeMethod(moduleSource, resources, OrderedConfiguration.class, configuration);
     }
 
-    public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                            MappedConfiguration configuration)
     {
-        invokeMethod(moduleBuilderSource, resources, MappedConfiguration.class, configuration);
+        invokeMethod(moduleSource, resources, MappedConfiguration.class, configuration);
     }
 
     private <T> void invokeMethod(ModuleBuilderSource source, ServiceResources resources,
@@ -97,7 +97,7 @@
 
         Throwable fail = null;
 
-        Object moduleBuilder = InternalUtils.isStatic(contributorMethod) ? null : source
+        Object moduleInstance = InternalUtils.isStatic(contributorMethod) ? null : source
                 .getModuleBuilder();
 
         try
@@ -107,7 +107,7 @@
                     resources,
                     injectionResources, resources.getTracker());
 
-            contributorMethod.invoke(moduleBuilder, parameters);
+            contributorMethod.invoke(moduleInstance, parameters);
         }
         catch (InvocationTargetException ex)
         {

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2009 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.
@@ -78,10 +78,10 @@
         return decoratorId;
     }
 
-    public ServiceDecorator createDecorator(ModuleBuilderSource moduleBuilderSource,
+    public ServiceDecorator createDecorator(ModuleBuilderSource moduleSource,
                                             ServiceResources resources)
     {
-        return new ServiceDecoratorImpl(decoratorMethod, moduleBuilderSource, resources,
+        return new ServiceDecoratorImpl(decoratorMethod, moduleSource, resources,
                                         classFactory);
     }
 
@@ -94,5 +94,4 @@
 
         return idMatcher.matches(serviceId);
     }
-
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -34,8 +34,8 @@
 import java.util.*;
 
 /**
- * Starting from the Class for a module builder, identifies all the services (service builder methods), decorators
- * (service decorator methods) and (not yet implemented) contributions (service contributor methods).
+ * Starting from the Class for a module, identifies all the services (service builder methods), decorators (service
+ * decorator methods) and (not yet implemented) contributions (service contributor methods).
  */
 public class DefaultModuleDefImpl implements ModuleDef, ServiceDefAccumulator
 {
@@ -56,7 +56,7 @@
 
     private final static Map<Class, ConfigurationType> PARAMETER_TYPE_TO_CONFIGURATION_TYPE = newMap();
 
-    private final Class builderClass;
+    private final Class moduleClass;
 
     private final Logger logger;
 
@@ -70,11 +70,13 @@
     /**
      * Keyed on decorator id.
      */
-    private final Map<String, DecoratorDef> decoratorDefs = newCaseInsensitiveMap();
+    private final Map<String, DecoratorDef> decoratorDefs = CollectionFactory.newCaseInsensitiveMap();
 
-    private final Set<ContributionDef> contributionDefs = newSet();
+    private final Set<ContributionDef> contributionDefs = CollectionFactory.newSet();
 
-    private final Set<Class> defaultMarkers = newSet();
+    private final Set<Class> defaultMarkers = CollectionFactory.newSet();
+
+    private final static Set<Method> OBJECT_METHODS = CollectionFactory.newSet(Object.class.getMethods());
 
     static
     {
@@ -84,18 +86,18 @@
     }
 
     /**
-     * @param builderClass the class that is responsible for building services, etc.
+     * @param moduleClass  the class that is responsible for building services, etc.
      * @param logger       based on the class name of the module
      * @param classFactory factory used to create new classes at runtime or locate method line numbers for error
      *                     reporting
      */
-    public DefaultModuleDefImpl(Class<?> builderClass, Logger logger, ClassFactory classFactory)
+    public DefaultModuleDefImpl(Class<?> moduleClass, Logger logger, ClassFactory classFactory)
     {
-        this.builderClass = builderClass;
+        this.moduleClass = moduleClass;
         this.logger = logger;
         this.classFactory = classFactory;
 
-        Marker annotation = builderClass.getAnnotation(Marker.class);
+        Marker annotation = moduleClass.getAnnotation(Marker.class);
 
         if (annotation != null)
         {
@@ -103,23 +105,36 @@
             defaultMarkers.addAll(Arrays.asList(annotation.value()));
         }
 
-        grind();
-        bind();
+        // Want to verify that every public method is meaningful to Tapestry IoC.  Remaining methods might
+        // have typos, i.e., "createFoo" that should be "buildFoo".
+
+        Set<Method> methods = CollectionFactory.newSet(moduleClass.getMethods());
+
+        methods.removeAll(OBJECT_METHODS);
+
+        grind(methods);
+        bind(methods);
+
+        if (methods.isEmpty()) return;
+
+        throw new RuntimeException(String.format("Module class %s contains unrecognized public methods: %s.",
+                                                 moduleClass.getName(),
+                                                 InternalUtils.joinSorted(methods)));
     }
 
     /**
-     * Identifies the module builder class and a list of service ids within the module.
+     * Identifies the module class and a list of service ids within the module.
      */
     @Override
     public String toString()
     {
-        return String.format("ModuleDef[%s %s]", builderClass.getName(), InternalUtils
+        return String.format("ModuleDef[%s %s]", moduleClass.getName(), InternalUtils
                 .joinSorted(serviceDefs.keySet()));
     }
 
     public Class getBuilderClass()
     {
-        return builderClass;
+        return moduleClass;
     }
 
     public Set<String> getServiceIds()
@@ -132,9 +147,9 @@
         return serviceDefs.get(serviceId);
     }
 
-    private void grind()
+    private void grind(Set<Method> remainingMethods)
     {
-        Method[] methods = builderClass.getMethods();
+        Method[] methods = moduleClass.getMethods();
 
         Comparator<Method> c = new Comparator<Method>()
         {
@@ -159,18 +174,21 @@
             if (name.startsWith(BUILD_METHOD_NAME_PREFIX))
             {
                 addServiceDef(m);
+                remainingMethods.remove(m);
                 continue;
             }
 
             if (name.startsWith(DECORATE_METHOD_NAME_PREFIX))
             {
                 addDecoratorDef(m);
+                remainingMethods.remove(m);
                 continue;
             }
 
             if (name.startsWith(CONTRIBUTE_METHOD_NAME_PREFIX))
             {
                 addContributionDef(m);
+                remainingMethods.remove(m);
                 continue;
             }
         }
@@ -193,20 +211,14 @@
             if (thisParameter != null)
             {
                 if (type != null)
-                {
-                    logger.warn(IOCMessages.tooManyContributionParameters(method));
-                    return;
-                }
+                    throw new RuntimeException(IOCMessages.tooManyContributionParameters(method));
 
                 type = thisParameter;
             }
         }
 
         if (type == null)
-        {
-            logger.warn(IOCMessages.noContributionParameter(method));
-            return;
-        }
+            throw new RuntimeException(IOCMessages.noContributionParameter(method));
 
         ContributionDef def = new ContributionDefImpl(serviceId, method, classFactory);
 
@@ -224,10 +236,7 @@
         Class returnType = method.getReturnType();
 
         if (returnType.isPrimitive() || returnType.isArray())
-        {
-            logger.warn(decoratorMethodWrongReturnType(method));
-            return;
-        }
+            throw new RuntimeException(decoratorMethodWrongReturnType(method));
 
         Order orderAnnotation = method.getAnnotation(Order.class);
         Match match = method.getAnnotation(Match.class);
@@ -280,10 +289,7 @@
         Class returnType = method.getReturnType();
 
         if (returnType.isPrimitive() || returnType.isArray())
-        {
-            logger.warn(buildMethodWrongReturnType(method));
-            return;
-        }
+            throw new RuntimeException(buildMethodWrongReturnType(method));
 
         String scope = extractServiceScope(method);
         boolean eagerLoad = method.isAnnotationPresent(EagerLoad.class);
@@ -349,27 +355,24 @@
 
     public String getLoggerName()
     {
-        return builderClass.getName();
+        return moduleClass.getName();
     }
 
     /**
      * See if the build class defined a bind method and invoke it.
      */
-    private void bind()
+    private void bind(Set<Method> remainingMethods)
     {
         Throwable failure;
         Method bindMethod = null;
 
         try
         {
-            bindMethod = builderClass.getMethod("bind", ServiceBinder.class);
+            bindMethod = moduleClass.getMethod("bind", ServiceBinder.class);
 
             if (!Modifier.isStatic(bindMethod.getModifiers()))
-            {
-                logger.error(IOCMessages.bindMethodMustBeStatic(InternalUtils.asString(bindMethod, classFactory)));
-
-                return;
-            }
+                throw new RuntimeException(
+                        IOCMessages.bindMethodMustBeStatic(InternalUtils.asString(bindMethod, classFactory)));
 
             ServiceBinderImpl binder = new ServiceBinderImpl(this, bindMethod, classFactory, defaultMarkers);
 
@@ -377,6 +380,8 @@
 
             binder.finish();
 
+            remainingMethods.remove(bindMethod);
+
             return;
         }
         catch (NoSuchMethodException ex)

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/IOCMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/IOCMessages.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/IOCMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/IOCMessages.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -209,14 +209,14 @@
         return MESSAGES.format("error-building-service", serviceId, serviceDef, cause);
     }
 
-    static String noPublicConstructors(Class moduleBuilderClass)
+    static String noPublicConstructors(Class moduleClass)
     {
-        return MESSAGES.format("no-public-constructors", moduleBuilderClass.getName());
+        return MESSAGES.format("no-public-constructors", moduleClass.getName());
     }
 
-    static String tooManyPublicConstructors(Class moduleBuilderClass, Constructor constructor)
+    static String tooManyPublicConstructors(Class moduleClass, Constructor constructor)
     {
-        return MESSAGES.format("too-many-public-constructors", moduleBuilderClass.getName(), constructor);
+        return MESSAGES.format("too-many-public-constructors", moduleClass.getName(), constructor);
     }
 
     static String recursiveModuleConstructor(Class builderClass, Constructor constructor)

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -48,7 +48,7 @@
     /**
      * Lazily instantiated.  Access is guarded by BARRIER.
      */
-    private Object moduleBuilder;
+    private Object moduleInstance;
 
     // Set to true when invoking the module constructor. Used to
     // detect endless loops caused by irresponsible dependencies in
@@ -301,43 +301,43 @@
         return registry.invoke(description, operation);
     }
 
-    private final Runnable instantiateModuleBuilder = new Runnable()
+    private final Runnable instantiateModule = new Runnable()
     {
         public void run()
         {
-            moduleBuilder = registry.invoke("Constructing module class " + moduleDef.getBuilderClass().getName(),
-                                            new Invokable()
-                                            {
-                                                public Object invoke()
-                                                {
-                                                    return constructModuleBuilder();
-                                                }
-                                            });
+            moduleInstance = registry.invoke("Constructing module class " + moduleDef.getBuilderClass().getName(),
+                                             new Invokable()
+                                             {
+                                                 public Object invoke()
+                                                 {
+                                                     return instantiateModuleInstance();
+                                                 }
+                                             });
         }
     };
 
-    private final Invokable provideModuleBuilder = new Invokable<Object>()
+    private final Invokable provideModuleInstance = new Invokable<Object>()
     {
         public Object invoke()
         {
-            if (moduleBuilder == null) BARRIER.withWrite(instantiateModuleBuilder);
+            if (moduleInstance == null) BARRIER.withWrite(instantiateModule);
 
-            return moduleBuilder;
+            return moduleInstance;
         }
     };
 
     public Object getModuleBuilder()
     {
-        return BARRIER.withRead(provideModuleBuilder);
+        return BARRIER.withRead(provideModuleInstance);
     }
 
-    private Object constructModuleBuilder()
+    private Object instantiateModuleInstance()
     {
-        Class builderClass = moduleDef.getBuilderClass();
+        Class moduleClass = moduleDef.getBuilderClass();
 
-        Constructor[] constructors = builderClass.getConstructors();
+        Constructor[] constructors = moduleClass.getConstructors();
 
-        if (constructors.length == 0) throw new RuntimeException(IOCMessages.noPublicConstructors(builderClass));
+        if (constructors.length == 0) throw new RuntimeException(IOCMessages.noPublicConstructors(moduleClass));
 
         if (constructors.length > 1)
         {
@@ -355,13 +355,13 @@
 
             Arrays.sort(constructors, comparator);
 
-            logger.warn(IOCMessages.tooManyPublicConstructors(builderClass, constructors[0]));
+            logger.warn(IOCMessages.tooManyPublicConstructors(moduleClass, constructors[0]));
         }
 
         Constructor constructor = constructors[0];
 
         if (insideConstructor)
-            throw new RuntimeException(IOCMessages.recursiveModuleConstructor(builderClass, constructor));
+            throw new RuntimeException(IOCMessages.recursiveModuleConstructor(moduleClass, constructor));
 
         ObjectLocator locator = new ObjectLocatorImpl(registry, this);
         Map<Class, Object> resourcesMap = CollectionFactory.newMap();
@@ -403,7 +403,7 @@
             insideConstructor = false;
         }
 
-        throw new RuntimeException(IOCMessages.instantiateBuilderError(builderClass, fail), fail);
+        throw new RuntimeException(IOCMessages.instantiateBuilderError(moduleClass, fail), fail);
     }
 
     private Object createProxy(ServiceResources resources, ObjectCreator creator)

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ObjectLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ObjectLocatorImpl.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ObjectLocatorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ObjectLocatorImpl.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -18,7 +18,7 @@
 import org.apache.tapestry5.ioc.ObjectLocator;
 
 /**
- * Base service locator class used when only the module is known (i.e., when instantiating a module builder class).
+ * Base service locator class used when only the module is known (i.e., when instantiating a module class).
  */
 public class ObjectLocatorImpl implements ObjectLocator
 {

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvoker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvoker.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvoker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvoker.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -41,11 +41,12 @@
      */
     public Object createObject()
     {
-        // Defer getting (and possibly instantitating) the module builder until the last possible
+        // Defer getting (and possibly instantitating) the module instance until the last possible
         // moment. If the method is static, there's no need to even get the builder.
 
-        Object moduleBuilder = InternalUtils.isStatic(builderMethod) ? null : resources
-                .getModuleBuilder();
+        Object moduleInstance = InternalUtils.isStatic(builderMethod)
+                                ? null
+                                : resources.getModuleBuilder();
 
         Object result = null;
         Throwable failure = null;
@@ -60,7 +61,7 @@
             if (logger.isDebugEnabled())
                 logger.debug(IOCMessages.invokingMethod(creatorDescription));
 
-            result = builderMethod.invoke(moduleBuilder, parameters);
+            result = builderMethod.invoke(moduleInstance, parameters);
         }
         catch (InvocationTargetException ite)
         {

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -31,7 +31,7 @@
  */
 public class ServiceDecoratorImpl implements ServiceDecorator
 {
-    private final ModuleBuilderSource moduleBuilderSource;
+    private final ModuleBuilderSource moduleSource;
 
     private final String serviceId;
 
@@ -47,12 +47,12 @@
 
     private final Class serviceInterface;
 
-    public ServiceDecoratorImpl(Method method, ModuleBuilderSource moduleBuilderSource,
+    public ServiceDecoratorImpl(Method method, ModuleBuilderSource moduleSource,
                                 ServiceResources resources, ClassFactory classFactory)
     {
         serviceId = resources.getServiceId();
         decoratorMethod = method;
-        this.moduleBuilderSource = moduleBuilderSource;
+        this.moduleSource = moduleSource;
         this.resources = resources;
         serviceInterface = resources.getServiceInterface();
         logger = resources.getLogger();
@@ -92,9 +92,9 @@
         Object result = null;
         Throwable failure = null;
 
-        Object moduleBuilder = InternalUtils.isStatic(decoratorMethod)
-                               ? null
-                               : moduleBuilderSource.getModuleBuilder();
+        Object moduleInstance = InternalUtils.isStatic(decoratorMethod)
+                                ? null
+                                : moduleSource.getModuleBuilder();
 
         try
         {
@@ -103,7 +103,7 @@
                     this.resources,
                     injectionResources, resources.getTracker());
 
-            result = decoratorMethod.invoke(moduleBuilder, parameters);
+            result = decoratorMethod.invoke(moduleInstance, parameters);
         }
         catch (InvocationTargetException ite)
         {

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/IOCStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/IOCStrings.properties?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/IOCStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/IOCStrings.properties Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
- # Copyright 2006, 2007, 2008 The Apache Software Foundation
+ # Copyright 2006, 2007, 2008, 2009 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.
@@ -14,13 +14,12 @@
 
 build-method-conflict=Service %s (defined by %s) conflicts with previously defined service defined by %s.
 build-method-wrong-return-type=Method %s is named like a service builder method, \
- but the return type (%s) is not acceptable (try an interface). \
- The method has been ignored.
+ but the return type (%s) is not acceptable (try an interface).
 decorator-method-wrong-return-type=Method %s is named like a service decorator method, \
-  but the return type (%s) is not acceptable (try Object). The method has been ignored.
+  but the return type (%s) is not acceptable (try Object).
 builder-locked=The Registry Builder has created the Registry, further operations are not allowed.
 service-wrong-interface=Service '%s' implements interface %s, which is not compatible with the requested type %s.
-instantiate-builder-error=Unable to instantiate class %s as a module builder: %s
+instantiate-builder-error=Unable to instantiate class %s as a module: %s
 builder-method-error=Error invoking service builder method %s (for service '%s'): %s
 constructor-error=Error invoking constructor %s (for service '%s'): %s
 decorator-method-error=Error invoking service decorator method %s (for service '%s'): %s
@@ -41,17 +40,16 @@
   the service depends on itself in some way. \
   Please check %s for references to another service that is itself dependent on service '%1$s'.
 contribution-wrong-return-type=Method %s is named like a service contributor method, \
-  but the return type (%s) is not appropriate (try void). The return value will be ignored.
+  but the return type (%s) is not appropriate (it should be void). The return value will be ignored.
 too-many-contribution-parameters=Service contribution method %s contains more than one parameter of type Configuration, \
-  OrderedConfiguration, or MappedConfiguration. Exactly one such parameter is required for a service contribution method. \
-  The method has been ignored.
+  OrderedConfiguration, or MappedConfiguration. Exactly one such parameter is required for a service contribution method.
 too-many-configuration-parameters=Service builder method %s contains more than one parameter of type \
   Collection, List, or Map. Parameters of this type are the way in which service configuration values, \
   collected from service contributor methods, are provided to the service builder. \
-  Services are only allowed a single configuration. Unexpected results or failures may occur.
+  Services are only allowed a single configuration
 no-contribution-parameter=Service contribution method %s does not contain a parameter of type \
   Configuration, OrderedConfiguration or MappedConfiguration. This parameter is how the method \
-  make contributions into the service's configuration. The method has been ignored.
+  make contributions into the service's configuration.
 contribution-method-error=Error invoking service contribution method %s: %s
 contribution-was-null=Service contribution (to service '%s') was null.
 contribution-key-was-null=Key for service contribution (to service '%s') was null.
@@ -63,8 +61,8 @@
 generic-type-not-supported=Generic type '%s' is not supported. Only simple parameterized lists are \
   supported.
 error-building-service=Error building service proxy for service '%s' (at %s): %s
-no-public-constructors=Module builder class %s does not contain any public constructors.
-too-many-public-constructors=Module bulider class %s contains more than one public constructor. \
+no-public-constructors=Module class %s does not contain any public constructors.
+too-many-public-constructors=Module class %s contains more than one public constructor. \
   The first constructor, %s, is being used. \
   You should change the class to have only a single public constructor.
 recursive-module-constructor=The constructor for module class %s is recursive: it depends on itself in some way. \

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/autoload.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/autoload.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/autoload.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/autoload.apt Fri Jan  2 11:50:44 2009
@@ -23,7 +23,7 @@
   It does this by searching for a particular global manifest entry.
 
   The manifest entry name is "Tapestry-Module-Classes".  The value is a comma-separated list
-  of fully qualified class names of module builder classes (this allows a single
+  of fully qualified class names of module classes (this allows a single
   JAR to contain multiple, related modules).  Whitespace is ignored.
 
   Example:
@@ -76,8 +76,11 @@
   A better alternative is the
   {{{../apidocs/org/apache/tapestry5/ioc/annotations/SubModule.html}@SubModule annotation}}.
 
-  The value for this annotation is a list of <additional> classes to be treated as module builder classes,
-  exactly as if they were identified in the manifest.  For example:
+  The value for this annotation is a list of <additional> classes to be treated as module classes,
+  exactly as if they were identified in the manifest. Despite the name, there is no hierarchy of modules in
+  Tapestry IoC.
+
+  Example:
 
 +----+
 @SubModule(
@@ -88,4 +91,4 @@
 +----+
 
   In general, your should only need to identify a single module in the JAR manifest, and make use of
-  @SubModule to pull in any additional module builder classes.
\ No newline at end of file
+  @SubModule to pull in any additional module classes.
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt Fri Jan  2 11:50:44 2009
@@ -75,9 +75,9 @@
   Now the FileServicerDispatcher builder method gets a Map with at least four entries in it.
 
   Because Tapestry IoC is highly dynamic (it scans the visible JAR manifest files to identify
-  module builder classes), the FileServicerDispatcher service may be in one module, and the
+  module classes), the FileServicerDispatcher service may be in one module, and the
   other contributing modules (such as the one that contributes the Office file services) may be written at 
-  a much later date. With no change to the FileServicerDispatcher service or its module builder class,
+  a much later date. With no change to the FileServicerDispatcher service or its module class,
   the new services "plug into" the overall solution, simply by having their JAR's on runtime classpath. 
   
 Configuration Types

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/index.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/index.apt Fri Jan  2 11:50:44 2009
@@ -92,8 +92,7 @@
   and easier than a big chunk of XML.
 
   In addition, moving from XML to Java code encourages testing; you can unit test the 
-  service builder methods of your
-  module builder class, but you can't realistically unit test an XML descriptor.
+  service builder methods of your  module  class, but you can't realistically unit test an XML descriptor.
   
   Tapestry IoC modules are easily packaged into JAR files, supporting 
   zero-configuration usage: just drop the JAR onto the classpath.
@@ -165,10 +164,10 @@
   
   Services are aggregated into <<modules>>:
       
-  * A module is defined by a <<module builder>>, a specific class containing a mix of static or instance methods, used to define
+  * A module is defined by a <<module class>>, a specific class containing a mix of static or instance methods, used to define
     services, decorate them (see below), or contribute to service configurations (again, more below).
   
-  * Methods of the module builder class define the services provided by the module, 
+  * Methods of the module class define the services provided by the module, 
     and the same methods are responsible
     for instantiating the service implementation.
     

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt Fri Jan  2 11:50:44 2009
@@ -4,9 +4,9 @@
  
 Tapestry IoC Modules
  
-  You inform Tapestry about your services and contributions by providing a module builder class.
+  You inform Tapestry about your services and contributions by providing a module class.
 
-  The module builder is a plain Java class.  A system of annotations and naming conventions allow
+  The module class is a plain Java class.  A system of annotations and naming conventions allow
   Tapestry to determine what services are provided by the module.
 
   A module class exists for the following reasons:
@@ -23,10 +23,15 @@
 
   []
 
-  A module builder defines builder methods, one for each service provided by the module.
 
-  <<This page needs to be rewritten or reorganized; using the bind() method is the preferred way to define services,
-  service builder methods are now used in very limited circumstances.>>
+  All public methods of a module class must be meaningful to Tapestry (be one of the categories above).  Any extra
+  public methods result in startup exceptions (because the method may contain a typo).
+
+Service Builder Methods
+
+  Service builder methods were the original way to define a service and provide the logic to construct it;
+  although this is now more commonly (and succinctly) accomplished using the bind() method, there are
+  still many cases where service builder methods are useful.
 
   Service builder methods are public methods. They are often static. Here's a trivial example:
 
@@ -102,7 +107,11 @@
   * You wish to do more than just instantiate a class; for example, to register the class as an event listener with some other service.
 
   * There is <no implementation class>; in some cases, you can create your implementation on the fly using JDK dynamic proxies or bytecode generation.
-  
+
+  []
+
+  The bind() method must be static; an exception is thrown if the bind() method exists but is an instance method.
+
 {Cacheing Services}
 
   You will occasionally find yourself in the position of injecting the same services
@@ -164,7 +173,7 @@
   
   Note that the fields are final: this is important. Tapestry IoC is thread-safe and you largely
   never have to think about concurrency issues. But in a busy application, different services may be
-  built by different threads simultaneously. Each module builder class is instantiated at most once, and
+  built by different threads simultaneously. Each module class is a singleton, instantiated at most once, and
   making these fields final ensures that the values are available across multiple threads.
   Refer to Brian Goetz's {{{http://www.javaconcurrencyinpractice.com/}Java Concurrency in Practice}}
   for a more complete explanation of the relationship between final fields, constructors, and threads ...
@@ -172,16 +181,15 @@
   
   Care should be taken with this approach: in some circumstances, you may force a situation in which
   the module constructor is dependent on itself. For example, if you invoke a method on any injected services
-  defined within the same module from the module builder's constructor,
+  defined within the same module from the module class' constructor,
   then the service implementation will be needed. Creating service implementations
   requires the module builder instance ... that's a recursive reference. 
     
   Tapestry detects these scenarios and throws a runtime exception to prevent an endless loop.
-    
 
-Module Builder Implementation Notes
+Module Class Implementation Notes
 
-  Module builder classes are designed to be very, very simple to implement.
+  Module classes are designed to be very, very simple to implement.
     
   Again, keep the methods very simple. Use {{{service.html#Injecting Dependencies}parameter injection}}
   to gain access to the dependencies you need.
@@ -189,7 +197,7 @@
   Be careful about inheritance. Tapestry will see all <public> methods,
   even those inherited from base classes.  Tapestry <only> sees public methods.  
   
-  By convention, module builder class names end in Module and are final classes.
+  By convention, module class names end in Module and are final classes.
   
   You don't <have> to define your methods as static. The use of static methods is only absolutely
   necessary in a few cases, where the constructor for a module is dependent on contributions

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt Fri Jan  2 11:50:44 2009
@@ -161,7 +161,7 @@
   
   * As parameters to the service implementation class' constructor (for autobuilt services)
   
-  * As parameters passed to the constructor of the service's module builder (cached inside instance variables)
+  * As parameters passed to the constructor of the service's module class (to be cached inside instance variables)
 
   * Directly into fields of the service implementation
   

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/shadow.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/shadow.apt?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/shadow.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/shadow.apt Fri Jan  2 11:50:44 2009
@@ -20,7 +20,7 @@
 }
 +----+
 
-  (shadowBuilder and requestGlobals are injected into the module builder instance)
+  (shadowBuilder and requestGlobals are injected into the module class instance)
 
   This can be thought of as similar to:
   

Added: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ExtraMethodsModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ExtraMethodsModule.java?rev=730832&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ExtraMethodsModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ExtraMethodsModule.java Fri Jan  2 11:50:44 2009
@@ -0,0 +1,33 @@
+// Copyright 2009 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.ioc;
+
+public class ExtraMethodsModule
+{
+    public static void thisMethodIsInvalid()
+    {
+
+    }
+
+    public void soIsThisMethod()
+    {
+
+    }
+
+    void nonPublicMethodsAreOK()
+    {
+
+    }
+}

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java Fri Jan  2 11:50:44 2009
@@ -948,7 +948,7 @@
         catch (RuntimeException ex)
         {
             assertMessageContains(ex,
-                                  "Module builder class org.apache.tapestry5.ioc.internal.PrivateConstructorModule does not contain any public constructors.");
+                                  "Module class org.apache.tapestry5.ioc.internal.PrivateConstructorModule does not contain any public constructors.");
         }
     }
 
@@ -1084,4 +1084,24 @@
                                   "is for service 'DoesNotExist', which does not exist.");
         }
     }
+
+    /**
+     * TAP5-436
+     */
+    @Test
+    public void extra_methods_on_module_class_are_errors()
+    {
+        try
+        {
+            buildRegistry(ExtraMethodsModule.class);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertMessageContains(ex,
+                                  "Module class org.apache.tapestry5.ioc.ExtraMethodsModule contains unrecognized public methods: ",
+                                  "thisMethodIsInvalid()",
+                                  "soIsThisMethod().");
+        }
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/StaticModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/StaticModule.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/StaticModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/StaticModule.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2009 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.
@@ -67,32 +67,32 @@
         };
     }
 
-    public static synchronized void setFredRan(boolean fredRan)
+    static synchronized void setFredRan(boolean fredRan)
     {
         StaticModule.fredRan = fredRan;
     }
 
-    public static synchronized boolean getFredRan()
+    static synchronized boolean getFredRan()
     {
         return fredRan;
     }
 
-    public static synchronized void setInstantiated(boolean instantiated)
+    static synchronized void setInstantiated(boolean instantiated)
     {
         StaticModule.instantiated = instantiated;
     }
 
-    public static synchronized boolean isInstantiated()
+    static synchronized boolean isInstantiated()
     {
         return instantiated;
     }
 
-    public static synchronized void setDecoratorRan(boolean decoratorRan)
+    static synchronized void setDecoratorRan(boolean decoratorRan)
     {
         StaticModule.decoratorRan = decoratorRan;
     }
 
-    public static synchronized boolean getDecoratorRan()
+    static synchronized boolean getDecoratorRan()
     {
         return decoratorRan;
     }
@@ -116,5 +116,4 @@
     {
         configuration.add("Fred");
     }
-
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -24,7 +24,6 @@
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.services.ClassFactory;
 import org.apache.tapestry5.ioc.test.IOCTestCase;
-import static org.easymock.EasyMock.and;
 import static org.easymock.EasyMock.contains;
 import org.slf4j.Logger;
 import org.testng.annotations.AfterClass;
@@ -162,13 +161,17 @@
 
         Logger logger = mockLogger();
 
-        logger.warn(IOCMessages.buildMethodWrongReturnType(m));
-
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(VoidBuilderMethodModule.class, logger, null);
-
-        assertTrue(md.getServiceIds().isEmpty());
+        try
+        {
+            new DefaultModuleDefImpl(VoidBuilderMethodModule.class, logger, null);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(ex.getMessage(), IOCMessages.buildMethodWrongReturnType(m));
+        }
 
         verify();
     }
@@ -180,13 +183,17 @@
 
         Logger logger = mockLogger();
 
-        logger.warn(IOCMessages.buildMethodWrongReturnType(m));
-
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(BuilderMethodModule.class, logger, null);
-
-        assertTrue(md.getServiceIds().isEmpty());
+        try
+        {
+            new DefaultModuleDefImpl(BuilderMethodModule.class, logger, null);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(ex.getMessage(), IOCMessages.buildMethodWrongReturnType(m));
+        }
 
         verify();
     }
@@ -203,13 +210,17 @@
 
         Logger logger = mockLogger();
 
-        logger.warn(IOCMessages.decoratorMethodWrongReturnType(m));
-
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, null);
-
-        assertTrue(md.getDecoratorDefs().isEmpty());
+        try
+        {
+            new DefaultModuleDefImpl(moduleClass, logger, null);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(ex.getMessage(), IOCMessages.decoratorMethodWrongReturnType(m));
+        }
 
         verify();
     }
@@ -278,13 +289,20 @@
         Method m = findMethod(moduleClass, "contributeTooMany");
 
         Logger logger = mockLogger();
-        logger.warn(IOCMessages.tooManyContributionParameters(m));
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, null);
+        try
+        {
+            new DefaultModuleDefImpl(moduleClass, logger, null);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(ex.getMessage(),
+                         "Service contribution method org.apache.tapestry5.ioc.internal.TooManyContributionParametersModule.contributeTooMany(Configuration, OrderedConfiguration) contains more than one parameter of type Configuration, OrderedConfiguration, or MappedConfiguration. Exactly one such parameter is required for a service contribution method.");
+        }
 
-        assertTrue(md.getContributionDefs().isEmpty());
 
         verify();
     }
@@ -296,13 +314,19 @@
         Method m = findMethod(moduleClass, "contributeNoParameter");
 
         Logger logger = mockLogger();
-        logger.warn(IOCMessages.noContributionParameter(m));
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, null);
-
-        assertTrue(md.getContributionDefs().isEmpty());
+        try
+        {
+            new DefaultModuleDefImpl(moduleClass, logger, null);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(ex.getMessage(),
+                         "Service contribution method org.apache.tapestry5.ioc.internal.NoUsableContributionParameterModule.contributeNoParameter(UpcaseService) does not contain a parameter of type Configuration, OrderedConfiguration or MappedConfiguration. This parameter is how the method make contributions into the service's configuration.");
+        }
 
         verify();
     }
@@ -367,19 +391,23 @@
     }
 
     @Test
-    public void instance_method_bind_is_ignored()
+    public void instance_method_bind_is_error()
     {
         Logger logger = mockLogger();
 
-        logger.error(and(contains(NonStaticBindMethodModule.class.getName()), contains("but is an instance method")));
-
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(NonStaticBindMethodModule.class, logger, classFactory);
-
-        // Prove that the bind method was not invoke
-
-        assertTrue(md.getServiceIds().isEmpty());
+        try
+        {
+            new DefaultModuleDefImpl(NonStaticBindMethodModule.class, logger, classFactory);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertMessageContains(ex,
+                                  "Method org.apache.tapestry5.ioc.internal.NonStaticBindMethodModule.bind(ServiceBinder)",
+                                  "appears to be a service binder method, but is an instance method, not a static method.");
+        }
 
         verify();
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2009 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.
@@ -17,7 +17,7 @@
 import org.apache.tapestry5.ioc.annotations.InjectService;
 
 /**
- * Module builder used by {@link ModuleImplTest}.
+ * Module class used by {@link ModuleImplTest}.
  */
 public class ModuleImplTestModule
 {
@@ -57,5 +57,4 @@
 
         return null;
     }
-
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -348,9 +348,9 @@
     }
 
     protected final void train_getModuleBuilder(ServiceBuilderResources resources,
-                                                Object moduleBuilder)
+                                                Object moduleInstance)
     {
-        expect(resources.getModuleBuilder()).andReturn(moduleBuilder);
+        expect(resources.getModuleBuilder()).andReturn(moduleInstance);
     }
 
     @Test

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 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.
@@ -29,13 +29,13 @@
 
     private final OperationTracker tracker = new QuietOperationTracker();
 
-    private ModuleBuilderSource newSource(final Object builder)
+    private ModuleBuilderSource newSource(final Object moduleInstance)
     {
         return new ModuleBuilderSource()
         {
             public Object getModuleBuilder()
             {
-                return builder;
+                return moduleInstance;
             }
         };
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SimpleModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SimpleModule.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SimpleModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/SimpleModule.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2009 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.
@@ -40,7 +40,7 @@
         return null;
     }
 
-    public void ignoredMethod()
+    void ignoredMethod()
     {
     }
 

Modified: tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java?rev=730832&r1=730831&r2=730832&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java Fri Jan  2 11:50:44 2009
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2009 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.
@@ -218,7 +218,7 @@
             }
 
             @Override
-            public void contribute(ModuleBuilderSource moduleBuilderSource, ServiceResources resources,
+            public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
                                    OrderedConfiguration configuration)
             {
                 final OperationTracker tracker = resources.getTracker();