You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/12/07 07:36:18 UTC
svn commit: r354740 - in /beehive/trunk/netui/src:
compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
compiler-core/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
pageflow/org/apache/beehive/netui/pageflow/Forward.java
Author: rich
Date: Tue Dec 6 22:36:10 2005
New Revision: 354740
URL: http://svn.apache.org/viewcvs?rev=354740&view=rev
Log:
Removed some invalid asserts that depended on knowing things about the internal error type in Sun's apt.
tests: bvt in netui (WinXP)
BB: same (linux)
Modified:
beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java?rev=354740&r1=354739&r2=354740&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java Tue Dec 6 22:36:10 2005
@@ -225,13 +225,9 @@
if ( value == null ) return defaultIsNull ? null : new Integer( 0 );
Object result = value.getValue();
- if ( result instanceof String )
- {
- assert isErrorString( result ) : result;
- return new Integer( 0 );
- }
-
- return ( Integer ) value.getValue();
+ // If the value isn't of type Integer, silently return 0 -- it's a compile error in user code that will
+ // be caught by javac.
+ return result instanceof Integer ? (Integer) result : new Integer(0);
}
public static boolean isErrorString( Object str )
@@ -245,13 +241,9 @@
if ( value == null ) return defaultIsNull ? null : new Long( 0 );
Object result = value.getValue();
- if ( result instanceof String )
- {
- assert result.equals( ERROR_STRING ) : result;
- return new Long( 0 );
- }
-
- return ( Long ) value.getValue();
+ // If the value isn't of type Long, silently return 0 -- it's a compile error in user code that will
+ // be caught by javac.
+ return result instanceof Long ? (Long) result : new Long(0);
}
public static Float getFloat( AnnotationInstance annotation, String memberName, boolean defaultIsNull )
@@ -260,13 +252,9 @@
if ( value == null ) return defaultIsNull ? null : new Float( 0 );
Object result = value.getValue();
- if ( result instanceof String )
- {
- assert result.equals( ERROR_STRING ) : result;
- return new Float( 0 );
- }
-
- return ( Float ) value.getValue();
+ // If the value isn't of type Float, silently return 0 -- it's a compile error in user code that will
+ // be caught by javac.
+ return result instanceof Float ? (Float) result : new Float(0);
}
public static Double getDouble( AnnotationInstance annotation, String memberName, boolean defaultIsNull )
@@ -275,13 +263,9 @@
if ( value == null ) return defaultIsNull ? null : new Double( 0 );
Object result = value.getValue();
- if ( result instanceof String )
- {
- assert result.equals( ERROR_STRING ) : result;
- return new Double( 0 );
- }
-
- return ( Double ) value.getValue();
+ // If the value isn't of type Double, silently return 0 -- it's a compile error in user code that will
+ // be caught by javac.
+ return result instanceof Double ? (Double) result : new Double(0);
}
public static Boolean getBoolean( AnnotationInstance annotation, String memberName, boolean defaultIsNull )
@@ -290,13 +274,9 @@
if ( value == null ) return defaultIsNull ? null : Boolean.FALSE;
Object result = value.getValue();
- if ( result instanceof String )
- {
- assert result.equals( ERROR_STRING ) : result;
- return Boolean.FALSE;
- }
-
- return ( Boolean ) value.getValue();
+ // If the value isn't of type Boolean, silently return false -- it's a compile error in user code that will
+ // be caught by javac.
+ return result instanceof Boolean ? (Boolean) result : Boolean.FALSE;
}
public static Object getValue( Declaration element, String annotationName, String memberName, boolean defaultIsNull )
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/TypeNameType.java?rev=354740&r1=354739&r2=354740&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/TypeNameType.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/TypeNameType.java Tue Dec 6 22:36:10 2005
@@ -71,12 +71,6 @@
return null;
}
- if ( val instanceof String )
- {
- assert CompilerUtils.isErrorString( val ) : val;
- return null;
- }
-
assert val instanceof ReferenceType : val.getClass().getName();
ReferenceType type = ( ReferenceType ) val;
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java?rev=354740&r1=354739&r2=354740&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java Tue Dec 6 22:36:10 2005
@@ -504,7 +504,8 @@
{
try
{
- returnFormClass = Class.forName( _outputFormBeanType );
+ ReloadableClassHandler rch = Handlers.get(_servletContext).getReloadableClassHandler();
+ returnFormClass = rch.loadClass( _outputFormBeanType );
}
catch ( ClassNotFoundException e )
{
@@ -615,9 +616,10 @@
private void checkActionOutputs( PageFlowActionForward fc )
{
PageFlowActionForward.ActionOutput[] actionOutputs = fc.getActionOutputs();
- boolean isInProductionMode =
- AdapterManager.getServletContainerAdapter( _servletContext ).isInProductionMode();
-
+ boolean doExpensiveChecks =
+ _actionOutputs != null
+ && ! AdapterManager.getServletContainerAdapter( _servletContext ).isInProductionMode();
+
for ( int i = 0; i < actionOutputs.length; ++i )
{
PageFlowActionForward.ActionOutput actionOutput = actionOutputs[i];
@@ -643,7 +645,7 @@
// If we're *not* in production mode, do some (expensive) checks to ensure that the types for the
// action outputs match their declared types.
//
- if ( ! isInProductionMode && _actionOutputs != null )
+ if ( doExpensiveChecks )
{
Object actualActionOutput = _actionOutputs.get( actionOutput.getName() );
@@ -664,7 +666,8 @@
{
try
{
- expectedType = Class.forName( expectedTypeName );
+ ReloadableClassHandler rch = Handlers.get(_servletContext).getReloadableClassHandler();
+ expectedType = rch.loadClass( expectedTypeName );
}
catch ( ClassNotFoundException e )
{