You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2008/05/29 22:36:53 UTC
svn commit: r661469 - in /db/derby/code/trunk/java:
engine/org/apache/derby/iapi/services/loader/ClassInspector.java
testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java
Author: rhillegas
Date: Thu May 29 13:36:53 2008
New Revision: 661469
URL: http://svn.apache.org/viewvc?rev=661469&view=rev
Log:
DERBY-3652: Don't widen argument types when matching SQL to Java signatures, per the ANSI spec.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java?rev=661469&r1=661468&r2=661469&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/loader/ClassInspector.java Thu May 29 13:36:53 2008
@@ -949,40 +949,9 @@
protected boolean classConvertableFromTo(Class fromClass, Class toClass, boolean mixTypes) {
//
- // Don't allow widening of String to Object. Otherwise, the SQL
- // signature
+ // ANSI rules do not allow widening
//
- // f( a varchar( 10 ) ) returns varchar( 10 )
- //
- // will incorrectly match the Java signature
- //
- // public static String f( Object a )
- //
- // Also don't allow the widening of BigDecimal to Object. Otherwise, the
- // SQL signature
- //
- // f( a numeric( 7, 2 ) ) returns numeric( 7, 2 )
- //
- // will incorrectly match the Java signature
- //
- // public static BigDecimal f( Object a )
- //
- //
- // For a description of the ANSI signature matching rules, see
- // DERBY-3652.
- //
- if (
- !(
- (
- STRING_TYPE_NAME.equals( fromClass.getName() ) ||
- BIGDECIMAL_TYPE_NAME.equals( fromClass.getName() )
- ) && OBJECT_TYPE_NAME.equals( toClass.getName() )
- ) &&
- toClass.isAssignableFrom(fromClass)
- )
- {
- return true;
- }
+ if ( fromClass.getName().equals( toClass.getName() ) ) { return true; }
// When comparing two candidate methods to see which one is closer,
// we want to mix object type and primitive type, because they could
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java?rev=661469&r1=661468&r2=661469&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java Thu May 29 13:36:53 2008
@@ -36,6 +36,7 @@
import org.apache.derbyTesting.junit.JDBC;
import org.apache.derbyTesting.junit.TestConfiguration;
import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
/**
* <p>
@@ -228,6 +229,12 @@
public void test_numeric_BigDecimal_BigDecimal()
throws Exception
{
+ //
+ // On small device platforms, this raises an exception in the byte-code
+ // compiler. See DERBY-3697.
+ //
+ if ( JDBC.vmSupportsJSR169() ) { return; }
+
declareAndRunFunction
( "numeric_BigDecimal_BigDecimal", "numeric( 7, 2 )", new String[] { "numeric( 7, 2 )" }, "12345.67", "12345.67" );
}