openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r495684 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Date Fri, 12 Jan 2007 18:50:54 GMT
Author: awhite
Date: Fri Jan 12 10:50:53 2007
New Revision: 495684

URL: http://svn.apache.org/viewvc?view=rev&rev=495684
Log: (empty)

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?view=diff&rev=495684&r1=495683&r2=495684
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Fri Jan 12 10:50:53 2007
@@ -1536,7 +1536,7 @@
                 field = Reflection.findField(oidType, name, true);
                 reflect = !Modifier.isPublic(field.getModifiers());
                 if (reflect) {
-                    code.constant().setValue(oidType);
+                    code.classconstant().setClass(oidType);
                     code.constant().setValue(name);
                     code.constant().setValue(true);
                     code.invokestatic().setMethod(Reflection.class, 
@@ -1548,9 +1548,9 @@
                 setter = Reflection.findSetter(oidType, name, type, true);
                 reflect = !Modifier.isPublic(setter.getModifiers());
                 if (reflect) {
-                    code.constant().setValue(oidType);
+                    code.classconstant().setClass(oidType);
                     code.constant().setValue(name);
-                    setClassConstant(_pc, code, type);
+                    code.classconstant().setClass(type);
                     code.constant().setValue(true);
                     code.invokestatic().setMethod(Reflection.class, 
                         "findSetter", Method.class, new Class[] { Class.class,
@@ -1601,18 +1601,6 @@
     }
 
     /**
-     * Works around a bug in serp with primitive type constants, and chooses
-     * Java 5 construct when available (serp will eventually do all this
-     * automatically). 
-     */
-    private static void setClassConstant(BCClass bc, Code code, Class type) {
-        if (type.isPrimitive() || bc.getMajorVersion() < 49) // 49 = Java 5
-            code.classconstant().setClass(type);
-        else
-            code.constant().setValue(type);
-    }
-
-    /**
      * Add code to extract the id of the given primary key relation field for
      * setting into an objectid instance.
      */
@@ -1881,7 +1869,7 @@
                         code.getfield().setField(field);
                     else {
                         // Reflection.getXXX(oid, Reflection.findField(...));
-                        code.constant().setValue(oidType);
+                        code.classconstant().setClass(oidType);
                         code.constant().setValue(name);
                         code.constant().setValue(true);
                         code.invokestatic().setMethod(Reflection.class,
@@ -1898,7 +1886,7 @@
                         code.invokevirtual().setMethod(getter);
                     else {
                         // Reflection.getXXX(oid, Reflection.findGetter(...));
-                        code.constant().setValue(oidType);
+                        code.classconstant().setClass(oidType);
                         code.constant().setValue(name);
                         code.constant().setValue(true);
                         code.invokestatic().setMethod(Reflection.class,



Mime
View raw message