You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bs...@apache.org on 2012/04/17 21:11:36 UTC

svn commit: r1327227 - in /myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces: GenerateComponentsMojo.java generator/component/AbstractComponentGenerator.java

Author: bsullivan
Date: Tue Apr 17 19:11:36 2012
New Revision: 1327227

URL: http://svn.apache.org/viewvc?rev=1327227&view=rev
Log:
Make PartialClasses public (though still with package private constructor) to work around a Java Introspection bug where when getMethod() is called on a public class for a  public final method inherited from a package private superclass, the returned Method object refers to the package private superclass and thus blows up when invoked outside of that package.

Modified:
    myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
    myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java

Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java?rev=1327227&r1=1327226&r2=1327227&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java Tue Apr 17 19:11:36 2012
@@ -250,6 +250,7 @@ public class GenerateComponentsMojo exte
 
           outClassName     = "Partial" + className;
           outFullClassName = Util.getPackageFromFullClass(fullClassName) + '.' + outClassName;
+          
           defaultConstructorModifier = 0; // package pivate
           
           // copy the file template to the destination directory

Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java?rev=1327227&r1=1327226&r2=1327227&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java Tue Apr 17 19:11:36 2012
@@ -159,11 +159,17 @@ public abstract class AbstractComponentG
     // make abstract superclass classes abstract and package private
     if (createSuperclass)
     {
-      // remove all of the access modifiers to make this package provate
-      modifiers &= ~(Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED);
+      // we would really like to make this package private, but because of a bug in the Java
+      // Introspection code, a get on a final method of a public class inherited from a
+      // package private class actually refers to the package private class.  The result
+      // is that invoking it blows up.  Therefore, instead of making the class package private,
+      // we have to make it public. GRRR.
+    
+      // remove all of the access modifiers to make this package private
+      modifiers &= ~(Modifier.PRIVATE | Modifier.PROTECTED); // Modifier.PUBLIC
       
-      // force abstract on
-      modifiers |= Modifier.ABSTRACT;
+      // force abstract on as well as public, due to stupid bug
+      modifiers |= Modifier.ABSTRACT | Modifier.PUBLIC;
     }
     else
     {
@@ -549,7 +555,7 @@ public abstract class AbstractComponentG
       ComponentBean component,
       String overrideClassName,
       int modifiers) throws IOException
-  {
+  {    
     String className;
         
     if (overrideClassName != null)