db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirmal Fernando <nirmal070...@gmail.com>
Subject Re: Using "enums" in the code
Date Fri, 14 Jan 2011 13:22:33 GMT
Hi Knut, thanks for the quick response!

I am looking into "Add all data in XPlain tables into the XML file generated
by PlanExporter Tool" (https://issues.apache.org/jira/browse/DERBY-4783)
improvement, and I felt that it will be really inefficient to use large
number of "int Enum patterns"[1] and case statements. So that is why I am
wondering whether it is ok to use "*Typesafe Enum* pattern**"[1] in
PlanExporter.

I really appreciate your valuable opinion on this to proceed with this
improvement!

Thanks!

[1] http://download.oracle.com/javase/1.5.0/docs/guide/language/enums.html

On Fri, Jan 14, 2011 at 6:33 PM, Knut Anders Hatlen <knut.hatlen@oracle.com>
wrote:
>
> Nirmal Fernando <nirmal070125@gmail.com> writes:
>
> > Hi All,
> >
> > Is there away to use "enums" in Derby, I mean is it possible to say
> > Ant to avoid using Java 1.4 for compiling classes where enums are
> > used, and use Java 1.5 instead?
>
> Hi Nirmal,
>
> It is possible. See for example
> java/testing/org/apache/derbyTesting/functionTests/util/build.xml and
> java/engine/org/apache/derby/impl/services/build.xml which contain javac
> targets with source and target level set to 1.5:
>
>    <javac
>      source="1.5"
>      target="1.5"
>      ...
>
> The classes that are compiled this way can only be used on a Java 1.5 or
> higher VM, so this technique cannot be used in core functionality unless
> an alternative implementation that works on Java 1.4 is provided. For
> example, we have a lock manager implementation that depends on
> java.util.concurrent.ConcurrentHashMap for performance reasons, but
> since ConcurrentHashMap is only available on Java 1.5 and higher, we use
> another implementation that's based on java.util.HashMap on older
> platforms.
>
> --
> Knut Anders



--
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.
Blog: http://nirmalfdo.blogspot.com/

Mime
View raw message