freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [31/50] [abbrv] incubator-freemarker git commit: Removed dynamic java.lang.Enum access, as we require Java 5 now.
Date Wed, 01 Mar 2017 14:21:29 GMT
Removed dynamic java.lang.Enum access, as we require Java 5 now.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/bf58114b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/bf58114b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/bf58114b

Branch: refs/heads/2.3
Commit: bf58114b8ad8349ad6f2f770498eeb42bcfff707
Parents: f4d2ae3
Author: ddekany <ddekany@apache.org>
Authored: Mon Feb 27 19:05:58 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Mon Feb 27 19:05:58 2017 +0100

----------------------------------------------------------------------
 .../java/freemarker/ext/beans/BeansWrapper.java | 36 ++------------------
 1 file changed, 3 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/bf58114b/src/main/java/freemarker/ext/beans/BeansWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/beans/BeansWrapper.java b/src/main/java/freemarker/ext/beans/BeansWrapper.java
index 9731975..372dc5a 100644
--- a/src/main/java/freemarker/ext/beans/BeansWrapper.java
+++ b/src/main/java/freemarker/ext/beans/BeansWrapper.java
@@ -67,7 +67,6 @@ import freemarker.template.Version;
 import freemarker.template._TemplateAPI;
 import freemarker.template.utility.ClassUtil;
 import freemarker.template.utility.RichObjectWrapper;
-import freemarker.template.utility.UndeclaredThrowableException;
 import freemarker.template.utility.WriteProtectable;
 
 /**
@@ -94,8 +93,6 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable
{
     @Deprecated
     static final Object CAN_NOT_UNWRAP = ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS;
     
-    private static final Constructor<?> ENUMS_MODEL_CTOR = enumsModelCtor();
-    
     /**
      * At this level of exposure, all methods and properties of the
      * wrapped objects are exposed to the template.
@@ -350,9 +347,9 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable
{
         falseModel = new BooleanModel(Boolean.FALSE, this);
         trueModel = new BooleanModel(Boolean.TRUE, this);
         
-        staticModels = new StaticModels(BeansWrapper.this);
-        enumModels = createEnumModels(BeansWrapper.this);
-        modelCache = new BeansModelCache(BeansWrapper.this);
+        staticModels = new StaticModels(this);
+        enumModels = new _EnumModels(this);
+        modelCache = new BeansModelCache(this);
         setUseCache(bwConf.getUseModelCache());
 
         finalizeConstruction(writeProtected);
@@ -1699,33 +1696,6 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable
{
                + (classIntrospector.isShared() ? "@" + System.identityHashCode(classIntrospector)
: "none");
     }
 
-    private static ClassBasedModelFactory createEnumModels(BeansWrapper wrapper) {
-        if (ENUMS_MODEL_CTOR != null) {
-            try {
-                return (ClassBasedModelFactory) ENUMS_MODEL_CTOR.newInstance(
-                        new Object[] { wrapper });
-            } catch (Exception e) {
-                throw new UndeclaredThrowableException(e);
-            }
-        } else {
-            return null;
-        }
-    }
-    
-    private static Constructor enumsModelCtor() {
-        try {
-            // Check if Enums are available on this platform
-            Class.forName("java.lang.Enum");
-            // If they are, return the appropriate constructor for enum models
-            return Class.forName(
-                "freemarker.ext.beans._EnumModels").getDeclaredConstructor(
-                        new Class[] { BeansWrapper.class });
-        } catch (Exception e) {
-            // Otherwise, return null
-            return null;
-        }
-    }
-
     /**
      * Used for
      * {@link MethodAppearanceFineTuner#process}


Mime
View raw message